2 * Copyright (c) 2000-2001,2004-2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 static int attr_leaf_entries_count(void *obj
, int startoff
);
31 static int attr_leaf_hdr_count(void *obj
, int startoff
);
32 static int attr_leaf_name_local_count(void *obj
, int startoff
);
33 static int attr_leaf_name_local_name_count(void *obj
, int startoff
);
34 static int attr_leaf_name_local_value_count(void *obj
, int startoff
);
35 static int attr_leaf_name_local_value_offset(void *obj
, int startoff
,
37 static int attr_leaf_name_remote_count(void *obj
, int startoff
);
38 static int attr_leaf_name_remote_name_count(void *obj
, int startoff
);
39 static int attr_leaf_nvlist_count(void *obj
, int startoff
);
40 static int attr_leaf_nvlist_offset(void *obj
, int startoff
, int idx
);
41 static int attr_node_btree_count(void *obj
, int startoff
);
42 static int attr_node_hdr_count(void *obj
, int startoff
);
44 static int attr_remote_data_count(void *obj
, int startoff
);
45 static int attr3_remote_hdr_count(void *obj
, int startoff
);
46 static int attr3_remote_data_count(void *obj
, int startoff
);
48 const field_t attr_hfld
[] = {
49 { "", FLDT_ATTR
, OI(0), C1
, 0, TYP_NONE
},
53 #define LOFF(f) bitize(offsetof(xfs_attr_leafblock_t, f))
54 #define NOFF(f) bitize(offsetof(xfs_da_intnode_t, f))
55 const field_t attr_flds
[] = {
56 { "hdr", FLDT_ATTR_LEAF_HDR
, OI(LOFF(hdr
)), attr_leaf_hdr_count
,
57 FLD_COUNT
, TYP_NONE
},
58 { "hdr", FLDT_ATTR_NODE_HDR
, OI(NOFF(hdr
)), attr_node_hdr_count
,
59 FLD_COUNT
, TYP_NONE
},
60 { "data", FLDT_CHARNS
, OI(0), attr_remote_data_count
, FLD_COUNT
,
62 { "entries", FLDT_ATTR_LEAF_ENTRY
, OI(LOFF(entries
)),
63 attr_leaf_entries_count
, FLD_ARRAY
|FLD_COUNT
, TYP_NONE
},
64 { "btree", FLDT_ATTR_NODE_ENTRY
, OI(NOFF(__btree
)), attr_node_btree_count
,
65 FLD_ARRAY
|FLD_COUNT
, TYP_NONE
},
66 { "nvlist", FLDT_ATTR_LEAF_NAME
, attr_leaf_nvlist_offset
,
67 attr_leaf_nvlist_count
, FLD_ARRAY
|FLD_OFFSET
|FLD_COUNT
, TYP_NONE
},
71 #define BOFF(f) bitize(offsetof(xfs_da_blkinfo_t, f))
72 const field_t attr_blkinfo_flds
[] = {
73 { "forw", FLDT_ATTRBLOCK
, OI(BOFF(forw
)), C1
, 0, TYP_ATTR
},
74 { "back", FLDT_ATTRBLOCK
, OI(BOFF(back
)), C1
, 0, TYP_ATTR
},
75 { "magic", FLDT_UINT16X
, OI(BOFF(magic
)), C1
, 0, TYP_NONE
},
76 { "pad", FLDT_UINT16X
, OI(BOFF(pad
)), C1
, FLD_SKIPALL
, TYP_NONE
},
80 #define LEOFF(f) bitize(offsetof(xfs_attr_leaf_entry_t, f))
81 const field_t attr_leaf_entry_flds
[] = {
82 { "hashval", FLDT_UINT32X
, OI(LEOFF(hashval
)), C1
, 0, TYP_NONE
},
83 { "nameidx", FLDT_UINT16D
, OI(LEOFF(nameidx
)), C1
, 0, TYP_NONE
},
84 { "flags", FLDT_UINT8X
, OI(LEOFF(flags
)), C1
, FLD_SKIPALL
, TYP_NONE
},
85 { "incomplete", FLDT_UINT1
,
86 OI(LEOFF(flags
) + bitsz(uint8_t) - XFS_ATTR_INCOMPLETE_BIT
- 1), C1
,
89 OI(LEOFF(flags
) + bitsz(uint8_t) - XFS_ATTR_ROOT_BIT
- 1), C1
, 0,
91 { "secure", FLDT_UINT1
,
92 OI(LEOFF(flags
) + bitsz(uint8_t) - XFS_ATTR_SECURE_BIT
- 1), C1
, 0,
94 { "local", FLDT_UINT1
,
95 OI(LEOFF(flags
) + bitsz(uint8_t) - XFS_ATTR_LOCAL_BIT
- 1), C1
, 0,
97 { "pad2", FLDT_UINT8X
, OI(LEOFF(pad2
)), C1
, FLD_SKIPALL
, TYP_NONE
},
101 #define LHOFF(f) bitize(offsetof(xfs_attr_leaf_hdr_t, f))
102 const field_t attr_leaf_hdr_flds
[] = {
103 { "info", FLDT_ATTR_BLKINFO
, OI(LHOFF(info
)), C1
, 0, TYP_NONE
},
104 { "count", FLDT_UINT16D
, OI(LHOFF(count
)), C1
, 0, TYP_NONE
},
105 { "usedbytes", FLDT_UINT16D
, OI(LHOFF(usedbytes
)), C1
, 0, TYP_NONE
},
106 { "firstused", FLDT_UINT16D
, OI(LHOFF(firstused
)), C1
, 0, TYP_NONE
},
107 { "holes", FLDT_UINT8D
, OI(LHOFF(holes
)), C1
, 0, TYP_NONE
},
108 { "pad1", FLDT_UINT8X
, OI(LHOFF(pad1
)), C1
, FLD_SKIPALL
, TYP_NONE
},
109 { "freemap", FLDT_ATTR_LEAF_MAP
, OI(LHOFF(freemap
)),
110 CI(XFS_ATTR_LEAF_MAPSIZE
), FLD_ARRAY
, TYP_NONE
},
114 #define LMOFF(f) bitize(offsetof(xfs_attr_leaf_map_t, f))
115 const field_t attr_leaf_map_flds
[] = {
116 { "base", FLDT_UINT16D
, OI(LMOFF(base
)), C1
, 0, TYP_NONE
},
117 { "size", FLDT_UINT16D
, OI(LMOFF(size
)), C1
, 0, TYP_NONE
},
121 #define LNOFF(f) bitize(offsetof(xfs_attr_leaf_name_local_t, f))
122 #define LVOFF(f) bitize(offsetof(xfs_attr_leaf_name_remote_t, f))
123 const field_t attr_leaf_name_flds
[] = {
124 { "valuelen", FLDT_UINT16D
, OI(LNOFF(valuelen
)),
125 attr_leaf_name_local_count
, FLD_COUNT
, TYP_NONE
},
126 { "namelen", FLDT_UINT8D
, OI(LNOFF(namelen
)),
127 attr_leaf_name_local_count
, FLD_COUNT
, TYP_NONE
},
128 { "name", FLDT_CHARNS
, OI(LNOFF(nameval
)),
129 attr_leaf_name_local_name_count
, FLD_COUNT
, TYP_NONE
},
130 { "value", FLDT_CHARNS
, attr_leaf_name_local_value_offset
,
131 attr_leaf_name_local_value_count
, FLD_COUNT
|FLD_OFFSET
, TYP_NONE
},
132 { "valueblk", FLDT_UINT32X
, OI(LVOFF(valueblk
)),
133 attr_leaf_name_remote_count
, FLD_COUNT
, TYP_NONE
},
134 { "valuelen", FLDT_UINT32D
, OI(LVOFF(valuelen
)),
135 attr_leaf_name_remote_count
, FLD_COUNT
, TYP_NONE
},
136 { "namelen", FLDT_UINT8D
, OI(LVOFF(namelen
)),
137 attr_leaf_name_remote_count
, FLD_COUNT
, TYP_NONE
},
138 { "name", FLDT_CHARNS
, OI(LVOFF(name
)),
139 attr_leaf_name_remote_name_count
, FLD_COUNT
, TYP_NONE
},
143 #define EOFF(f) bitize(offsetof(xfs_da_node_entry_t, f))
144 const field_t attr_node_entry_flds
[] = {
145 { "hashval", FLDT_UINT32X
, OI(EOFF(hashval
)), C1
, 0, TYP_NONE
},
146 { "before", FLDT_ATTRBLOCK
, OI(EOFF(before
)), C1
, 0, TYP_ATTR
},
150 #define HOFF(f) bitize(offsetof(xfs_da_node_hdr_t, f))
151 const field_t attr_node_hdr_flds
[] = {
152 { "info", FLDT_ATTR_BLKINFO
, OI(HOFF(info
)), C1
, 0, TYP_NONE
},
153 { "count", FLDT_UINT16D
, OI(HOFF(__count
)), C1
, 0, TYP_NONE
},
154 { "level", FLDT_UINT16D
, OI(HOFF(__level
)), C1
, 0, TYP_NONE
},
159 attr_leaf_entries_count(
163 struct xfs_attr_leafblock
*leaf
= obj
;
165 ASSERT(startoff
== 0);
166 if (be16_to_cpu(leaf
->hdr
.info
.magic
) != XFS_ATTR_LEAF_MAGIC
)
168 return be16_to_cpu(leaf
->hdr
.count
);
172 attr3_leaf_entries_count(
176 struct xfs_attr3_leafblock
*leaf
= obj
;
178 ASSERT(startoff
== 0);
179 if (be16_to_cpu(leaf
->hdr
.info
.hdr
.magic
) != XFS_ATTR3_LEAF_MAGIC
)
181 return be16_to_cpu(leaf
->hdr
.count
);
189 struct xfs_attr_leafblock
*leaf
= obj
;
191 ASSERT(startoff
== 0);
192 return be16_to_cpu(leaf
->hdr
.info
.magic
) == XFS_ATTR_LEAF_MAGIC
;
196 attr3_leaf_hdr_count(
200 struct xfs_attr3_leafblock
*leaf
= obj
;
202 ASSERT(startoff
== 0);
203 return be16_to_cpu(leaf
->hdr
.info
.hdr
.magic
) == XFS_ATTR3_LEAF_MAGIC
;
207 attr_remote_data_count(
211 if (attr_leaf_hdr_count(obj
, startoff
) == 0 &&
212 attr_node_hdr_count(obj
, startoff
) == 0)
213 return mp
->m_sb
.sb_blocksize
;
218 attr3_remote_data_count(
222 struct xfs_attr3_rmt_hdr
*hdr
= obj
;
225 ASSERT(startoff
== 0);
227 if (hdr
->rm_magic
!= cpu_to_be32(XFS_ATTR3_RMT_MAGIC
))
229 buf_space
= XFS_ATTR3_RMT_BUF_SPACE(mp
, mp
->m_sb
.sb_blocksize
);
230 if (be32_to_cpu(hdr
->rm_bytes
) > buf_space
)
232 return be32_to_cpu(hdr
->rm_bytes
);
235 typedef int (*attr_leaf_entry_walk_f
)(struct xfs_attr_leafblock
*,
236 struct xfs_attr_leaf_entry
*, int);
238 attr_leaf_entry_walk(
241 attr_leaf_entry_walk_f func
)
243 struct xfs_attr_leafblock
*leaf
= obj
;
244 struct xfs_attr3_icleaf_hdr leafhdr
;
245 struct xfs_attr_leaf_entry
*entries
;
246 struct xfs_attr_leaf_entry
*e
;
250 ASSERT(bitoffs(startoff
) == 0);
251 if (be16_to_cpu(leaf
->hdr
.info
.magic
) != XFS_ATTR_LEAF_MAGIC
&&
252 be16_to_cpu(leaf
->hdr
.info
.magic
) != XFS_ATTR3_LEAF_MAGIC
)
255 off
= byteize(startoff
);
256 xfs_attr3_leaf_hdr_from_disk(mp
->m_attr_geo
, &leafhdr
, leaf
);
257 entries
= xfs_attr3_leaf_entryp(leaf
);
259 for (i
= 0; i
< leafhdr
.count
; i
++) {
261 if (be16_to_cpu(e
->nameidx
) == off
)
262 return func(leaf
, e
, i
);
268 __attr_leaf_name_local_count(
269 struct xfs_attr_leafblock
*leaf
,
270 struct xfs_attr_leaf_entry
*e
,
273 return (e
->flags
& XFS_ATTR_LOCAL
) != 0;
277 attr_leaf_name_local_count(
281 return attr_leaf_entry_walk(obj
, startoff
,
282 __attr_leaf_name_local_count
);
286 __attr_leaf_name_local_name_count(
287 struct xfs_attr_leafblock
*leaf
,
288 struct xfs_attr_leaf_entry
*e
,
291 struct xfs_attr_leaf_name_local
*l
;
293 if (!(e
->flags
& XFS_ATTR_LOCAL
))
296 l
= xfs_attr3_leaf_name_local(leaf
, i
);
301 attr_leaf_name_local_name_count(
305 return attr_leaf_entry_walk(obj
, startoff
,
306 __attr_leaf_name_local_name_count
);
310 __attr_leaf_name_local_value_count(
311 struct xfs_attr_leafblock
*leaf
,
312 struct xfs_attr_leaf_entry
*e
,
315 struct xfs_attr_leaf_name_local
*l
;
317 if (!(e
->flags
& XFS_ATTR_LOCAL
))
320 l
= xfs_attr3_leaf_name_local(leaf
, i
);
321 return be16_to_cpu(l
->valuelen
);
325 attr_leaf_name_local_value_count(
329 return attr_leaf_entry_walk(obj
, startoff
,
330 __attr_leaf_name_local_value_count
);
334 __attr_leaf_name_local_value_offset(
335 struct xfs_attr_leafblock
*leaf
,
336 struct xfs_attr_leaf_entry
*e
,
339 struct xfs_attr_leaf_name_local
*l
;
342 l
= xfs_attr3_leaf_name_local(leaf
, i
);
343 vp
= (char *)&l
->nameval
[l
->namelen
];
345 return (int)bitize(vp
- (char *)l
);
349 attr_leaf_name_local_value_offset(
354 return attr_leaf_entry_walk(obj
, startoff
,
355 __attr_leaf_name_local_value_offset
);
359 __attr_leaf_name_remote_count(
360 struct xfs_attr_leafblock
*leaf
,
361 struct xfs_attr_leaf_entry
*e
,
364 return (e
->flags
& XFS_ATTR_LOCAL
) == 0;
368 attr_leaf_name_remote_count(
372 return attr_leaf_entry_walk(obj
, startoff
,
373 __attr_leaf_name_remote_count
);
377 __attr_leaf_name_remote_name_count(
378 struct xfs_attr_leafblock
*leaf
,
379 struct xfs_attr_leaf_entry
*e
,
382 struct xfs_attr_leaf_name_remote
*r
;
384 if (e
->flags
& XFS_ATTR_LOCAL
)
387 r
= xfs_attr3_leaf_name_remote(leaf
, i
);
392 attr_leaf_name_remote_name_count(
396 return attr_leaf_entry_walk(obj
, startoff
,
397 __attr_leaf_name_remote_name_count
);
406 struct xfs_attr_leafblock
*leaf
= obj
;
407 struct xfs_attr_leaf_entry
*e
;
408 struct xfs_attr_leaf_name_local
*l
;
409 struct xfs_attr_leaf_name_remote
*r
;
411 ASSERT(startoff
== 0);
412 if (be16_to_cpu(leaf
->hdr
.info
.magic
) != XFS_ATTR_LEAF_MAGIC
&&
413 be16_to_cpu(leaf
->hdr
.info
.magic
) != XFS_ATTR3_LEAF_MAGIC
)
415 e
= &xfs_attr3_leaf_entryp(leaf
)[idx
];
416 if (e
->flags
& XFS_ATTR_LOCAL
) {
417 l
= xfs_attr3_leaf_name_local(leaf
, idx
);
418 return (int)bitize(xfs_attr_leaf_entsize_local(l
->namelen
,
419 be16_to_cpu(l
->valuelen
)));
421 r
= xfs_attr3_leaf_name_remote(leaf
, idx
);
422 return (int)bitize(xfs_attr_leaf_entsize_remote(r
->namelen
));
427 attr_leaf_nvlist_count(
431 struct xfs_attr_leafblock
*leaf
= obj
;
433 ASSERT(startoff
== 0);
434 if (be16_to_cpu(leaf
->hdr
.info
.magic
) != XFS_ATTR_LEAF_MAGIC
)
436 return be16_to_cpu(leaf
->hdr
.count
);
440 attr3_leaf_nvlist_count(
444 struct xfs_attr3_leafblock
*leaf
= obj
;
446 ASSERT(startoff
== 0);
447 if (be16_to_cpu(leaf
->hdr
.info
.hdr
.magic
) != XFS_ATTR3_LEAF_MAGIC
)
449 return be16_to_cpu(leaf
->hdr
.count
);
453 attr_leaf_nvlist_offset(
458 struct xfs_attr_leafblock
*leaf
= obj
;
459 struct xfs_attr_leaf_entry
*e
;
461 ASSERT(startoff
== 0);
462 e
= &xfs_attr3_leaf_entryp(leaf
)[idx
];
463 return bitize(be16_to_cpu(e
->nameidx
));
467 attr_node_btree_count(
471 struct xfs_da_intnode
*node
= obj
;
473 ASSERT(startoff
== 0); /* this is a base structure */
474 if (be16_to_cpu(node
->hdr
.info
.magic
) != XFS_DA_NODE_MAGIC
)
476 return be16_to_cpu(node
->hdr
.__count
);
480 attr3_node_btree_count(
484 struct xfs_da3_intnode
*node
= obj
;
486 ASSERT(startoff
== 0);
487 if (be16_to_cpu(node
->hdr
.info
.hdr
.magic
) != XFS_DA3_NODE_MAGIC
)
489 return be16_to_cpu(node
->hdr
.__count
);
498 struct xfs_da_intnode
*node
= obj
;
500 ASSERT(startoff
== 0);
501 return be16_to_cpu(node
->hdr
.info
.magic
) == XFS_DA_NODE_MAGIC
;
505 attr3_node_hdr_count(
509 struct xfs_da3_intnode
*node
= obj
;
511 ASSERT(startoff
== 0);
512 return be16_to_cpu(node
->hdr
.info
.hdr
.magic
) == XFS_DA3_NODE_MAGIC
;
516 attr3_remote_hdr_count(
520 struct xfs_attr3_rmt_hdr
*node
= obj
;
522 ASSERT(startoff
== 0);
523 return be32_to_cpu(node
->rm_magic
) == XFS_ATTR3_RMT_MAGIC
;
532 return bitize(mp
->m_sb
.sb_blocksize
);
536 * CRC enabled attribute block field definitions
538 const field_t attr3_hfld
[] = {
539 { "", FLDT_ATTR3
, OI(0), C1
, 0, TYP_NONE
},
543 #define L3OFF(f) bitize(offsetof(struct xfs_attr3_leafblock, f))
544 #define N3OFF(f) bitize(offsetof(struct xfs_da3_intnode, f))
545 const field_t attr3_flds
[] = {
546 { "hdr", FLDT_ATTR3_LEAF_HDR
, OI(L3OFF(hdr
)), attr3_leaf_hdr_count
,
547 FLD_COUNT
, TYP_NONE
},
548 { "hdr", FLDT_ATTR3_NODE_HDR
, OI(N3OFF(hdr
)), attr3_node_hdr_count
,
549 FLD_COUNT
, TYP_NONE
},
550 { "hdr", FLDT_ATTR3_REMOTE_HDR
, OI(0), attr3_remote_hdr_count
,
551 FLD_COUNT
, TYP_NONE
},
552 { "data", FLDT_CHARNS
, OI(bitize(sizeof(struct xfs_attr3_rmt_hdr
))),
553 attr3_remote_data_count
, FLD_COUNT
, TYP_NONE
},
554 { "entries", FLDT_ATTR_LEAF_ENTRY
, OI(L3OFF(entries
)),
555 attr3_leaf_entries_count
, FLD_ARRAY
|FLD_COUNT
, TYP_NONE
},
556 { "btree", FLDT_ATTR_NODE_ENTRY
, OI(N3OFF(__btree
)),
557 attr3_node_btree_count
, FLD_ARRAY
|FLD_COUNT
, TYP_NONE
},
558 { "nvlist", FLDT_ATTR_LEAF_NAME
, attr_leaf_nvlist_offset
,
559 attr3_leaf_nvlist_count
, FLD_ARRAY
|FLD_OFFSET
|FLD_COUNT
, TYP_NONE
},
563 #define LH3OFF(f) bitize(offsetof(struct xfs_attr3_leaf_hdr, f))
564 const field_t attr3_leaf_hdr_flds
[] = {
565 { "info", FLDT_ATTR3_BLKINFO
, OI(LH3OFF(info
)), C1
, 0, TYP_NONE
},
566 { "count", FLDT_UINT16D
, OI(LH3OFF(count
)), C1
, 0, TYP_NONE
},
567 { "usedbytes", FLDT_UINT16D
, OI(LH3OFF(usedbytes
)), C1
, 0, TYP_NONE
},
568 { "firstused", FLDT_UINT16D
, OI(LH3OFF(firstused
)), C1
, 0, TYP_NONE
},
569 { "holes", FLDT_UINT8D
, OI(LH3OFF(holes
)), C1
, 0, TYP_NONE
},
570 { "pad1", FLDT_UINT8X
, OI(LH3OFF(pad1
)), C1
, FLD_SKIPALL
, TYP_NONE
},
571 { "freemap", FLDT_ATTR_LEAF_MAP
, OI(LH3OFF(freemap
)),
572 CI(XFS_ATTR_LEAF_MAPSIZE
), FLD_ARRAY
, TYP_NONE
},
576 #define B3OFF(f) bitize(offsetof(struct xfs_da3_blkinfo, f))
577 const field_t attr3_blkinfo_flds
[] = {
578 { "hdr", FLDT_ATTR_BLKINFO
, OI(B3OFF(hdr
)), C1
, 0, TYP_NONE
},
579 { "crc", FLDT_CRC
, OI(B3OFF(crc
)), C1
, 0, TYP_NONE
},
580 { "bno", FLDT_DFSBNO
, OI(B3OFF(blkno
)), C1
, 0, TYP_BMAPBTD
},
581 { "lsn", FLDT_UINT64X
, OI(B3OFF(lsn
)), C1
, 0, TYP_NONE
},
582 { "uuid", FLDT_UUID
, OI(B3OFF(uuid
)), C1
, 0, TYP_NONE
},
583 { "owner", FLDT_INO
, OI(B3OFF(owner
)), C1
, 0, TYP_NONE
},
587 #define H3OFF(f) bitize(offsetof(struct xfs_da3_node_hdr, f))
588 const field_t attr3_node_hdr_flds
[] = {
589 { "info", FLDT_ATTR3_BLKINFO
, OI(H3OFF(info
)), C1
, 0, TYP_NONE
},
590 { "count", FLDT_UINT16D
, OI(H3OFF(__count
)), C1
, 0, TYP_NONE
},
591 { "level", FLDT_UINT16D
, OI(H3OFF(__level
)), C1
, 0, TYP_NONE
},
592 { "pad", FLDT_UINT32X
, OI(H3OFF(__pad32
)), C1
, FLD_SKIPALL
, TYP_NONE
},
596 #define RM3OFF(f) bitize(offsetof(struct xfs_attr3_rmt_hdr, rm_ ## f))
597 const struct field attr3_remote_crc_flds
[] = {
598 { "magic", FLDT_UINT32X
, OI(RM3OFF(magic
)), C1
, 0, TYP_NONE
},
599 { "offset", FLDT_UINT32D
, OI(RM3OFF(offset
)), C1
, 0, TYP_NONE
},
600 { "bytes", FLDT_UINT32D
, OI(RM3OFF(bytes
)), C1
, 0, TYP_NONE
},
601 { "crc", FLDT_CRC
, OI(RM3OFF(crc
)), C1
, 0, TYP_NONE
},
602 { "uuid", FLDT_UUID
, OI(RM3OFF(uuid
)), C1
, 0, TYP_NONE
},
603 { "owner", FLDT_INO
, OI(RM3OFF(owner
)), C1
, 0, TYP_NONE
},
604 { "bno", FLDT_DFSBNO
, OI(RM3OFF(blkno
)), C1
, 0, TYP_BMAPBTD
},
605 { "lsn", FLDT_UINT64X
, OI(RM3OFF(lsn
)), C1
, 0, TYP_NONE
},
617 magic32
= *(__be32
*)bp
->b_addr
;
618 magic16
= ((struct xfs_da_blkinfo
*)bp
->b_addr
)->magic
;
621 case cpu_to_be16(XFS_ATTR3_LEAF_MAGIC
):
622 xfs_buf_update_cksum(bp
, XFS_ATTR3_LEAF_CRC_OFF
);
624 case cpu_to_be16(XFS_DA3_NODE_MAGIC
):
625 xfs_buf_update_cksum(bp
, XFS_DA3_NODE_CRC_OFF
);
632 case cpu_to_be32(XFS_ATTR3_RMT_MAGIC
):
633 xfs_buf_update_cksum(bp
, XFS_ATTR3_RMT_CRC_OFF
);
636 dbprintf(_("Unknown attribute buffer type!\n"));
642 * Special read verifier for attribute buffers. Detect the magic number
643 * appropriately and set the correct verifier and call it.
646 xfs_attr3_db_read_verify(
652 magic32
= *(__be32
*)bp
->b_addr
;
653 magic16
= ((struct xfs_da_blkinfo
*)bp
->b_addr
)->magic
;
656 case cpu_to_be16(XFS_ATTR3_LEAF_MAGIC
):
657 bp
->b_ops
= &xfs_attr3_leaf_buf_ops
;
659 case cpu_to_be16(XFS_DA3_NODE_MAGIC
):
660 bp
->b_ops
= &xfs_da3_node_buf_ops
;
667 case cpu_to_be32(XFS_ATTR3_RMT_MAGIC
):
668 bp
->b_ops
= &xfs_attr3_rmt_buf_ops
;
671 dbprintf(_("Unknown attribute buffer type!\n"));
672 xfs_buf_ioerror(bp
, -EFSCORRUPTED
);
676 bp
->b_ops
->verify_read(bp
);
680 xfs_attr3_db_write_verify(
683 dbprintf(_("Writing unknown attribute buffer type!\n"));
684 xfs_buf_ioerror(bp
, -EFSCORRUPTED
);
687 const struct xfs_buf_ops xfs_attr3_db_buf_ops
= {
689 .verify_read
= xfs_attr3_db_read_verify
,
690 .verify_write
= xfs_attr3_db_write_verify
,