Re: [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 20, 2014 at 8:49 AM, Kinglong Mee <kinglongmee@xxxxxxxxx> wrote:
> v2: update for 3.17.0-rc1
>
> Reported-by: Christoph Hellwig <hch@xxxxxx>
> Signed-off-by: Kinglong Mee <kinglongmee@xxxxxxxxx>
> ---
>  fs/nfsd/nfs4acl.c      |   2 +-
>  fs/nfsd/nfs4callback.c |  18 +-
>  fs/nfsd/nfs4idmap.c    |   4 +-
>  fs/nfsd/nfs4proc.c     |  12 +-
>  fs/nfsd/nfs4state.c    |  10 +-
>  fs/nfsd/nfs4xdr.c      | 501 +++++++++++++++++++++++++------------------------
>  6 files changed, 280 insertions(+), 267 deletions(-)
>
> diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
> index 59fd766..f15dbb2 100644
> --- a/fs/nfsd/nfs4acl.c
> +++ b/fs/nfsd/nfs4acl.c
> @@ -932,7 +932,7 @@ __be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who)
>         for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
>                 if (s2t_map[i].type != who)
>                         continue;
> -               p = xdr_reserve_space(xdr, s2t_map[i].stringlen + 4);
> +               p = xdr_reserve_space(xdr, sizeof(__be32) + s2t_map[i].stringlen);

OK, can someone please tell me how this is useful for documentation
purposes? Anybody who doesn't know that sizeof(__be32) == 4 has no
business working on XDR code.
I could understand this kind of patch if you were converting to
sizeof(<variable name>), as that documents exactly which variable you
are going to encode in this buffer and so is better than a naked
value, but how is sizeof(__be32) any more useful documentation than
"4"?

Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux