From: Christoph Hellwig <hch@infradead.org>
To: Trond Myklebust <trondmy@gmail.com>
Cc: Kinglong Mee <kinglongmee@gmail.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode
Date: Wed, 20 Aug 2014 15:19:38 -0700 [thread overview]
Message-ID: <20140820221938.GA20442@infradead.org> (raw)
In-Reply-To: <CAABAsM65rWByuQYrWZ8jiieMzkitdRgVA5-zxxXTqE+ddvN8AA@mail.gmail.com>
On Wed, Aug 20, 2014 at 09:42:38AM -0400, Trond Myklebust wrote:
> 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"?
I think this was in reply to my complaints about the very magic length
reserved. I think arithmetic expressions in the form of 4 + 4 + 8 etc
are fine too, although the sizeof expressions seem to be even more
obvious and thus preferable to me. The main problem is something like:
p = xdr_reserve_space(xdr, 20);
hidden deep down in a routine which requires you to count over
all kinds of statements working with the XDR stream.
next prev parent reply other threads:[~2014-08-20 22:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 12:49 [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode Kinglong Mee
2014-08-20 13:42 ` Trond Myklebust
2014-08-20 22:19 ` Christoph Hellwig [this message]
2014-08-21 12:50 ` J. Bruce Fields
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=20140820221938.GA20442@infradead.org \
--to=hch@infradead.org \
--cc=bfields@fieldses.org \
--cc=kinglongmee@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@gmail.com \
/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).