linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Xiaole He <hexiaole1994@126.com>
Cc: linux-xfs@vger.kernel.org, Xiaole He <hexiaole@kylinos.cn>
Subject: Re: [PATCH v1] xfs_db: use preferable macro to seek offset for local dir3 entry fields
Date: Mon, 29 Aug 2022 07:39:35 -0700	[thread overview]
Message-ID: <YwzPpxI4Uta0KreZ@magnolia> (raw)
In-Reply-To: <20220829095025.10287-1-hexiaole1994@126.com>

On Mon, Aug 29, 2022 at 05:50:25PM +0800, Xiaole He wrote:
> 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.
> 
> Signed-off-by: Xiaole He <hexiaole@kylinos.cn>

Makes sense to me, though it took me a minute to learn to ignore the
other #define EOFFs :/

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  db/dir2sf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/db/dir2sf.c b/db/dir2sf.c
> index 8165b79b..9f1880dc 100644
> --- a/db/dir2sf.c
> +++ b/db/dir2sf.c
> @@ -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 },
> -- 
> 2.27.0
> 

      reply	other threads:[~2022-08-29 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29  9:50 [PATCH v1] xfs_db: use preferable macro to seek offset for local dir3 entry fields Xiaole He
2022-08-29 14:39 ` Darrick J. Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YwzPpxI4Uta0KreZ@magnolia \
    --to=djwong@kernel.org \
    --cc=hexiaole1994@126.com \
    --cc=hexiaole@kylinos.cn \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).