diff options
author | Neil Brown <neilb@cse.unsw.edu.au> | 2005-01-04 05:47:16 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-04 05:47:16 -0800 |
commit | cde2c5bca0af59042c898e934a88ff0677c428f5 (patch) | |
tree | fa7fa3261c52d21c56945c5aba5d90fa6791e043 /fs | |
parent | bdc337cc408a196f2ef092472ef3a056ca859f25 (diff) | |
download | history-cde2c5bca0af59042c898e934a88ff0677c428f5.tar.gz |
[PATCH] knfsd: nfsd4: encode_dirent: simplify control flow
Replace series of if's by a switch, remove (now unnecessary) label "out".
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index ce392ee2c6bb9c..196fb5dbafe8d1 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -1854,32 +1854,31 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen, * Now we come to the ugly part: writing the fattr for this entry. */ nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, p, &buflen); - if (!nfserr) { + switch (nfserr) { + case nfs_ok: p += buflen; - goto out; - } - if (nfserr == nfserr_resource) { + break; + case nfserr_resource: nfserr = nfserr_toosmall; goto fail; + default: + /* + * If we get here, we experienced a miscellaneous + * failure while writing the attributes. If the + * client requested the RDATTR_ERROR attribute, + * we stuff the error code into this attribute + * and continue. If this attribute was not requested, + * then in accordance with the spec, we fail the + * entire READDIR operation(!) + */ + if (!(cd->rd_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)) + goto fail; + nfserr = nfserr_toosmall; + p = nfsd4_encode_rdattr_error(p, buflen, nfserr); + if (p == NULL) + goto fail; } - /* - * If we get here, we experienced a miscellaneous - * failure while writing the attributes. If the - * client requested the RDATTR_ERROR attribute, - * we stuff the error code into this attribute - * and continue. If this attribute was not requested, - * then in accordance with the spec, we fail the - * entire READDIR operation(!) - */ - if (!(cd->rd_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)) - goto fail; - nfserr = nfserr_toosmall; - p = nfsd4_encode_rdattr_error(p, buflen, nfserr); - if (p == NULL) - goto fail; - -out: cd->buflen -= (p - cd->buffer); cd->buffer = p; cd->common.err = nfs_ok; |