Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsserver/nfs_nfsdserv.c
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | static void nfsrvd_mkdirsub(struct nfsrv_descript *nd, struct nameidata *ndp, | ||||
struct nfsvattr *nvap, fhandle_t *fhp, vnode_t *vpp, | struct nfsvattr *nvap, fhandle_t *fhp, vnode_t *vpp, | ||||
vnode_t dirp, struct nfsvattr *dirforp, struct nfsvattr *diraftp, | vnode_t dirp, struct nfsvattr *dirforp, struct nfsvattr *diraftp, | ||||
int *diraft_retp, nfsattrbit_t *attrbitp, NFSACL_T *aclp, | int *diraft_retp, nfsattrbit_t *attrbitp, NFSACL_T *aclp, | ||||
NFSPROC_T *p, struct nfsexstuff *exp); | NFSPROC_T *p, struct nfsexstuff *exp); | ||||
/* | /* | ||||
* nfs access service (not a part of NFS V2) | * nfs access service (not a part of NFS V2) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_access(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_access(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int getret, error = 0; | int getret, error = 0; | ||||
struct nfsvattr nva; | struct nfsvattr nva; | ||||
u_int32_t testmode, nfsmode, supported = 0; | u_int32_t testmode, nfsmode, supported = 0; | ||||
accmode_t deletebit; | accmode_t deletebit; | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs getattr service | * nfs getattr service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_getattr(struct nfsrv_descript *nd, int isdgram, | nfsrvd_getattr(struct nfsrv_descript *nd, int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr nva; | struct nfsvattr nva; | ||||
fhandle_t fh; | fhandle_t fh; | ||||
int at_root = 0, error = 0, supports_nfsv4acls; | int at_root = 0, error = 0, supports_nfsv4acls; | ||||
struct nfsreferral *refp; | struct nfsreferral *refp; | ||||
nfsattrbit_t attrbits, tmpbits; | nfsattrbit_t attrbits, tmpbits; | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs setattr service | * nfs setattr service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr nva, nva2; | struct nfsvattr nva, nva2; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int preat_ret = 1, postat_ret = 1, gcheck = 0, error = 0; | int preat_ret = 1, postat_ret = 1, gcheck = 0, error = 0; | ||||
int gotproxystateid; | int gotproxystateid; | ||||
struct timespec guard = { 0, 0 }; | struct timespec guard = { 0, 0 }; | ||||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | #endif | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs lookup rpc | * nfs lookup rpc | ||||
* (Also performs lookup parent for v4) | * (Also performs lookup parent for v4) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_lookup(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_lookup(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nameidata named; | struct nameidata named; | ||||
vnode_t vp, dirp = NULL; | vnode_t vp, dirp = NULL; | ||||
int error = 0, dattr_ret = 1; | int error = 0, dattr_ret = 1; | ||||
struct nfsvattr nva, dattr; | struct nfsvattr nva, dattr; | ||||
char *bufp; | char *bufp; | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs readlink service | * nfs readlink service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_readlink(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_readlink(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct mbuf *mp = NULL, *mpend = NULL; | struct mbuf *mp = NULL, *mpend = NULL; | ||||
int getret = 1, len; | int getret = 1, len; | ||||
struct nfsvattr nva; | struct nfsvattr nva; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 27 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfs read service | * nfs read service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_read(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_read(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, cnt, getret = 1, gotproxystateid, reqlen, eof = 0; | int error = 0, cnt, getret = 1, gotproxystateid, reqlen, eof = 0; | ||||
struct mbuf *m2, *m3; | struct mbuf *m2, *m3; | ||||
struct nfsvattr nva; | struct nfsvattr nva; | ||||
off_t off = 0x0; | off_t off = 0x0; | ||||
▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs write service | * nfs write service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_write(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_write(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsvattr nva, forat; | struct nfsvattr nva, forat; | ||||
int aftat_ret = 1, retlen, len, error = 0, forat_ret = 1; | int aftat_ret = 1, retlen, len, error = 0, forat_ret = 1; | ||||
int gotproxystateid, stable = NFSWRITE_FILESYNC; | int gotproxystateid, stable = NFSWRITE_FILESYNC; | ||||
off_t off; | off_t off; | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* | /* | ||||
* nfs create service (creates regular files for V2 and V3. Spec. files for V2.) | * nfs create service (creates regular files for V2 and V3. Spec. files for V2.) | ||||
* now does a truncate to 0 length via. setattr if it already exists | * now does a truncate to 0 length via. setattr if it already exists | ||||
* The core creation routine has been extracted out into nfsrv_creatsub(), | * The core creation routine has been extracted out into nfsrv_creatsub(), | ||||
* so it can also be used by nfsrv_open() for V4. | * so it can also be used by nfsrv_open() for V4. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_create(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_create(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, struct nfsexstuff *exp) | vnode_t dp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr nva, dirfor, diraft; | struct nfsvattr nva, dirfor, diraft; | ||||
struct nfsv2_sattr *sp; | struct nfsv2_sattr *sp; | ||||
struct nameidata named; | struct nameidata named; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, tsize, dirfor_ret = 1, diraft_ret = 1; | int error = 0, tsize, dirfor_ret = 1, diraft_ret = 1; | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | nfsmout: | ||||
nfsvno_relpathbuf(&named); | nfsvno_relpathbuf(&named); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs v3 mknod service (and v4 create) | * nfs v3 mknod service (and v4 create) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr nva, dirfor, diraft; | struct nfsvattr nva, dirfor, diraft; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nameidata named; | struct nameidata named; | ||||
int error = 0, dirfor_ret = 1, diraft_ret = 1, pathlen; | int error = 0, dirfor_ret = 1, diraft_ret = 1, pathlen; | ||||
u_int32_t major, minor; | u_int32_t major, minor; | ||||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | #endif | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs remove service | * nfs remove service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_remove(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_remove(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, struct nfsexstuff *exp) | vnode_t dp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nameidata named; | struct nameidata named; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, dirfor_ret = 1, diraft_ret = 1; | int error = 0, dirfor_ret = 1, diraft_ret = 1; | ||||
vnode_t dirp = NULL; | vnode_t dirp = NULL; | ||||
struct nfsvattr dirfor, diraft; | struct nfsvattr dirfor, diraft; | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs rename service | * nfs rename service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_rename(struct nfsrv_descript *nd, int isdgram, | nfsrvd_rename(struct nfsrv_descript *nd, int isdgram, | ||||
vnode_t dp, vnode_t todp, struct nfsexstuff *exp, struct nfsexstuff *toexp) | vnode_t dp, vnode_t todp, struct nfsexstuff *exp, struct nfsexstuff *toexp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, fdirfor_ret = 1, fdiraft_ret = 1; | int error = 0, fdirfor_ret = 1, fdiraft_ret = 1; | ||||
int tdirfor_ret = 1, tdiraft_ret = 1; | int tdirfor_ret = 1, tdiraft_ret = 1; | ||||
struct nameidata fromnd, tond; | struct nameidata fromnd, tond; | ||||
vnode_t fdirp = NULL, tdirp = NULL, tdp = NULL; | vnode_t fdirp = NULL, tdirp = NULL, tdp = NULL; | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs link service | * nfs link service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_link(struct nfsrv_descript *nd, int isdgram, | nfsrvd_link(struct nfsrv_descript *nd, int isdgram, | ||||
vnode_t vp, vnode_t tovp, struct nfsexstuff *exp, struct nfsexstuff *toexp) | vnode_t vp, vnode_t tovp, struct nfsexstuff *exp, struct nfsexstuff *toexp) | ||||
{ | { | ||||
struct nameidata named; | struct nameidata named; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, dirfor_ret = 1, diraft_ret = 1, getret = 1; | int error = 0, dirfor_ret = 1, diraft_ret = 1, getret = 1; | ||||
vnode_t dirp = NULL, dp = NULL; | vnode_t dirp = NULL, dp = NULL; | ||||
struct nfsvattr dirfor, diraft, at; | struct nfsvattr dirfor, diraft, at; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs symbolic link service | * nfs symbolic link service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_symlink(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_symlink(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr nva, dirfor, diraft; | struct nfsvattr nva, dirfor, diraft; | ||||
struct nameidata named; | struct nameidata named; | ||||
int error = 0, dirfor_ret = 1, diraft_ret = 1, pathlen; | int error = 0, dirfor_ret = 1, diraft_ret = 1, pathlen; | ||||
vnode_t dirp = NULL; | vnode_t dirp = NULL; | ||||
char *bufp, *pathcp = NULL; | char *bufp, *pathcp = NULL; | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | nfsrvd_symlinksub(struct nfsrv_descript *nd, struct nameidata *ndp, | ||||
} | } | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
} | } | ||||
/* | /* | ||||
* nfs mkdir service | * nfs mkdir service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_mkdir(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_mkdir(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | vnode_t dp, vnode_t *vpp, fhandle_t *fhp, struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr nva, dirfor, diraft; | struct nfsvattr nva, dirfor, diraft; | ||||
struct nameidata named; | struct nameidata named; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, dirfor_ret = 1, diraft_ret = 1; | int error = 0, dirfor_ret = 1, diraft_ret = 1; | ||||
vnode_t dirp = NULL; | vnode_t dirp = NULL; | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | nfsrvd_mkdirsub(struct nfsrv_descript *nd, struct nameidata *ndp, | ||||
} | } | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
} | } | ||||
/* | /* | ||||
* nfs commit service | * nfs commit service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_commit(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_commit(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsvattr bfor, aft; | struct nfsvattr bfor, aft; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, for_ret = 1, aft_ret = 1, cnt; | int error = 0, for_ret = 1, aft_ret = 1, cnt; | ||||
u_int64_t off; | u_int64_t off; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs statfs service | * nfs statfs service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_statfs(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_statfs(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
struct statfs *sf; | struct statfs *sf; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int getret = 1; | int getret = 1; | ||||
struct nfsvattr at; | struct nfsvattr at; | ||||
u_quad_t tval; | u_quad_t tval; | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | out: | ||||
free(sf, M_STATFS); | free(sf, M_STATFS); | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfs fsinfo service | * nfs fsinfo service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_fsinfo(struct nfsrv_descript *nd, int isdgram, | nfsrvd_fsinfo(struct nfsrv_descript *nd, int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsfsinfo fs; | struct nfsfsinfo fs; | ||||
int getret = 1; | int getret = 1; | ||||
struct nfsvattr at; | struct nfsvattr at; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 23 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfs pathconf service | * nfs pathconf service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_pathconf(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_pathconf(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
struct nfsv3_pathconf *pc; | struct nfsv3_pathconf *pc; | ||||
int getret = 1; | int getret = 1; | ||||
long linkmax, namemax, chownres, notrunc; | long linkmax, namemax, chownres, notrunc; | ||||
struct nfsvattr at; | struct nfsvattr at; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 35 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 lock service | * nfsv4 lock service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int i; | int i; | ||||
struct nfsstate *stp = NULL; | struct nfsstate *stp = NULL; | ||||
struct nfslock *lop; | struct nfslock *lop; | ||||
struct nfslockconflict cf; | struct nfslockconflict cf; | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | if (stp) | ||||
free(stp, M_NFSDSTATE); | free(stp, M_NFSDSTATE); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 lock test service | * nfsv4 lock test service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_lockt(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_lockt(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int i; | int i; | ||||
struct nfsstate *stp = NULL; | struct nfsstate *stp = NULL; | ||||
struct nfslock lo, *lop = &lo; | struct nfslock lo, *lop = &lo; | ||||
struct nfslockconflict cf; | struct nfslockconflict cf; | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if (stp) | ||||
free(stp, M_NFSDSTATE); | free(stp, M_NFSDSTATE); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 unlock service | * nfsv4 unlock service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_locku(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_locku(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int i; | int i; | ||||
struct nfsstate *stp; | struct nfsstate *stp; | ||||
struct nfslock *lop; | struct nfslock *lop; | ||||
int error = 0; | int error = 0; | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 open service | * nfsv4 open service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, vnode_t *vpp, __unused fhandle_t *fhp, struct nfsexstuff *exp) | vnode_t dp, vnode_t *vpp, __unused fhandle_t *fhp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int i, retext; | int i, retext; | ||||
struct nfsstate *stp = NULL; | struct nfsstate *stp = NULL; | ||||
int error = 0, create, claim, exclusive_flag = 0, override; | int error = 0, create, claim, exclusive_flag = 0, override; | ||||
u_int32_t rflags = NFSV4OPEN_LOCKTYPEPOSIX, acemask; | u_int32_t rflags = NFSV4OPEN_LOCKTYPEPOSIX, acemask; | ||||
▲ Show 20 Lines • Show All 462 Lines • ▼ Show 20 Lines | if (stp) | ||||
free(stp, M_NFSDSTATE); | free(stp, M_NFSDSTATE); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 close service | * nfsv4 close service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_close(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_close(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsstate st, *stp = &st; | struct nfsstate st, *stp = &st; | ||||
int error = 0, writeacc; | int error = 0, writeacc; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 delegpurge service | * nfsv4 delegpurge service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_delegpurge(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_delegpurge(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0; | int error = 0; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 20 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 delegreturn service | * nfsv4 delegreturn service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_delegreturn(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_delegreturn(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, writeacc; | int error = 0, writeacc; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
struct nfsvattr na; | struct nfsvattr na; | ||||
Show All 24 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 get file handle service | * nfsv4 get file handle service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_getfh(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_getfh(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
fhandle_t fh; | fhandle_t fh; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
nd->nd_repstat = nfsvno_getfh(vp, &fh, p); | nd->nd_repstat = nfsvno_getfh(vp, &fh, p); | ||||
vput(vp); | vput(vp); | ||||
if (!nd->nd_repstat) | if (!nd->nd_repstat) | ||||
(void) nfsm_fhtom(nd, (u_int8_t *)&fh, 0, 0); | (void) nfsm_fhtom(nd, (u_int8_t *)&fh, 0, 0); | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 open confirm service | * nfsv4 open confirm service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_openconfirm(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_openconfirm(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsstate st, *stp = &st; | struct nfsstate st, *stp = &st; | ||||
int error = 0; | int error = 0; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
Show All 37 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 open downgrade service | * nfsv4 open downgrade service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_opendowngrade(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_opendowngrade(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int i; | int i; | ||||
struct nfsstate st, *stp = &st; | struct nfsstate st, *stp = &st; | ||||
int error = 0; | int error = 0; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 renew lease service | * nfsv4 renew lease service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_renew(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_renew(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0; | int error = 0; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 24 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 security info service | * nfsv4 security info service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, | nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, | ||||
vnode_t dp, struct nfsexstuff *exp) | vnode_t dp, struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int len; | int len; | ||||
struct nameidata named; | struct nameidata named; | ||||
vnode_t dirp = NULL, vp; | vnode_t dirp = NULL, vp; | ||||
struct nfsrvfh fh; | struct nfsrvfh fh; | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 set client id service | * nfsv4 set client id service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_setclientid(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_setclientid(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int i; | int i; | ||||
int error = 0, idlen; | int error = 0, idlen; | ||||
struct nfsclient *clp = NULL; | struct nfsclient *clp = NULL; | ||||
#ifdef INET | #ifdef INET | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | nfsmout: | ||||
} | } | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 set client id confirm service | * nfsv4 set client id confirm service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_setclientidcfrm(struct nfsrv_descript *nd, | nfsrvd_setclientidcfrm(struct nfsrv_descript *nd, | ||||
__unused int isdgram, __unused vnode_t vp, | __unused int isdgram, __unused vnode_t vp, | ||||
__unused struct nfsexstuff *exp) | __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0; | int error = 0; | ||||
nfsquad_t clientid, confirm; | nfsquad_t clientid, confirm; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 21 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 verify service | * nfsv4 verify service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_verify(struct nfsrv_descript *nd, int isdgram, | nfsrvd_verify(struct nfsrv_descript *nd, int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
int error = 0, ret, fhsize = NFSX_MYFH; | int error = 0, ret, fhsize = NFSX_MYFH; | ||||
struct nfsvattr nva; | struct nfsvattr nva; | ||||
struct statfs *sf; | struct statfs *sf; | ||||
struct nfsfsinfo fs; | struct nfsfsinfo fs; | ||||
fhandle_t fh; | fhandle_t fh; | ||||
Show All 23 Lines | nfsrvd_verify(struct nfsrv_descript *nd, int isdgram, | ||||
free(sf, M_STATFS); | free(sf, M_STATFS); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs openattr rpc | * nfs openattr rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_openattr(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_openattr(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t dp, __unused vnode_t *vpp, __unused fhandle_t *fhp, | vnode_t dp, __unused vnode_t *vpp, __unused fhandle_t *fhp, | ||||
__unused struct nfsexstuff *exp) | __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0, createdir __unused; | int error = 0, createdir __unused; | ||||
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); | NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); | ||||
createdir = fxdr_unsigned(int, *tl); | createdir = fxdr_unsigned(int, *tl); | ||||
nd->nd_repstat = NFSERR_NOTSUPP; | nd->nd_repstat = NFSERR_NOTSUPP; | ||||
nfsmout: | nfsmout: | ||||
vrele(dp); | vrele(dp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 release lock owner service | * nfsv4 release lock owner service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_releaselckown(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_releaselckown(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsstate *stp = NULL; | struct nfsstate *stp = NULL; | ||||
int error = 0, len; | int error = 0, len; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (stp) | ||||
free(stp, M_NFSDSTATE); | free(stp, M_NFSDSTATE); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 exchange_id service | * nfsv4 exchange_id service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error = 0, i, idlen; | int error = 0, i, idlen; | ||||
struct nfsclient *clp = NULL; | struct nfsclient *clp = NULL; | ||||
nfsquad_t clientid, confirm; | nfsquad_t clientid, confirm; | ||||
uint8_t *verf; | uint8_t *verf; | ||||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | nfsmout: | ||||
} | } | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 create session service | * nfsv4 create session service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error = 0; | int error = 0; | ||||
nfsquad_t clientid, confirm; | nfsquad_t clientid, confirm; | ||||
struct nfsdsession *sep = NULL; | struct nfsdsession *sep = NULL; | ||||
uint32_t rdmacnt; | uint32_t rdmacnt; | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | if (nd->nd_repstat != 0 && sep != NULL) | ||||
free(sep, M_NFSDSESSION); | free(sep, M_NFSDSESSION); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 sequence service | * nfsv4 sequence service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_sequence(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_sequence(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
uint32_t highest_slotid, sequenceid, sflags, target_highest_slotid; | uint32_t highest_slotid, sequenceid, sflags, target_highest_slotid; | ||||
int cache_this, error = 0; | int cache_this, error = 0; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 27 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 reclaim complete service | * nfsv4 reclaim complete service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_reclaimcomplete(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_reclaimcomplete(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error = 0, onefs; | int error = 0, onefs; | ||||
if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | ||||
nd->nd_repstat = NFSERR_WRONGSEC; | nd->nd_repstat = NFSERR_WRONGSEC; | ||||
Show All 16 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 destroy clientid service | * nfsv4 destroy clientid service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_destroyclientid(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_destroyclientid(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsquad_t clientid; | nfsquad_t clientid; | ||||
int error = 0; | int error = 0; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | ||||
nd->nd_repstat = NFSERR_WRONGSEC; | nd->nd_repstat = NFSERR_WRONGSEC; | ||||
goto nfsmout; | goto nfsmout; | ||||
} | } | ||||
NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); | NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); | ||||
clientid.lval[0] = *tl++; | clientid.lval[0] = *tl++; | ||||
clientid.lval[1] = *tl; | clientid.lval[1] = *tl; | ||||
nd->nd_repstat = nfsrv_destroyclient(clientid, p); | nd->nd_repstat = nfsrv_destroyclient(clientid, p); | ||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 bind connection to session service | * nfsv4 bind connection to session service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_bindconnsess(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_bindconnsess(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
uint8_t sessid[NFSX_V4SESSIONID]; | uint8_t sessid[NFSX_V4SESSIONID]; | ||||
int error = 0, foreaft; | int error = 0, foreaft; | ||||
if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | ||||
Show All 22 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 destroy session service | * nfsv4 destroy session service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_destroysession(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_destroysession(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint8_t *cp, sessid[NFSX_V4SESSIONID]; | uint8_t *cp, sessid[NFSX_V4SESSIONID]; | ||||
int error = 0; | int error = 0; | ||||
if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { | ||||
nd->nd_repstat = NFSERR_WRONGSEC; | nd->nd_repstat = NFSERR_WRONGSEC; | ||||
goto nfsmout; | goto nfsmout; | ||||
} | } | ||||
NFSM_DISSECT(cp, uint8_t *, NFSX_V4SESSIONID); | NFSM_DISSECT(cp, uint8_t *, NFSX_V4SESSIONID); | ||||
NFSBCOPY(cp, sessid, NFSX_V4SESSIONID); | NFSBCOPY(cp, sessid, NFSX_V4SESSIONID); | ||||
nd->nd_repstat = nfsrv_destroysession(nd, sessid); | nd->nd_repstat = nfsrv_destroysession(nd, sessid); | ||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 free stateid service | * nfsv4 free stateid service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_freestateid(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_freestateid(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
int error = 0; | int error = 0; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 31 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 layoutget service | * nfsv4 layoutget service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_layoutget(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_layoutget(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
int error = 0, layoutlen, layouttype, iomode, maxcnt, retonclose; | int error = 0, layoutlen, layouttype, iomode, maxcnt, retonclose; | ||||
uint64_t offset, len, minlen; | uint64_t offset, len, minlen; | ||||
char *layp; | char *layp; | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 layoutcommit service | * nfsv4 layoutcommit service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_layoutcommit(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_layoutcommit(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
int error = 0, hasnewoff, hasnewmtime, layouttype, maxcnt, reclaim; | int error = 0, hasnewoff, hasnewmtime, layouttype, maxcnt, reclaim; | ||||
int hasnewsize; | int hasnewsize; | ||||
uint64_t offset, len, newoff = 0, newsize; | uint64_t offset, len, newoff = 0, newsize; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 layoutreturn service | * nfsv4 layoutreturn service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_layoutreturn(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_layoutreturn(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl, *layp; | uint32_t *tl, *layp; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
int error = 0, fnd, kind, layouttype, iomode, maxcnt, reclaim; | int error = 0, fnd, kind, layouttype, iomode, maxcnt, reclaim; | ||||
uint64_t offset, len; | uint64_t offset, len; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 layout error service | * nfsv4 layout error service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_layouterror(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_layouterror(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
int cnt, error = 0, i, stat; | int cnt, error = 0, i, stat; | ||||
int opnum __unused; | int opnum __unused; | ||||
char devid[NFSX_V4DEVICEID]; | char devid[NFSX_V4DEVICEID]; | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 layout stats service | * nfsv4 layout stats service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_layoutstats(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_layoutstats(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
int cnt, error = 0; | int cnt, error = 0; | ||||
int layouttype __unused; | int layouttype __unused; | ||||
char devid[NFSX_V4DEVICEID] __unused; | char devid[NFSX_V4DEVICEID] __unused; | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 io_advise service | * nfsv4 io_advise service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_ioadvise(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_ioadvise(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
nfsattrbit_t hints; | nfsattrbit_t hints; | ||||
int error = 0, ret; | int error = 0, ret; | ||||
off_t offset, len; | off_t offset, len; | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 getdeviceinfo service | * nfsv4 getdeviceinfo service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_getdevinfo(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_getdevinfo(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl, maxcnt, notify[NFSV4_NOTIFYBITMAP]; | uint32_t *tl, maxcnt, notify[NFSV4_NOTIFYBITMAP]; | ||||
int cnt, devaddrlen, error = 0, i, layouttype; | int cnt, devaddrlen, error = 0, i, layouttype; | ||||
char devid[NFSX_V4DEVICEID], *devaddr; | char devid[NFSX_V4DEVICEID], *devaddr; | ||||
time_t dev_time; | time_t dev_time; | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 test stateid service | * nfsv4 test stateid service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_teststateid(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_teststateid(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
nfsv4stateid_t *stateidp = NULL, *tstateidp; | nfsv4stateid_t *stateidp = NULL, *tstateidp; | ||||
int cnt, error = 0, i, ret; | int cnt, error = 0, i, ret; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 28 Lines | nfsmout: | ||||
free(stateidp, M_TEMP); | free(stateidp, M_TEMP); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs allocate service | * nfs allocate service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_allocate(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_allocate(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
struct nfsvattr forat; | struct nfsvattr forat; | ||||
int error = 0, forat_ret = 1, gotproxystateid; | int error = 0, forat_ret = 1, gotproxystateid; | ||||
off_t off, len; | off_t off, len; | ||||
struct nfsstate st, *stp = &st; | struct nfsstate st, *stp = &st; | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs copy service | * nfs copy service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, vnode_t tovp, struct nfsexstuff *exp, struct nfsexstuff *toexp) | vnode_t vp, vnode_t tovp, struct nfsexstuff *exp, struct nfsexstuff *toexp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
struct nfsvattr at; | struct nfsvattr at; | ||||
int cnt, error = 0, ret; | int cnt, error = 0, ret; | ||||
off_t inoff, outoff; | off_t inoff, outoff; | ||||
uint64_t len; | uint64_t len; | ||||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vrele(tovp); | vrele(tovp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs seek service | * nfs seek service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_seek(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_seek(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, struct nfsexstuff *exp) | vnode_t vp, struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
struct nfsvattr at; | struct nfsvattr at; | ||||
int content, error = 0; | int content, error = 0; | ||||
off_t off; | off_t off; | ||||
u_long cmd; | u_long cmd; | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(error, nd); | NFSEXITCODE2(error, nd); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs get extended attribute service | * nfs get extended attribute service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_getxattr(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_getxattr(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
struct mbuf *mp = NULL, *mpend = NULL; | struct mbuf *mp = NULL, *mpend = NULL; | ||||
int error, len; | int error, len; | ||||
char *name; | char *name; | ||||
struct thread *p = curthread; | struct thread *p = curthread; | ||||
Show All 39 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfs set extended attribute service | * nfs set extended attribute service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_setxattr(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_setxattr(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
struct nfsvattr ova, nva; | struct nfsvattr ova, nva; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
int error, len, opt; | int error, len, opt; | ||||
char *name; | char *name; | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfs remove extended attribute service | * nfs remove extended attribute service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_rmxattr(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_rmxattr(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
struct nfsvattr ova, nva; | struct nfsvattr ova, nva; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
int error, len; | int error, len; | ||||
char *name; | char *name; | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfs list extended attribute service | * nfs list extended attribute service | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_listxattr(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_listxattr(struct nfsrv_descript *nd, __unused int isdgram, | ||||
vnode_t vp, __unused struct nfsexstuff *exp) | vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
uint32_t cnt, *tl, len, len2, i, pos, retlen; | uint32_t cnt, *tl, len, len2, i, pos, retlen; | ||||
int error; | int error; | ||||
uint64_t cookie, cookie2; | uint64_t cookie, cookie2; | ||||
u_char *buf; | u_char *buf; | ||||
bool eof; | bool eof; | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | nfsmout: | ||||
vput(vp); | vput(vp); | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* nfsv4 service not supported | * nfsv4 service not supported | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrvd_notsupp(struct nfsrv_descript *nd, __unused int isdgram, | nfsrvd_notsupp(struct nfsrv_descript *nd, __unused int isdgram, | ||||
__unused vnode_t vp, __unused struct nfsexstuff *exp) | __unused vnode_t vp, __unused struct nfsexstuff *exp) | ||||
{ | { | ||||
nd->nd_repstat = NFSERR_NOTSUPP; | nd->nd_repstat = NFSERR_NOTSUPP; | ||||
NFSEXITCODE2(0, nd); | NFSEXITCODE2(0, nd); | ||||
return (0); | return (0); | ||||
} | } | ||||