xfs
[Top] [All Lists]

[patch 5/4] xfsprogs: add field types to v4 xfs_db directory entries

To: XFS Community List <xfs@xxxxxxxxxxx>
Subject: [patch 5/4] xfsprogs: add field types to v4 xfs_db directory entries
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Wed, 23 Oct 2013 08:39:28 -0500
Delivered-to: xfs@xxxxxxxxxxx
References: <20131017152804.204045257@xxxxxxx>
User-agent: quilt/0.51-1
Display the inode type field that follows the name in xfs_db
for dir2 (non-crc filesystems) that enabled the feature
(mkfs -n ftype).

Signed-off-by: Mark Tinguely <tinguely@xxxxxxx>
---
 db/dir2.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: b/db/dir2.c
===================================================================
--- a/db/dir2.c
+++ b/db/dir2.c
@@ -52,6 +52,8 @@ static int    dir2_leaf_tail_count(void *ob
 static int     dir2_leaf_tail_offset(void *obj, int startoff, int idx);
 static int     dir2_node_btree_count(void *obj, int startoff);
 static int     dir2_node_hdr_count(void *obj, int startoff);
+static int     dir3_data_union_ftype_offset(void *obj, int startoff, int idx);
+static int     dir2_data_union_ftype_count(void *obj, int startoff);
 
 const field_t  dir2_hfld[] = {
        { "", FLDT_DIR2, OI(0), C1, 0, TYP_NONE },
@@ -130,6 +132,8 @@ const field_t       dir2_data_union_flds[] = {
          dir2_data_union_namelen_count, FLD_COUNT, TYP_NONE },
        { "name", FLDT_CHARNS, OI(DEOFF(name)), dir2_data_union_name_count,
          FLD_COUNT, TYP_NONE },
+       { "filetype", FLDT_UINT8D, dir3_data_union_ftype_offset,
+         dir2_data_union_ftype_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
        { "tag", FLDT_DIR2_DATA_OFF, dir2_data_union_tag_offset,
          dir2_data_union_tag_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
        { NULL }
@@ -454,6 +458,14 @@ dir2_data_union_name_count(
 }
 
 static int
+dir2_data_union_ftype_count(
+       void                    *obj,
+       int                     startoff)
+{
+       return xfs_sb_version_hasftype(&mp->m_sb);
+}
+
+static int
 dir2_data_union_namelen_count(
        void                    *obj,
        int                     startoff)


<Prev in Thread] Current Thread [Next in Thread>