xfs_db: use preferable macro to seek offset for local dir3 entry fields
PATCH 1/1 xfs_db: use preferable macro to seek offset for local dir3 entry fields
In 'xfsprogs-dev' source:
/* db/dir2sf.c begin */
#define EOFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f))
const field_t dir2_sf_entry_flds[] = {
{ "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
...
#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 },...
/* db/dir2sf.c end */
The macro definitions of 'EOFF' and 'E3OFF' are same, so no matter to use either to seek field offset in 'dir3_sf_entry_flds'. But it seems the intent of defining 'E3OFF' macro is to be used in 'dir3_sf_entry_flds', and 'E3OFF' macro has not been used at any place of the 'xfsprogs-dev' source:
/* command begin */
$ grep -r E3OFF /path/to/xfsprogs-dev/git/repository/ ./db/dir2sf.c:#define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f)) $ /* command end */
Above command shows the 'E3OFF' is only been defined but nerver been used, that is weird, so there has reason to suspect using 'EOFF' rather than 'E3OFF' in 'dir3_sf_entry_flds' is a typo, this patch fix it, there has no logical change in this commit at all.
--- db/dir2sf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
db/dir2sf.c +3 -3
@@ -246,9 +246,9 @@ const field_t dir3sf_flds[] = {#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, + {"namelen" ,FLDT_UINT8D ,OI (E3OFF (namelen)),C1 ,0 ,TYP_NONE }, + {"offset" ,FLDT_DIR2_SF_OFF ,OI (E3OFF (offset)),C1 ,0 ,TYP_NONE }, + {"name" ,FLDT_CHARNS ,OI (E3OFF (name)), dir2_sf_entry_name_count,FLD_COUNT ,TYP_NONE }, {"inumber" ,FLDT_DIR2_INOU , dir3_sf_entry_inumber_offset,C1 ,FLD_OFFSET ,TYP_NONE },
Signature · 1 line
2.27.0
Quoted 25 lines · Xiaole He
In 'xfsprogs-dev' source:
/*
db/dir2sf.cbegin */
#define EOFF(f)bitize(offsetof(xfs_dir2_sf_entry_t, f))const field_t dir2_sf_entry_flds[] = { { "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE }, ... #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 },...
/*db/dir2sf.cend */The macro definitions of 'EOFF' and 'E3OFF' are same, so no matter to use either to seek field offset in '
dir3_sf_entry_flds'. But it seems the intent of defining 'E3OFF' macro is to be used in 'dir3_sf_entry_flds', and 'E3OFF' macro has not been used at any place of the 'xfsprogs-dev' source:/* command begin */
$ grep -r E3OFF /path/to/xfsprogs-dev/git/repository/ ./db/dir2sf.c:#define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f)) $ /* command end */
Quoted 6 lines
Above command shows the 'E3OFF' is only been defined but nerver been used, that is weird, so there has reason to suspect using 'EOFF' rather than 'E3OFF' in '
dir3_sf_entry_flds' is a typo, this patch fix it, there has no logical change in this commit at all.Signed-off-by Xiaole He <[email protected]>
Makes sense to me, though it took me a minute to learn to ignore the other #define EOFFs :/
--D
Quoted 24 lines
--- db/dir2sf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)db/dir2sf.c +3
-3@@ -246,9 +246,9 @@ const field_t dir3sf_flds[] = {#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, + {"namelen" ,FLDT_UINT8D ,OI (E3OFF (namelen)),C1 ,0 ,TYP_NONE }, + {"offset" ,FLDT_DIR2_SF_OFF ,OI (E3OFF (offset)),C1 ,0 ,TYP_NONE }, + {"name" ,FLDT_CHARNS ,OI (E3OFF (name)), dir2_sf_entry_name_count,FLD_COUNT ,TYP_NONE }, {"inumber" ,FLDT_DIR2_INOU , dir3_sf_entry_inumber_offset,C1 ,FLD_OFFSET ,TYP_NONE },Signature · 1 line
2.27.0