}
}
+static int
+dir3_data_union_ftype_offset(
+ void *obj,
+ int startoff,
+ int idx)
+{
+ xfs_dir2_data_entry_t *dep;
+ xfs_dir2_data_unused_t *dup;
+
+ ASSERT(bitoffs(startoff) == 0);
+ ASSERT(idx == 0);
+ dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
+ if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
+ return bitize((int)((char *)xfs_dir2_data_unused_tag_p(dup) -
+ (char *)dup));
+ dep = (xfs_dir2_data_entry_t *)dup;
+ return bitize((int)((char *)&dep->name[dep->namelen] - (char *)dep));
+}
+
/*
* Free block functions
*/
const field_t dir3_flds[] = {
{ "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
FLD_COUNT, TYP_NONE },
- { "bu", FLDT_DIR2_DATA_UNION, dir2_block_u_offset, dir2_block_u_count,
+ { "bu", FLDT_DIR3_DATA_UNION, dir2_block_u_offset, dir2_block_u_count,
FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "bleaf", FLDT_DIR2_LEAF_ENTRY, dir2_block_leaf_offset,
dir2_block_leaf_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
dir3_block_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "dhdr", FLDT_DIR3_DATA_HDR, OI(D3OFF(hdr)), dir3_data_hdr_count,
FLD_COUNT, TYP_NONE },
- { "du", FLDT_DIR2_DATA_UNION, dir2_data_u_offset, dir2_data_u_count,
+ { "du", FLDT_DIR3_DATA_UNION, dir2_data_u_offset, dir2_data_u_count,
FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "lhdr", FLDT_DIR3_LEAF_HDR, OI(L3OFF(hdr)), dir3_leaf_hdr_count,
FLD_COUNT, TYP_NONE },
{ NULL }
};
+#define D3EOFF(f) bitize(offsetof(xfs_dir2_data_entry_t, f))
+#define D3UOFF(f) bitize(offsetof(xfs_dir2_data_unused_t, f))
+const field_t dir3_data_union_flds[] = {
+ { "freetag", FLDT_UINT16X, OI(D3UOFF(freetag)),
+ dir2_data_union_freetag_count, FLD_COUNT, TYP_NONE },
+ { "inumber", FLDT_INO, OI(D3EOFF(inumber)),
+ dir2_data_union_inumber_count, FLD_COUNT, TYP_INODE },
+ { "length", FLDT_DIR2_DATA_OFF, OI(D3UOFF(length)),
+ dir2_data_union_length_count, FLD_COUNT, TYP_NONE },
+ { "namelen", FLDT_UINT8D, OI(D3EOFF(namelen)),
+ dir2_data_union_namelen_count, FLD_COUNT, TYP_NONE },
+ { "name", FLDT_CHARNS, OI(D3EOFF(name)), dir2_data_union_name_count,
+ FLD_COUNT, TYP_NONE },
+ { "filetype", FLDT_UINT8D, dir3_data_union_ftype_offset, C1,
+ FLD_OFFSET, TYP_NONE },
+ { "tag", FLDT_DIR2_DATA_OFF, dir2_data_union_tag_offset,
+ dir2_data_union_tag_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
+ { NULL }
+};
+
#define DBH3OFF(f) bitize(offsetof(struct xfs_dir3_blk_hdr, f))
const field_t dir3_blkhdr_flds[] = {
{ "magic", FLDT_UINT32X, OI(DBH3OFF(magic)), C1, 0, TYP_NONE },
extern const field_t dir3_data_hdr_flds[];
extern const field_t dir3_free_hdr_flds[];
extern const field_t dir3_leaf_hdr_flds[];
+extern const field_t dir3_data_union_flds[];
extern const field_t da3_blkinfo_flds[];
extern const field_t da3_node_hdr_flds[];
return e->namelen;
}
-/*ARGSUSED*/
static int
dir2_sf_entry_inumber_offset(
void *obj,
return bitize((int)((char *)xfs_dir2_sf_inumberp(e) - (char *)e));
}
+static int
+dir3_sf_entry_inumber_offset(
+ void *obj,
+ int startoff,
+ int idx)
+{
+ xfs_dir2_sf_entry_t *e;
+
+ ASSERT(bitoffs(startoff) == 0);
+ ASSERT(idx == 0);
+ e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
+ /* plus 1 to skip the ftype entry */
+ return bitize((int)((char *)xfs_dir2_sf_inumberp(e) + 1 - (char *)e));
+}
+
+static int
+dir3_sf_entry_ftype_offset(
+ void *obj,
+ int startoff,
+ int idx)
+{
+ xfs_dir2_sf_entry_t *e;
+
+ ASSERT(bitoffs(startoff) == 0);
+ ASSERT(idx == 0);
+ e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
+ return bitize((int)((char *)&e->name[e->namelen] - (char *)e));
+}
+
int
dir2_sf_entry_size(
void *obj,
e = xfs_dir3_sf_nextentry(mp, sf, e);
return bitize((int)((char *)e - (char *)sf));
}
+
+#define OFF(f) bitize(offsetof(struct xfs_dir2_sf_hdr, f))
+const field_t dir3sf_flds[] = {
+ { "hdr", FLDT_DIR2_SF_HDR, OI(OFF(count)), C1, 0, TYP_NONE },
+ { "list", FLDT_DIR3_SF_ENTRY, dir2_sf_list_offset, dir2_sf_list_count,
+ FLD_ARRAY|FLD_COUNT|FLD_OFFSET, TYP_NONE },
+ { NULL }
+};
+
+#define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f))
+const field_t dir3_sf_entry_flds[] = {
+ { "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
+ { "offset", FLDT_DIR2_SF_OFF, OI(EOFF(offset)), C1, 0, TYP_NONE },
+ { "name", FLDT_CHARNS, OI(EOFF(name)), dir2_sf_entry_name_count,
+ FLD_COUNT, TYP_NONE },
+ { "inumber", FLDT_DIR2_INOU, dir3_sf_entry_inumber_offset, C1,
+ FLD_OFFSET, TYP_NONE },
+ { "filetype", FLDT_UINT8D, dir3_sf_entry_ftype_offset, C1,
+ FLD_OFFSET, TYP_NONE },
+ { NULL }
+};
+
extern const field_t dir2_sf_hdr_flds[];
extern const field_t dir2_sf_entry_flds[];
+extern const field_t dir3sf_flds[];
+extern const field_t dir3_sf_entry_flds[];
+
extern int dir2sf_size(void *obj, int startoff, int idx);
extern int dir2_inou_size(void *obj, int startoff, int idx);
extern int dir2_sf_entry_size(void *obj, int startoff, int idx);
SI(bitsz(struct xfs_dir3_free_hdr)), 0, NULL, dir3_free_hdr_flds },
{ FLDT_DIR3_LEAF_HDR, "dir3_leaf_hdr", NULL, (char *)dir3_leaf_hdr_flds,
SI(bitsz(struct xfs_dir3_leaf_hdr)), 0, NULL, dir3_leaf_hdr_flds },
+ { FLDT_DIR3_DATA_UNION, "dir3_data_union", NULL,
+ (char *)dir3_data_union_flds, dir2_data_union_size, FTARG_SIZE, NULL,
+ dir3_data_union_flds },
+ { FLDT_DIR3_SF_ENTRY, "dir3_sf_entry", NULL, (char *)dir3_sf_entry_flds,
+ dir2_sf_entry_size, FTARG_SIZE, NULL, dir3_sf_entry_flds },
+ { FLDT_DIR3SF, "dir3sf", NULL, (char *)dir3sf_flds, dir2sf_size,
+ FTARG_SIZE, NULL, dir3sf_flds },
/* dir v2/3 node fields */
{ FLDT_DA_BLKINFO, "dir_blkinfo", NULL, (char *)da_blkinfo_flds,
FLDT_DIR3_DATA_HDR,
FLDT_DIR3_FREE_HDR,
FLDT_DIR3_LEAF_HDR,
+ FLDT_DIR3_DATA_UNION,
+ FLDT_DIR3_SF_ENTRY,
+ FLDT_DIR3SF,
/* dir v2/3 node fields */
FLDT_DA_BLKINFO,
static int inode_u_dev_count(void *obj, int startoff);
static int inode_u_muuid_count(void *obj, int startoff);
static int inode_u_sfdir2_count(void *obj, int startoff);
+static int inode_u_sfdir3_count(void *obj, int startoff);
static int inode_u_symlink_count(void *obj, int startoff);
static const cmdinfo_t inode_cmd =
{ "next_unlinked", FLDT_AGINO, OI(OFF(next_unlinked)), C1, 0,
TYP_INODE },
{ "v3", FLDT_DINODE_V3, OI(OFF(magic)), C1, 0, TYP_NONE },
- { "u", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE },
+ { "u3", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE },
{ "a", FLDT_DINODE_A, inode_a_offset, inode_a_count,
FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
{ "dev", FLDT_DEV, NULL, inode_u_dev_count, FLD_COUNT, TYP_NONE },
{ "muuid", FLDT_UUID, NULL, inode_u_muuid_count, FLD_COUNT, TYP_NONE },
{ "sfdir2", FLDT_DIR2SF, NULL, inode_u_sfdir2_count, FLD_COUNT, TYP_NONE },
+ { "sfdir3", FLDT_DIR3SF, NULL, inode_u_sfdir3_count, FLD_COUNT, TYP_NONE },
{ "symlink", FLDT_CHARNS, NULL, inode_u_symlink_count, FLD_COUNT,
TYP_NONE },
{ NULL }
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_LOCAL &&
(be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFDIR &&
- xfs_sb_version_hasdirv2(&mp->m_sb);
+ xfs_sb_version_hasdirv2(&mp->m_sb) &&
+ !xfs_sb_version_hasftype(&mp->m_sb);
+}
+
+static int
+inode_u_sfdir3_count(
+ void *obj,
+ int startoff)
+{
+ xfs_dinode_t *dip;
+
+ ASSERT(bitoffs(startoff) == 0);
+ ASSERT(obj == iocur_top->data);
+ dip = obj;
+ ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
+ return dip->di_format == XFS_DINODE_FMT_LOCAL &&
+ (be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFDIR &&
+ xfs_sb_version_hasftype(&mp->m_sb);
}
int
(sectorsize != BBSIZE ||
lsectorsize != BBSIZE),
nci, sbp->sb_features2 != 0);
+ /*
+ * dirent filetype field always enabled on v5 superblocks
+ */
+ if (crcs_enabled) {
+ sbp->sb_features_incompat = XFS_SB_FEAT_INCOMPAT_FTYPE;
+ }
+
/*
* Due to a structure alignment issue, sb_features2 ended up in one
* of two locations, the second "incorrect" location represented by