On Fri, 2009-08-14 at 12:32 -0400, Chuck Lever wrote: > On Aug 14, 2009, at 10:19 AM, Benny Halevy wrote: > > Coalesce multilpe constant RESERVE_SPACEs into one > > > > Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx> > > --- > > fs/nfs/nfs4xdr.c | 22 +++++----------------- > > 1 files changed, 5 insertions(+), 17 deletions(-) > > > > diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c > > index 17915c8..d460d81 100644 > > --- a/fs/nfs/nfs4xdr.c > > +++ b/fs/nfs/nfs4xdr.c > > @@ -1562,17 +1562,15 @@ static void encode_create_session(struct > > xdr_stream *xdr, > > uint32_t len; > > struct nfs_client *clp = args->client; > > > > - RESERVE_SPACE(4); > > - *p++ = cpu_to_be32(OP_CREATE_SESSION); > > + len = scnprintf(machine_name, sizeof(machine_name), "%s", > > + clp->cl_ipaddr); > > > > - RESERVE_SPACE(8); > > + RESERVE_SPACE(20 + 2*28 + 20 + len + 12); > > It would be nicer if we could use the foo_maxsz macros or "n * > sizeof(__be32)" here somehow instead of integers. No. sizeof(__be32) is a constant == 4. Spelling it out in every reserve_space would be bloat, not documentation. foo_maxsz is something completely different: it spells out the maximum possible buffer size. Please don't confuse that with the actual buffer content size. IOW: Please just leave the above as it is. -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@xxxxxxxxxx www.netapp.com -- 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