Re: [PATCH v1 07/61] NFSD: Replace READ* macros in nfsd4_decode_close()

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

 



Thanks for having a look!


> On Nov 14, 2020, at 4:29 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> 
>> {
>> +	__be32 *p;
>> 
>> +	p = xdr_inline_decode(argp->xdr, NFS4_STATEID_SIZE);
>> +	if (!p)
>> +		goto xdr_error;
>> 	sid->si_generation = be32_to_cpup(p++);
>> +	memcpy(&sid->si_opaque, p, sizeof(sid->si_opaque));
>> +	return nfs_ok;
>> +xdr_error:
>> +	return nfserr_bad_xdr;
> 
> Using a goto for a trivial direct error return looks pretty strange
> and makes the code harder to follow.  This seems to happen quite a bit
> in this and the following patches.

Question of coding style. Some people prefer having a single
point of exit at the tail of a function.

I suppose I could simplify these smaller decoders, but it's
subjective. Anyone else have an opinion? Christoph, as an
example, how would you express this particular function?

--
Chuck Lever






[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