Release 4.11 fs/nfsd/nfsxdr.c
/*
* XDR support for nfsd
*
* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
*/
#include "vfs.h"
#include "xdr.h"
#include "auth.h"
#define NFSDDBG_FACILITY NFSDDBG_XDR
/*
* Mapping of S_IF* types to NFS file types
*/
static u32 nfs_ftypes[] = {
NFNON, NFCHR, NFCHR, NFBAD,
NFDIR, NFBAD, NFBLK, NFBAD,
NFREG, NFBAD, NFLNK, NFBAD,
NFSOCK, NFBAD, NFLNK, NFBAD,
};
/*
* XDR functions for basic NFS types
*/
static __be32 *
decode_fh(__be32 *p, struct svc_fh *fhp)
{
fh_init(fhp, NFS_FHSIZE);
memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE);
fhp->fh_handle.fh_size = NFS_FHSIZE;
/* FIXME: Look up export pointer here and verify
* Sun Secure RPC if requested */
return p + (NFS_FHSIZE >> 2);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 53 | 96.36% | 2 | 66.67% |
Al Viro | 2 | 3.64% | 1 | 33.33% |
Total | 55 | 100.00% | 3 | 100.00% |
/* Helper function for NFSv2 ACL code */
__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp)
{
return decode_fh(p, fhp);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andreas Gruenbacher | 21 | 91.30% | 1 | 50.00% |
Al Viro | 2 | 8.70% | 1 | 50.00% |
Total | 23 | 100.00% | 2 | 100.00% |
static __be32 *
encode_fh(__be32 *p, struct svc_fh *fhp)
{
memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE);
return p + (NFS_FHSIZE>> 2);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 37 | 94.87% | 2 | 66.67% |
Al Viro | 2 | 5.13% | 1 | 33.33% |
Total | 39 | 100.00% | 3 | 100.00% |
/*
* Decode a file name and make sure that the path contains
* no slashes or null bytes.
*/
static __be32 *
decode_filename(__be32 *p, char **namp, unsigned int *lenp)
{
char *name;
unsigned int i;
if ((p = xdr_decode_string_inplace(p, namp, lenp, NFS_MAXNAMLEN)) != NULL) {
for (i = 0, name = *namp; i < *lenp; i++, name++) {
if (*name == '\0' || *name == '/')
return NULL;
}
}
return p;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 87 | 94.57% | 1 | 25.00% |
Al Viro | 2 | 2.17% | 1 | 25.00% |
Chuck Lever | 2 | 2.17% | 1 | 25.00% |
Linus Torvalds | 1 | 1.09% | 1 | 25.00% |
Total | 92 | 100.00% | 4 | 100.00% |
static __be32 *
decode_pathname(__be32 *p, char **namp, unsigned int *lenp)
{
char *name;
unsigned int i;
if ((p = xdr_decode_string_inplace(p, namp, lenp, NFS_MAXPATHLEN)) != NULL) {
for (i = 0, name = *namp; i < *lenp; i++, name++) {
if (*name == '\0')
return NULL;
}
}
return p;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 82 | 94.25% | 1 | 25.00% |
Al Viro | 2 | 2.30% | 1 | 25.00% |
Chuck Lever | 2 | 2.30% | 1 | 25.00% |
Neil Brown | 1 | 1.15% | 1 | 25.00% |
Total | 87 | 100.00% | 4 | 100.00% |
static __be32 *
decode_sattr(__be32 *p, struct iattr *iap)
{
u32 tmp, tmp1;
iap->ia_valid = 0;
/* Sun client bug compatibility check: some sun clients seem to
* put 0xffff in the mode field when they mean 0xffffffff.
* Quoting the 4.4BSD nfs server code: Nah nah nah nah na nah.
*/
if ((tmp = ntohl(*p++)) != (u32)-1 && tmp != 0xffff) {
iap->ia_valid |= ATTR_MODE;
iap->ia_mode = tmp;
}
if ((tmp = ntohl(*p++)) != (u32)-1) {
iap->ia_uid = make_kuid(&init_user_ns, tmp);
if (uid_valid(iap->ia_uid))
iap->ia_valid |= ATTR_UID;
}
if ((tmp = ntohl(*p++)) != (u32)-1) {
iap->ia_gid = make_kgid(&init_user_ns, tmp);
if (gid_valid(iap->ia_gid))
iap->ia_valid |= ATTR_GID;
}
if ((tmp = ntohl(*p++)) != (u32)-1) {
iap->ia_valid |= ATTR_SIZE;
iap->ia_size = tmp;
}
tmp = ntohl(*p++); tmp1 = ntohl(*p++);
if (tmp != (u32)-1 && tmp1 != (u32)-1) {
iap->ia_valid |= ATTR_ATIME | ATTR_ATIME_SET;
iap->ia_atime.tv_sec = tmp;
iap->ia_atime.tv_nsec = tmp1 * 1000;
}
tmp = ntohl(*p++); tmp1 = ntohl(*p++);
if (tmp != (u32)-1 && tmp1 != (u32)-1) {
iap->ia_valid |= ATTR_MTIME | ATTR_MTIME_SET;
iap->ia_mtime.tv_sec = tmp;
iap->ia_mtime.tv_nsec = tmp1 * 1000;
/*
* Passing the invalid value useconds=1000000 for mtime
* is a Sun convention for "set both mtime and atime to
* current server time". It's needed to make permissions
* checks for the "touch" program across v2 mounts to
* Solaris and Irix boxes work correctly. See description of
* sattr in section 6.1 of "NFS Illustrated" by
* Brent Callaghan, Addison-Wesley, ISBN 0-201-32750-5
*/
if (tmp1 == 1000000)
iap->ia_valid &= ~(ATTR_ATIME_SET|ATTR_MTIME_SET);
}
return p;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 259 | 75.51% | 1 | 16.67% |
Eric W. Biedermann | 40 | 11.66% | 1 | 16.67% |
Andi Kleen | 20 | 5.83% | 1 | 16.67% |
Andrew Morton | 18 | 5.25% | 1 | 16.67% |
Jamie Lokier | 4 | 1.17% | 1 | 16.67% |
Al Viro | 2 | 0.58% | 1 | 16.67% |
Total | 343 | 100.00% | 6 | 100.00% |
static __be32 *
encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
struct kstat *stat)
{
struct dentry *dentry = fhp->fh_dentry;
int type;
struct timespec time;
u32 f;
type = (stat->mode & S_IFMT);
*p++ = htonl(nfs_ftypes[type >> 12]);
*p++ = htonl((u32) stat->mode);
*p++ = htonl((u32) stat->nlink);
*p++ = htonl((u32) from_kuid(&init_user_ns, stat->uid));
*p++ = htonl((u32) from_kgid(&init_user_ns, stat->gid));
if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
*p++ = htonl(NFS_MAXPATHLEN);
} else {
*p++ = htonl((u32) stat->size);
}
*p++ = htonl((u32) stat->blksize);
if (S_ISCHR(type) || S_ISBLK(type))
*p++ = htonl(new_encode_dev(stat->rdev));
else
*p++ = htonl(0xffffffff);
*p++ = htonl((u32) stat->blocks);
switch (fsid_source(fhp)) {
default:
case FSIDSOURCE_DEV:
*p++ = htonl(new_encode_dev(stat->dev));
break;
case FSIDSOURCE_FSID:
*p++ = htonl((u32) fhp->fh_export->ex_fsid);
break;
case FSIDSOURCE_UUID:
f = ((u32*)fhp->fh_export->ex_uuid)[0];
f ^= ((u32*)fhp->fh_export->ex_uuid)[1];
f ^= ((u32*)fhp->fh_export->ex_uuid)[2];
f ^= ((u32*)fhp->fh_export->ex_uuid)[3];
*p++ = htonl(f);
break;
}
*p++ = htonl((u32) stat->ino);
*p++ = htonl((u32) stat->atime.tv_sec);
*p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0);
lease_get_mtime(d_inode(dentry), &time);
*p++ = htonl((u32) time.tv_sec);
*p++ = htonl(time.tv_nsec ? time.tv_nsec / 1000 : 0);
*p++ = htonl((u32) stat->ctime.tv_sec);
*p++ = htonl(stat->ctime.tv_nsec ? stat->ctime.tv_nsec / 1000 : 0);
return p;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 202 | 39.61% | 1 | 6.67% |
Neil Brown | 125 | 24.51% | 2 | 13.33% |
Al Viro | 48 | 9.41% | 4 | 26.67% |
Andi Kleen | 36 | 7.06% | 1 | 6.67% |
Linus Torvalds | 31 | 6.08% | 2 | 13.33% |
Jamie Lokier | 29 | 5.69% | 1 | 6.67% |
David Shaw | 22 | 4.31% | 1 | 6.67% |
Eric W. Biedermann | 12 | 2.35% | 1 | 6.67% |
David Howells | 3 | 0.59% | 1 | 6.67% |
J. Bruce Fields | 2 | 0.39% | 1 | 6.67% |
Total | 510 | 100.00% | 15 | 100.00% |
/* Helper function for NFSv2 ACL code */
__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat)
{
return encode_fattr(rqstp, p, fhp, stat);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andreas Gruenbacher | 26 | 70.27% | 1 | 25.00% |
David Shaw | 5 | 13.51% | 1 | 25.00% |
J. Bruce Fields | 4 | 10.81% | 1 | 25.00% |
Al Viro | 2 | 5.41% | 1 | 25.00% |
Total | 37 | 100.00% | 4 | 100.00% |
/*
* XDR decode functions
*/
int
nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
{
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 25 | 96.15% | 1 | 50.00% |
Al Viro | 1 | 3.85% | 1 | 50.00% |
Total | 26 | 100.00% | 2 | 100.00% |
int
nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 35 | 74.47% | 1 | 25.00% |
Neil Brown | 6 | 12.77% | 1 | 25.00% |
Benoit Taine | 5 | 10.64% | 1 | 25.00% |
Al Viro | 1 | 2.13% | 1 | 25.00% |
Total | 47 | 100.00% | 4 | 100.00% |
int
nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_sattrargs *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
p = decode_sattr(p, &args->attrs);
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 49 | 83.05% | 1 | 33.33% |
Neil Brown | 9 | 15.25% | 1 | 33.33% |
Al Viro | 1 | 1.69% | 1 | 33.33% |
Total | 59 | 100.00% | 3 | 100.00% |
int
nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_diropargs *args)
{
if (!(p = decode_fh(p, &args->fh))
|| !(p = decode_filename(p, &args->name, &args->len)))
return 0;
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 66 | 98.51% | 1 | 50.00% |
Al Viro | 1 | 1.49% | 1 | 50.00% |
Total | 67 | 100.00% | 2 | 100.00% |
int
nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_readargs *args)
{
unsigned int len;
int v;
p = decode_fh(p, &args->fh);
if (!p)
return 0;
args->offset = ntohl(*p++);
len = args->count = ntohl(*p++);
p++; /* totalcount - unused */
len = min_t(unsigned int, len, NFSSVC_MAXBLKSIZE_V2);
/* set up somewhere to store response.
* We take pages, put them on reslist and include in iovec
*/
v=0;
while (len > 0) {
struct page *p = *(rqstp->rq_next_page++);
rqstp->rq_vec[v].iov_base = page_address(p);
rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE);
len -= rqstp->rq_vec[v].iov_len;
v++;
}
args->vlen = v;
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 70 | 40.94% | 5 | 50.00% |
Linus Torvalds (pre-git) | 68 | 39.77% | 1 | 10.00% |
Kinglong Mee | 16 | 9.36% | 1 | 10.00% |
J. Bruce Fields | 11 | 6.43% | 1 | 10.00% |
Benoit Taine | 5 | 2.92% | 1 | 10.00% |
Al Viro | 1 | 0.58% | 1 | 10.00% |
Total | 171 | 100.00% | 10 | 100.00% |
int
nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_writeargs *args)
{
unsigned int len, hdr, dlen;
struct kvec *head = rqstp->rq_arg.head;
int v;
p = decode_fh(p, &args->fh);
if (!p)
return 0;
p++; /* beginoffset */
args->offset = ntohl(*p++); /* offset */
p++; /* totalcount */
len = args->len = ntohl(*p++);
/*
* The protocol specifies a maximum of 8192 bytes.
*/
if (len > NFSSVC_MAXBLKSIZE_V2)
return 0;
/*
* Check to make sure that we got the right number of
* bytes.
*/
hdr = (void*)p - head->iov_base;
if (hdr > head->iov_len)
return 0;
dlen = head->iov_len + rqstp->rq_arg.page_len - hdr;
/*
* Round the length of the data which was specified up to
* the next multiple of XDR units and then compare that
* against the length which was actually received.
* Note that when RPCSEC/GSS (for example) is used, the
* data buffer can be padded so dlen might be larger
* than required. It must never be smaller.
*/
if (dlen < XDR_QUADLEN(len)*4)
return 0;
rqstp->rq_vec[0].iov_base = (void*)p;
rqstp->rq_vec[0].iov_len = head->iov_len - hdr;
v = 0;
while (len > rqstp->rq_vec[v].iov_len) {
len -= rqstp->rq_vec[v].iov_len;
v++;
rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_pages[v]);
rqstp->rq_vec[v].iov_len = PAGE_SIZE;
}
rqstp->rq_vec[v].iov_len = len;
args->vlen = v + 1;
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 109 | 40.07% | 6 | 50.00% |
Linus Torvalds (pre-git) | 73 | 26.84% | 1 | 8.33% |
Peter Staubach | 59 | 21.69% | 1 | 8.33% |
J. Bruce Fields | 25 | 9.19% | 2 | 16.67% |
Benoit Taine | 5 | 1.84% | 1 | 8.33% |
Al Viro | 1 | 0.37% | 1 | 8.33% |
Total | 272 | 100.00% | 12 | 100.00% |
int
nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_createargs *args)
{
if ( !(p = decode_fh(p, &args->fh))
|| !(p = decode_filename(p, &args->name, &args->len)))
return 0;
p = decode_sattr(p, &args->attrs);
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 73 | 92.41% | 1 | 33.33% |
Neil Brown | 5 | 6.33% | 1 | 33.33% |
Al Viro | 1 | 1.27% | 1 | 33.33% |
Total | 79 | 100.00% | 3 | 100.00% |
int
nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_renameargs *args)
{
if (!(p = decode_fh(p, &args->ffh))
|| !(p = decode_filename(p, &args->fname, &args->flen))
|| !(p = decode_fh(p, &args->tfh))
|| !(p = decode_filename(p, &args->tname, &args->tlen)))
return 0;
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 101 | 99.02% | 1 | 50.00% |
Al Viro | 1 | 0.98% | 1 | 50.00% |
Total | 102 | 100.00% | 2 | 100.00% |
int
nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
args->buffer = page_address(*(rqstp->rq_next_page++));
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 51 | 82.26% | 2 | 33.33% |
Benoit Taine | 5 | 8.06% | 1 | 16.67% |
J. Bruce Fields | 4 | 6.45% | 1 | 16.67% |
Al Viro | 1 | 1.61% | 1 | 16.67% |
Linus Torvalds (pre-git) | 1 | 1.61% | 1 | 16.67% |
Total | 62 | 100.00% | 6 | 100.00% |
int
nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_linkargs *args)
{
if (!(p = decode_fh(p, &args->ffh))
|| !(p = decode_fh(p, &args->tfh))
|| !(p = decode_filename(p, &args->tname, &args->tlen)))
return 0;
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 80 | 97.56% | 1 | 33.33% |
Al Viro | 1 | 1.22% | 1 | 33.33% |
Neil Brown | 1 | 1.22% | 1 | 33.33% |
Total | 82 | 100.00% | 3 | 100.00% |
int
nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_symlinkargs *args)
{
if ( !(p = decode_fh(p, &args->ffh))
|| !(p = decode_filename(p, &args->fname, &args->flen))
|| !(p = decode_pathname(p, &args->tname, &args->tlen)))
return 0;
p = decode_sattr(p, &args->attrs);
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 93 | 93.94% | 1 | 33.33% |
Neil Brown | 5 | 5.05% | 1 | 33.33% |
Al Viro | 1 | 1.01% | 1 | 33.33% |
Total | 99 | 100.00% | 3 | 100.00% |
int
nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_readdirargs *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
args->cookie = ntohl(*p++);
args->count = ntohl(*p++);
args->count = min_t(u32, args->count, PAGE_SIZE);
args->buffer = page_address(*(rqstp->rq_next_page++));
return xdr_argsize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 63 | 63.64% | 1 | 14.29% |
Neil Brown | 19 | 19.19% | 2 | 28.57% |
Kinglong Mee | 7 | 7.07% | 1 | 14.29% |
Benoit Taine | 5 | 5.05% | 1 | 14.29% |
J. Bruce Fields | 4 | 4.04% | 1 | 14.29% |
Al Viro | 1 | 1.01% | 1 | 14.29% |
Total | 99 | 100.00% | 7 | 100.00% |
/*
* XDR encode functions
*/
int
nfssvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
{
return xdr_ressize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 25 | 96.15% | 1 | 50.00% |
Al Viro | 1 | 3.85% | 1 | 50.00% |
Total | 26 | 100.00% | 2 | 100.00% |
int
nfssvc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_attrstat *resp)
{
p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
return xdr_ressize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 38 | 82.61% | 1 | 20.00% |
David Shaw | 5 | 10.87% | 1 | 20.00% |
Linus Torvalds | 1 | 2.17% | 1 | 20.00% |
Al Viro | 1 | 2.17% | 1 | 20.00% |
Neil Brown | 1 | 2.17% | 1 | 20.00% |
Total | 46 | 100.00% | 5 | 100.00% |
int
nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_diropres *resp)
{
p = encode_fh(p, &resp->fh);
p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
return xdr_ressize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 49 | 84.48% | 1 | 20.00% |
David Shaw | 5 | 8.62% | 1 | 20.00% |
Linus Torvalds | 2 | 3.45% | 1 | 20.00% |
Al Viro | 1 | 1.72% | 1 | 20.00% |
Neil Brown | 1 | 1.72% | 1 | 20.00% |
Total | 58 | 100.00% | 5 | 100.00% |
int
nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_readlinkres *resp)
{
*p++ = htonl(resp->len);
xdr_ressize_check(rqstp, p);
rqstp->rq_res.page_len = resp->len;
if (resp->len & 3) {
/* need to pad the tail */
rqstp->rq_res.tail[0].iov_base = p;
*p = 0;
rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
}
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 62 | 62.00% | 1 | 33.33% |
Linus Torvalds (pre-git) | 37 | 37.00% | 1 | 33.33% |
Al Viro | 1 | 1.00% | 1 | 33.33% |
Total | 100 | 100.00% | 3 | 100.00% |
int
nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_readres *resp)
{
p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
*p++ = htonl(resp->count);
xdr_ressize_check(rqstp, p);
/* now update rqstp->rq_res to reflect data as well */
rqstp->rq_res.page_len = resp->count;
if (resp->count & 3) {
/* need to pad the tail */
rqstp->rq_res.tail[0].iov_base = p;
*p = 0;
rqstp->rq_res.tail[0].iov_len = 4 - (resp->count&3);
}
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 63 | 52.50% | 3 | 37.50% |
Linus Torvalds (pre-git) | 49 | 40.83% | 1 | 12.50% |
David Shaw | 5 | 4.17% | 1 | 12.50% |
Lucas De Marchi | 1 | 0.83% | 1 | 12.50% |
Linus Torvalds | 1 | 0.83% | 1 | 12.50% |
Al Viro | 1 | 0.83% | 1 | 12.50% |
Total | 120 | 100.00% | 8 | 100.00% |
int
nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_readdirres *resp)
{
xdr_ressize_check(rqstp, p);
p = resp->buffer;
*p++ = 0; /* no more entries */
*p++ = htonl((resp->common.err == nfserr_eof));
rqstp->rq_res.page_len = (((unsigned long)p-1) & ~PAGE_MASK)+1;
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 54 | 65.85% | 3 | 60.00% |
Linus Torvalds (pre-git) | 27 | 32.93% | 1 | 20.00% |
Al Viro | 1 | 1.22% | 1 | 20.00% |
Total | 82 | 100.00% | 5 | 100.00% |
int
nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_statfsres *resp)
{
struct kstatfs *stat = &resp->stats;
*p++ = htonl(NFSSVC_MAXBLKSIZE_V2); /* max transfer size */
*p++ = htonl(stat->f_bsize);
*p++ = htonl(stat->f_blocks);
*p++ = htonl(stat->f_bfree);
*p++ = htonl(stat->f_bavail);
return xdr_ressize_check(rqstp, p);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 88 | 96.70% | 1 | 25.00% |
Al Viro | 1 | 1.10% | 1 | 25.00% |
Greg Banks | 1 | 1.10% | 1 | 25.00% |
Andrew Morton | 1 | 1.10% | 1 | 25.00% |
Total | 91 | 100.00% | 4 | 100.00% |
int
nfssvc_encode_entry(void *ccdv, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
{
struct readdir_cd *ccd = ccdv;
struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common);
__be32 *p = cd->buffer;
int buflen, slen;
/*
dprintk("nfsd: entry(%.*s off %ld ino %ld)\n",
namlen, name, offset, ino);
*/
if (offset > ~((u32) 0)) {
cd->common.err = nfserr_fbig;
return -EINVAL;
}
if (cd->offset)
*cd->offset = htonl(offset);
/* truncate filename */
namlen = min(namlen, NFS2_MAXNAMLEN);
slen = XDR_QUADLEN(namlen);
if ((buflen = cd->buflen - slen - 4) < 0) {
cd->common.err = nfserr_toosmall;
return -EINVAL;
}
if (ino > ~((u32) 0)) {
cd->common.err = nfserr_fbig;
return -EINVAL;
}
*p++ = xdr_one; /* mark entry present */
*p++ = htonl((u32) ino); /* file id */
p = xdr_encode_array(p, name, namlen);/* name length & name */
cd->offset = p; /* remember pointer */
*p++ = htonl(~0U); /* offset of next entry */
cd->buflen = buflen;
cd->buffer = p;
cd->common.err = nfs_ok;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 166 | 66.14% | 3 | 30.00% |
Neil Brown | 46 | 18.33% | 2 | 20.00% |
Peter Staubach | 26 | 10.36% | 1 | 10.00% |
Kinglong Mee | 6 | 2.39% | 1 | 10.00% |
Al Viro | 5 | 1.99% | 1 | 10.00% |
Andrew Morton | 1 | 0.40% | 1 | 10.00% |
Linus Torvalds | 1 | 0.40% | 1 | 10.00% |
Total | 251 | 100.00% | 10 | 100.00% |
/*
* XDR release functions
*/
int
nfssvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_fhandle *resp)
{
fh_put(&resp->fh);
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 29 | 96.67% | 1 | 50.00% |
Al Viro | 1 | 3.33% | 1 | 50.00% |
Total | 30 | 100.00% | 2 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 2005 | 62.34% | 4 | 7.27% |
Neil Brown | 630 | 19.59% | 16 | 29.09% |
Al Viro | 90 | 2.80% | 5 | 9.09% |
Peter Staubach | 85 | 2.64% | 2 | 3.64% |
Andi Kleen | 56 | 1.74% | 1 | 1.82% |
J. Bruce Fields | 52 | 1.62% | 7 | 12.73% |
Eric W. Biedermann | 52 | 1.62% | 1 | 1.82% |
Andreas Gruenbacher | 49 | 1.52% | 1 | 1.82% |
David Shaw | 42 | 1.31% | 1 | 1.82% |
Linus Torvalds | 38 | 1.18% | 5 | 9.09% |
Jamie Lokier | 33 | 1.03% | 1 | 1.82% |
Kinglong Mee | 29 | 0.90% | 1 | 1.82% |
Benoit Taine | 25 | 0.78% | 1 | 1.82% |
Andrew Morton | 20 | 0.62% | 3 | 5.45% |
Chuck Lever | 4 | 0.12% | 2 | 3.64% |
David Howells | 3 | 0.09% | 1 | 1.82% |
Greg Banks | 1 | 0.03% | 1 | 1.82% |
Boaz Harrosh | 1 | 0.03% | 1 | 1.82% |
Lucas De Marchi | 1 | 0.03% | 1 | 1.82% |
Total | 3216 | 100.00% | 55 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.