Commit b56b7526 authored by Chuck Lever's avatar Chuck Lever

NFSD: Add nfsd4_encode_fattr4_files_total()

Refactor the encoder for FATTR4_FILES_TOTAL into a helper. In a
subsequent patch, this helper will be called from a bitmask loop.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 74361e2b
...@@ -3155,6 +3155,12 @@ static __be32 nfsd4_encode_fattr4_files_free(struct xdr_stream *xdr, ...@@ -3155,6 +3155,12 @@ static __be32 nfsd4_encode_fattr4_files_free(struct xdr_stream *xdr,
return nfsd4_encode_uint64_t(xdr, args->statfs.f_ffree); return nfsd4_encode_uint64_t(xdr, args->statfs.f_ffree);
} }
static __be32 nfsd4_encode_fattr4_files_total(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
return nfsd4_encode_uint64_t(xdr, args->statfs.f_files);
}
/* /*
* Note: @fhp can be NULL; in this case, we might have to compose the filehandle * Note: @fhp can be NULL; in this case, we might have to compose the filehandle
* ourselves. * ourselves.
...@@ -3394,10 +3400,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -3394,10 +3400,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
goto out; goto out;
} }
if (bmval0 & FATTR4_WORD0_FILES_TOTAL) { if (bmval0 & FATTR4_WORD0_FILES_TOTAL) {
p = xdr_reserve_space(xdr, 8); status = nfsd4_encode_fattr4_files_total(xdr, &args);
if (!p) if (status != nfs_ok)
goto out_resource; goto out;
p = xdr_encode_hyper(p, (u64) args.statfs.f_files);
} }
if (bmval0 & FATTR4_WORD0_FS_LOCATIONS) { if (bmval0 & FATTR4_WORD0_FS_LOCATIONS) {
status = nfsd4_encode_fs_locations(xdr, rqstp, exp); status = nfsd4_encode_fs_locations(xdr, rqstp, exp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment