&resp->common, nfssvc_encode_entry);
resp->count = resp->buffer - buffer;
- if (resp->offset)
- *resp->offset = htonl(offset);
+ nfssvc_encode_nfscookie(resp, offset);
fh_put(&argp->fh);
return rpc_success;
return 1;
}
+/**
+ * nfssvc_encode_nfscookie - Encode a directory offset cookie
+ * @resp: readdir result context
+ * @offset: offset cookie to encode
+ *
+ */
+void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset)
+{
+ if (!resp->offset)
+ return;
+
+ *resp->offset = cpu_to_be32(offset);
+ resp->offset = NULL;
+}
+
int
nfssvc_encode_entry(void *ccdv, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
cd->common.err = nfserr_fbig;
return -EINVAL;
}
- if (cd->offset)
- *cd->offset = htonl(offset);
+ nfssvc_encode_nfscookie(cd, offset);
/* truncate filename */
namlen = min(namlen, NFS2_MAXNAMLEN);
int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *);
int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *);
+void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset);
int nfssvc_encode_entry(void *, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int);