Skip to content

Commit 08b4436

Browse files
committed
NFSD: Clean up nfsd4_encode_test_stateid()
Use conventional XDR utilities. Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent abef972 commit 08b4436

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

fs/nfsd/nfs4xdr.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4932,20 +4932,18 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr,
49324932
union nfsd4_op_u *u)
49334933
{
49344934
struct nfsd4_test_stateid *test_stateid = &u->test_stateid;
4935-
struct xdr_stream *xdr = resp->xdr;
49364935
struct nfsd4_test_stateid_id *stateid, *next;
4937-
__be32 *p;
4936+
struct xdr_stream *xdr = resp->xdr;
49384937

4939-
p = xdr_reserve_space(xdr, 4 + (4 * test_stateid->ts_num_ids));
4940-
if (!p)
4938+
/* tsr_status_codes<> */
4939+
if (xdr_stream_encode_u32(xdr, test_stateid->ts_num_ids) != XDR_UNIT)
49414940
return nfserr_resource;
4942-
*p++ = htonl(test_stateid->ts_num_ids);
4943-
4944-
list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
4945-
*p++ = stateid->ts_id_status;
4941+
list_for_each_entry_safe(stateid, next,
4942+
&test_stateid->ts_stateid_list, ts_id_list) {
4943+
if (xdr_stream_encode_be32(xdr, stateid->ts_id_status) != XDR_UNIT)
4944+
return nfserr_resource;
49464945
}
4947-
4948-
return 0;
4946+
return nfs_ok;
49494947
}
49504948

49514949
#ifdef CONFIG_NFSD_PNFS

0 commit comments

Comments
 (0)