]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: identify attr dabtree field types correctly
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 30 Jun 2017 16:02:46 +0000 (11:02 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 30 Jun 2017 16:02:46 +0000 (11:02 -0500)
For whatever reason, the v5 xattr dabtree header fields are mapped to
the directory dabtree header fields, which means that the types are
wrong and hence we cannot use the 'addr' command to step through the
tree.  Since the v4 attr dabtree does this correctly, simply port the v5
fields to the attr code too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/attr.c
db/attr.h
db/field.c
db/field.h

index e26ac67e0232e149a5ba1b3729c66aa3424c00ae..31536a8b3802db9a62e343c066139b8f11ce30bb 100644 (file)
--- a/db/attr.c
+++ b/db/attr.c
@@ -499,7 +499,7 @@ const field_t       attr3_hfld[] = {
 const field_t  attr3_flds[] = {
        { "hdr", FLDT_ATTR3_LEAF_HDR, OI(L3OFF(hdr)), attr3_leaf_hdr_count,
          FLD_COUNT, TYP_NONE },
-       { "hdr", FLDT_DA3_NODE_HDR, OI(N3OFF(hdr)), attr3_node_hdr_count,
+       { "hdr", FLDT_ATTR3_NODE_HDR, OI(N3OFF(hdr)), attr3_node_hdr_count,
          FLD_COUNT, TYP_NONE },
        { "entries", FLDT_ATTR_LEAF_ENTRY, OI(L3OFF(entries)),
          attr3_leaf_entries_count, FLD_ARRAY|FLD_COUNT, TYP_NONE },
@@ -512,7 +512,7 @@ const field_t       attr3_flds[] = {
 
 #define        LH3OFF(f)       bitize(offsetof(struct xfs_attr3_leaf_hdr, f))
 const field_t  attr3_leaf_hdr_flds[] = {
-       { "info", FLDT_DA3_BLKINFO, OI(LH3OFF(info)), C1, 0, TYP_NONE },
+       { "info", FLDT_ATTR3_BLKINFO, OI(LH3OFF(info)), C1, 0, TYP_NONE },
        { "count", FLDT_UINT16D, OI(LH3OFF(count)), C1, 0, TYP_NONE },
        { "usedbytes", FLDT_UINT16D, OI(LH3OFF(usedbytes)), C1, 0, TYP_NONE },
        { "firstused", FLDT_UINT16D, OI(LH3OFF(firstused)), C1, 0, TYP_NONE },
@@ -523,6 +523,26 @@ const field_t      attr3_leaf_hdr_flds[] = {
        { NULL }
 };
 
+#define        B3OFF(f)        bitize(offsetof(struct xfs_da3_blkinfo, f))
+const field_t  attr3_blkinfo_flds[] = {
+       { "hdr", FLDT_ATTR_BLKINFO, OI(B3OFF(hdr)), C1, 0, TYP_NONE },
+       { "crc", FLDT_CRC, OI(B3OFF(crc)), C1, 0, TYP_NONE },
+       { "bno", FLDT_DFSBNO, OI(B3OFF(blkno)), C1, 0, TYP_BMAPBTD },
+       { "lsn", FLDT_UINT64X, OI(B3OFF(lsn)), C1, 0, TYP_NONE },
+       { "uuid", FLDT_UUID, OI(B3OFF(uuid)), C1, 0, TYP_NONE },
+       { "owner", FLDT_INO, OI(B3OFF(owner)), C1, 0, TYP_NONE },
+       { NULL }
+};
+
+#define        H3OFF(f)        bitize(offsetof(struct xfs_da3_node_hdr, f))
+const field_t  attr3_node_hdr_flds[] = {
+       { "info", FLDT_ATTR3_BLKINFO, OI(H3OFF(info)), C1, 0, TYP_NONE },
+       { "count", FLDT_UINT16D, OI(H3OFF(__count)), C1, 0, TYP_NONE },
+       { "level", FLDT_UINT16D, OI(H3OFF(__level)), C1, 0, TYP_NONE },
+       { "pad", FLDT_UINT32D, OI(H3OFF(__pad32)), C1, 0, TYP_NONE },
+       { NULL }
+};
+
 /*
  * Special read verifier for attribute buffers. Detect the magic number
  * appropriately and set the correct verifier and call it.
index bc3431f9e0e637479f56705146399ec0056c1ab8..21848c144e3c41d52774398babec77a2ed6f4098 100644 (file)
--- a/db/attr.h
+++ b/db/attr.h
@@ -30,6 +30,8 @@ extern const field_t  attr3_flds[];
 extern const field_t   attr3_hfld[];
 extern const field_t   attr3_leaf_hdr_flds[];
 extern const field_t   attr3_node_hdr_flds[];
+extern const field_t   attr3_blkinfo_flds[];
+extern const field_t   attr3_node_hdr_flds[];
 
 extern int     attr_leaf_name_size(void *obj, int startoff, int idx);
 extern int     attr_size(void *obj, int startoff, int idx);
index 1968dd5b1d9a8b41c2c8b2af6b2307d07df4774e..865b0b71692931eb7cbca0d7a24aafd7522da7b8 100644 (file)
@@ -91,12 +91,14 @@ const ftattr_t      ftattrtab[] = {
 /* attr3 specific fields */
        { FLDT_ATTR3, "attr3", NULL, (char *)attr3_flds, attr_size, FTARG_SIZE,
          NULL, attr3_flds },
+       { FLDT_ATTR3_BLKINFO, "attr3_blkinfo", NULL, (char *)attr3_blkinfo_flds,
+         SI(bitsz(struct xfs_da3_blkinfo)), 0, NULL, attr3_blkinfo_flds },
        { FLDT_ATTR3_LEAF_HDR, "attr3_leaf_hdr", NULL,
          (char *)attr3_leaf_hdr_flds, SI(bitsz(struct xfs_attr3_leaf_hdr)),
          0, NULL, attr3_leaf_hdr_flds },
        { FLDT_ATTR3_NODE_HDR, "attr3_node_hdr", NULL,
-         (char *)da3_node_hdr_flds, SI(bitsz(struct xfs_da3_node_hdr)),
-         0, NULL, da3_node_hdr_flds },
+         (char *)attr3_node_hdr_flds, SI(bitsz(struct xfs_da3_node_hdr)),
+         0, NULL, attr3_node_hdr_flds },
 
        { FLDT_BMAPBTA, "bmapbta", NULL, (char *)bmapbta_flds, btblock_size,
          FTARG_SIZE, NULL, bmapbta_flds },
index 53616f18fe094437bc07493ba21bde65a64ac406..d1a70951b0dc662a66fb2bacf2735d9739d29e19 100644 (file)
@@ -44,6 +44,7 @@ typedef enum fldt     {
 
        /* attr 3 specific fields */
        FLDT_ATTR3,
+       FLDT_ATTR3_BLKINFO,
        FLDT_ATTR3_LEAF_HDR,
        FLDT_ATTR3_NODE_HDR,