Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsclient/nfs_clrpcops.c
Show First 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | |||||
static int nfsrpc_seekrpc(vnode_t, off_t *, nfsv4stateid_t *, bool *, | static int nfsrpc_seekrpc(vnode_t, off_t *, nfsv4stateid_t *, bool *, | ||||
int, struct nfsvattr *, int *, struct ucred *); | int, struct nfsvattr *, int *, struct ucred *); | ||||
int nfs_pnfsio(task_fn_t *, void *); | int nfs_pnfsio(task_fn_t *, void *); | ||||
/* | /* | ||||
* nfs null call from vfs. | * nfs null call from vfs. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_null(vnode_t vp, struct ucred *cred, NFSPROC_T *p) | nfsrpc_null(vnode_t vp, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
int error; | int error; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
NFSCL_REQSTART(nd, NFSPROC_NULL, vp); | NFSCL_REQSTART(nd, NFSPROC_NULL, vp); | ||||
error = nfscl_request(nd, vp, p, cred, NULL); | error = nfscl_request(nd, vp, p, cred, NULL); | ||||
if (nd->nd_repstat && !error) | if (nd->nd_repstat && !error) | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs access rpc op. | * nfs access rpc op. | ||||
* For nfs version 3 and 4, use the access rpc to check accessibility. If file | * For nfs version 3 and 4, use the access rpc to check accessibility. If file | ||||
* modes are changed on the server, accesses might still fail later. | * modes are changed on the server, accesses might still fail later. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_access(vnode_t vp, int acmode, struct ucred *cred, | nfsrpc_access(vnode_t vp, int acmode, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp) | NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp) | ||||
{ | { | ||||
int error; | int error; | ||||
u_int32_t mode, rmode; | u_int32_t mode, rmode; | ||||
if (acmode & VREAD) | if (acmode & VREAD) | ||||
mode = NFSACCESS_READ; | mode = NFSACCESS_READ; | ||||
Show All 26 Lines | nfsrpc_access(vnode_t vp, int acmode, struct ucred *cred, | ||||
if (!error && (rmode & mode) != mode) | if (!error && (rmode & mode) != mode) | ||||
error = EACCES; | error = EACCES; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The actual rpc, separated out for Darwin. | * The actual rpc, separated out for Darwin. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_accessrpc(vnode_t vp, u_int32_t mode, struct ucred *cred, | nfsrpc_accessrpc(vnode_t vp, u_int32_t mode, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, u_int32_t *rmodep, | NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, u_int32_t *rmodep, | ||||
void *stuff) | void *stuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
u_int32_t supported, rmode; | u_int32_t supported, rmode; | ||||
int error; | int error; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs open rpc | * nfs open rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p) | nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
struct nfsclopen *op; | struct nfsclopen *op; | ||||
struct nfscldeleg *dp; | struct nfscldeleg *dp; | ||||
struct nfsfh *nfhp; | struct nfsfh *nfhp; | ||||
struct nfsnode *np = VTONFS(vp); | struct nfsnode *np = VTONFS(vp); | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
u_int32_t mode, clidrev; | u_int32_t mode, clidrev; | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | #endif | ||||
if (error && retrycnt >= 4) | if (error && retrycnt >= 4) | ||||
error = EIO; | error = EIO; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* the actual open rpc | * the actual open rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, | nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, | ||||
u_int8_t *newfhp, int newfhlen, u_int32_t mode, struct nfsclopen *op, | u_int8_t *newfhp, int newfhlen, u_int32_t mode, struct nfsclopen *op, | ||||
u_int8_t *name, int namelen, struct nfscldeleg **dpp, | u_int8_t *name, int namelen, struct nfscldeleg **dpp, | ||||
int reclaim, u_int32_t delegtype, struct ucred *cred, NFSPROC_T *p, | int reclaim, u_int32_t delegtype, struct ucred *cred, NFSPROC_T *p, | ||||
int syscred, int recursed) | int syscred, int recursed) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | else if (ndp != NULL) | ||||
free(ndp, M_NFSCLDELEG); | free(ndp, M_NFSCLDELEG); | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* open downgrade rpc | * open downgrade rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_opendowngrade(vnode_t vp, u_int32_t mode, struct nfsclopen *op, | nfsrpc_opendowngrade(vnode_t vp, u_int32_t mode, struct nfsclopen *op, | ||||
struct ucred *cred, NFSPROC_T *p) | struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
int error; | int error; | ||||
NFSCL_REQSTART(nd, NFSPROC_OPENDOWNGRADE, vp); | NFSCL_REQSTART(nd, NFSPROC_OPENDOWNGRADE, vp); | ||||
Show All 26 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* V4 Close operation. | * V4 Close operation. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p) | nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p) | ||||
{ | { | ||||
struct nfsclclient *clp; | struct nfsclclient *clp; | ||||
int error; | int error; | ||||
if (vnode_vtype(vp) != VREG) | if (vnode_vtype(vp) != VREG) | ||||
return (0); | return (0); | ||||
if (doclose) | if (doclose) | ||||
error = nfscl_doclose(vp, &clp, p); | error = nfscl_doclose(vp, &clp, p); | ||||
else | else | ||||
error = nfscl_getclose(vp, &clp); | error = nfscl_getclose(vp, &clp); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
nfscl_clientrelease(clp); | nfscl_clientrelease(clp); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Close the open. | * Close the open. | ||||
*/ | */ | ||||
APPLESTATIC void | void | ||||
nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) | nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfscllockowner *lp, *nlp; | struct nfscllockowner *lp, *nlp; | ||||
struct nfscllock *lop, *nlop; | struct nfscllock *lop, *nlop; | ||||
struct ucred *tcred; | struct ucred *tcred; | ||||
u_int64_t off = 0, len = 0; | u_int64_t off = 0, len = 0; | ||||
u_int32_t type = NFSV4LOCKT_READ; | u_int32_t type = NFSV4LOCKT_READ; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) | ||||
nfscl_freeopen(op, 0); | nfscl_freeopen(op, 0); | ||||
NFSUNLOCKCLSTATE(); | NFSUNLOCKCLSTATE(); | ||||
NFSFREECRED(tcred); | NFSFREECRED(tcred); | ||||
} | } | ||||
/* | /* | ||||
* The actual Close RPC. | * The actual Close RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp, | nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp, | ||||
struct nfsclopen *op, struct ucred *cred, NFSPROC_T *p, | struct nfsclopen *op, struct ucred *cred, NFSPROC_T *p, | ||||
int syscred) | int syscred) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error; | int error; | ||||
nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, | nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, | ||||
Show All 22 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* V4 Open Confirm RPC. | * V4 Open Confirm RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_openconfirm(vnode_t vp, u_int8_t *nfhp, int fhlen, | nfsrpc_openconfirm(vnode_t vp, u_int8_t *nfhp, int fhlen, | ||||
struct nfsclopen *op, struct ucred *cred, NFSPROC_T *p) | struct nfsclopen *op, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
int error; | int error; | ||||
Show All 26 Lines | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Do the setclientid and setclientid confirm RPCs. Called from nfs_statfs() | * Do the setclientid and setclientid confirm RPCs. Called from nfs_statfs() | ||||
* when a mount has just occurred and when the server replies NFSERR_EXPIRED. | * when a mount has just occurred and when the server replies NFSERR_EXPIRED. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim, | nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim, | ||||
bool *retokp, struct ucred *cred, NFSPROC_T *p) | bool *retokp, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
u_int8_t *cp = NULL, *cp2, addr[INET6_ADDRSTRLEN + 9]; | u_int8_t *cp = NULL, *cp2, addr[INET6_ADDRSTRLEN + 9]; | ||||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs getattr call. | * nfs getattr call. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC_T *p, | nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC_T *p, | ||||
struct nfsvattr *nap, void *stuff) | struct nfsvattr *nap, void *stuff) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
int error; | int error; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp); | NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp); | ||||
Show All 10 Lines | else | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs getattr call with non-vnode arguemnts. | * nfs getattr call with non-vnode arguemnts. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp, int fhlen, int syscred, | nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp, int fhlen, int syscred, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, u_int64_t *xidp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, u_int64_t *xidp, | ||||
uint32_t *leasep) | uint32_t *leasep) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
int error, vers = NFS_VER2; | int error, vers = NFS_VER2; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
Show All 23 Lines | if (nd->nd_repstat == 0) { | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Do an nfs setattr operation. | * Do an nfs setattr operation. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_setattr(vnode_t vp, struct vattr *vap, NFSACL_T *aclp, | nfsrpc_setattr(vnode_t vp, struct vattr *vap, NFSACL_T *aclp, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *rnap, int *attrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *rnap, int *attrflagp, | ||||
void *stuff) | void *stuff) | ||||
{ | { | ||||
int error, expireret = 0, openerr, retrycnt; | int error, expireret = 0, openerr, retrycnt; | ||||
u_int32_t clidrev = 0, mode; | u_int32_t clidrev = 0, mode; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
struct nfsfh *nfhp; | struct nfsfh *nfhp; | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | nfsrpc_setattrrpc(vnode_t vp, struct vattr *vap, | ||||
if (nd->nd_repstat && !error) | if (nd->nd_repstat && !error) | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs lookup rpc | * nfs lookup rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_lookup(vnode_t dvp, char *name, int len, struct ucred *cred, | nfsrpc_lookup(vnode_t dvp, char *name, int len, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *dnap, struct nfsvattr *nap, | NFSPROC_T *p, struct nfsvattr *dnap, struct nfsvattr *nap, | ||||
struct nfsfh **nfhpp, int *attrflagp, int *dattrflagp, void *stuff) | struct nfsfh **nfhpp, int *attrflagp, int *dattrflagp, void *stuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
struct nfsnode *np; | struct nfsnode *np; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | nfsmout: | ||||
if (!error && nd->nd_repstat) | if (!error && nd->nd_repstat) | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Do a readlink rpc. | * Do a readlink rpc. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_readlink(vnode_t vp, struct uio *uiop, struct ucred *cred, | nfsrpc_readlink(vnode_t vp, struct uio *uiop, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsnode *np = VTONFS(vp); | struct nfsnode *np = VTONFS(vp); | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
int error, len, cangetattr = 1; | int error, len, cangetattr = 1; | ||||
Show All 39 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Read operation. | * Read operation. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_read(vnode_t vp, struct uio *uiop, struct ucred *cred, | nfsrpc_read(vnode_t vp, struct uio *uiop, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | ||||
{ | { | ||||
int error, expireret = 0, retrycnt; | int error, expireret = 0, retrycnt; | ||||
u_int32_t clidrev = 0; | u_int32_t clidrev = 0; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
struct nfsnode *np = VTONFS(vp); | struct nfsnode *np = VTONFS(vp); | ||||
struct ucred *newcred; | struct ucred *newcred; | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* nfs write operation | * nfs write operation | ||||
* When called_from_strategy != 0, it should return EIO for an error that | * When called_from_strategy != 0, it should return EIO for an error that | ||||
* indicates recovery is in progress, so that the buffer will be left | * indicates recovery is in progress, so that the buffer will be left | ||||
* dirty and be written back to the server later. If it loops around, | * dirty and be written back to the server later. If it loops around, | ||||
* the recovery thread could get stuck waiting for the buffer and recovery | * the recovery thread could get stuck waiting for the buffer and recovery | ||||
* will then deadlock. | * will then deadlock. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, | nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | ||||
void *stuff, int called_from_strategy) | void *stuff, int called_from_strategy) | ||||
{ | { | ||||
int error, expireret = 0, retrycnt, nostateid; | int error, expireret = 0, retrycnt, nostateid; | ||||
u_int32_t clidrev = 0; | u_int32_t clidrev = 0; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
struct nfsnode *np = VTONFS(vp); | struct nfsnode *np = VTONFS(vp); | ||||
▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | nfsmout: | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs mknod rpc | * nfs mknod rpc | ||||
* For NFS v2 this is a kludge. Use a create rpc but with the IFMT bits of the | * For NFS v2 this is a kludge. Use a create rpc but with the IFMT bits of the | ||||
* mode set to specify the file type and the size field for rdev. | * mode set to specify the file type and the size field for rdev. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_mknod(vnode_t dvp, char *name, int namelen, struct vattr *vap, | nfsrpc_mknod(vnode_t dvp, char *name, int namelen, struct vattr *vap, | ||||
u_int32_t rdev, enum vtype vtyp, struct ucred *cred, NFSPROC_T *p, | u_int32_t rdev, enum vtype vtyp, struct ucred *cred, NFSPROC_T *p, | ||||
struct nfsvattr *dnap, struct nfsvattr *nnap, struct nfsfh **nfhpp, | struct nfsvattr *dnap, struct nfsvattr *nnap, struct nfsfh **nfhpp, | ||||
int *attrflagp, int *dattrflagp, void *dstuff) | int *attrflagp, int *dattrflagp, void *dstuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error = 0; | int error = 0; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | nfsmout: | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs file create call | * nfs file create call | ||||
* Mostly just call the approriate routine. (I separated out v4, so that | * Mostly just call the approriate routine. (I separated out v4, so that | ||||
* error recovery wouldn't be as difficult.) | * error recovery wouldn't be as difficult.) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_create(vnode_t dvp, char *name, int namelen, struct vattr *vap, | nfsrpc_create(vnode_t dvp, char *name, int namelen, struct vattr *vap, | ||||
nfsquad_t cverf, int fmode, struct ucred *cred, NFSPROC_T *p, | nfsquad_t cverf, int fmode, struct ucred *cred, NFSPROC_T *p, | ||||
struct nfsvattr *dnap, struct nfsvattr *nnap, struct nfsfh **nfhpp, | struct nfsvattr *dnap, struct nfsvattr *nnap, struct nfsfh **nfhpp, | ||||
int *attrflagp, int *dattrflagp, void *dstuff) | int *attrflagp, int *dattrflagp, void *dstuff) | ||||
{ | { | ||||
int error = 0, newone, expireret = 0, retrycnt, unlocked; | int error = 0, newone, expireret = 0, retrycnt, unlocked; | ||||
struct nfsclowner *owp; | struct nfsclowner *owp; | ||||
struct nfscldeleg *dp; | struct nfscldeleg *dp; | ||||
▲ Show 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | else if (dp != NULL) | ||||
free(dp, M_NFSCLDELEG); | free(dp, M_NFSCLDELEG); | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Nfs remove rpc | * Nfs remove rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_remove(vnode_t dvp, char *name, int namelen, vnode_t vp, | nfsrpc_remove(vnode_t dvp, char *name, int namelen, vnode_t vp, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, int *dattrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, int *dattrflagp, | ||||
void *dstuff) | void *dstuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsnode *np; | struct nfsnode *np; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Do an nfs rename rpc. | * Do an nfs rename rpc. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_rename(vnode_t fdvp, vnode_t fvp, char *fnameptr, int fnamelen, | nfsrpc_rename(vnode_t fdvp, vnode_t fvp, char *fnameptr, int fnamelen, | ||||
vnode_t tdvp, vnode_t tvp, char *tnameptr, int tnamelen, struct ucred *cred, | vnode_t tdvp, vnode_t tvp, char *tnameptr, int tnamelen, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *fnap, struct nfsvattr *tnap, | NFSPROC_T *p, struct nfsvattr *fnap, struct nfsvattr *tnap, | ||||
int *fattrflagp, int *tattrflagp, void *fstuff, void *tstuff) | int *fattrflagp, int *tattrflagp, void *fstuff, void *tstuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs hard link create rpc | * nfs hard link create rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_link(vnode_t dvp, vnode_t vp, char *name, int namelen, | nfsrpc_link(vnode_t dvp, vnode_t vp, char *name, int namelen, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, | ||||
struct nfsvattr *nap, int *attrflagp, int *dattrflagp, void *dstuff) | struct nfsvattr *nap, int *attrflagp, int *dattrflagp, void *dstuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
int error = 0; | int error = 0; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs symbolic link create rpc | * nfs symbolic link create rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_symlink(vnode_t dvp, char *name, int namelen, const char *target, | nfsrpc_symlink(vnode_t dvp, char *name, int namelen, const char *target, | ||||
struct vattr *vap, struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, | struct vattr *vap, struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, | ||||
struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp, | struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp, | ||||
int *dattrflagp, void *dstuff) | int *dattrflagp, void *dstuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || | ||||
nmp->nm_minorvers == 0)) | nmp->nm_minorvers == 0)) | ||||
error = 0; | error = 0; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs make dir rpc | * nfs make dir rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_mkdir(vnode_t dvp, char *name, int namelen, struct vattr *vap, | nfsrpc_mkdir(vnode_t dvp, char *name, int namelen, struct vattr *vap, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, | ||||
struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp, | struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp, | ||||
int *dattrflagp, void *dstuff) | int *dattrflagp, void *dstuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || | ||||
nmp->nm_minorvers == 0)) | nmp->nm_minorvers == 0)) | ||||
error = 0; | error = 0; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs remove directory call | * nfs remove directory call | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_rmdir(vnode_t dvp, char *name, int namelen, struct ucred *cred, | nfsrpc_rmdir(vnode_t dvp, char *name, int namelen, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *dnap, int *dattrflagp, void *dstuff) | NFSPROC_T *p, struct nfsvattr *dnap, int *dattrflagp, void *dstuff) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
int error = 0; | int error = 0; | ||||
*dattrflagp = 0; | *dattrflagp = 0; | ||||
if (namelen > NFS_MAXNAMLEN) | if (namelen > NFS_MAXNAMLEN) | ||||
Show All 39 Lines | |||||
* The directory offset cookies are filled in as the last 8 bytes of | * The directory offset cookies are filled in as the last 8 bytes of | ||||
* each directory entry, after d_name. Someday, the userland libc | * each directory entry, after d_name. Someday, the userland libc | ||||
* functions may be able to use these. In the meantime, it satisfies | * functions may be able to use these. In the meantime, it satisfies | ||||
* OpenBSD's requirements for cookies being returned. | * OpenBSD's requirements for cookies being returned. | ||||
* If expects the directory offset cookie for the read to be in uio_offset | * If expects the directory offset cookie for the read to be in uio_offset | ||||
* and returns the one for the next entry after this directory block in | * and returns the one for the next entry after this directory block in | ||||
* there, as well. | * there, as well. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, | nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | ||||
int *eofp, void *stuff) | int *eofp, void *stuff) | ||||
{ | { | ||||
int len, left; | int len, left; | ||||
struct dirent *dp = NULL; | struct dirent *dp = NULL; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
nfsquad_t cookie, ncookie; | nfsquad_t cookie, ncookie; | ||||
▲ Show 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
#ifndef APPLE | #ifndef APPLE | ||||
/* | /* | ||||
* NFS V3 readdir plus RPC. Used in place of nfsrpc_readdir(). | * NFS V3 readdir plus RPC. Used in place of nfsrpc_readdir(). | ||||
* (Also used for NFS V4 when mount flag set.) | * (Also used for NFS V4 when mount flag set.) | ||||
* (ditto above w.r.t. multiple of DIRBLKSIZ, etc.) | * (ditto above w.r.t. multiple of DIRBLKSIZ, etc.) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, | nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | ||||
int *eofp, void *stuff) | int *eofp, void *stuff) | ||||
{ | { | ||||
int len, left; | int len, left; | ||||
struct dirent *dp = NULL; | struct dirent *dp = NULL; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
vnode_t newvp = NULLVP; | vnode_t newvp = NULLVP; | ||||
▲ Show 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | if (nd->nd_mrep != NULL) | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* !APPLE */ | #endif /* !APPLE */ | ||||
/* | /* | ||||
* Nfs commit rpc | * Nfs commit rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_commit(vnode_t vp, u_quad_t offset, int cnt, struct ucred *cred, | nfsrpc_commit(vnode_t vp, u_quad_t offset, int cnt, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
int error; | int error; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
Show All 34 Lines | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* NFS byte range lock rpc. | * NFS byte range lock rpc. | ||||
* (Mostly just calls one of the three lower level RPC routines.) | * (Mostly just calls one of the three lower level RPC routines.) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, | nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, | ||||
int reclaim, struct ucred *cred, NFSPROC_T *p, void *id, int flags) | int reclaim, struct ucred *cred, NFSPROC_T *p, void *id, int flags) | ||||
{ | { | ||||
struct nfscllockowner *lp; | struct nfscllockowner *lp; | ||||
struct nfsclclient *clp; | struct nfsclclient *clp; | ||||
struct nfsfh *nfhp; | struct nfsfh *nfhp; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, | ||||
if (error && retrycnt >= 4) | if (error && retrycnt >= 4) | ||||
error = EIO; | error = EIO; | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The lower level routine for the LockT case. | * The lower level routine for the LockT case. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_lockt(struct nfsrv_descript *nd, vnode_t vp, | nfsrpc_lockt(struct nfsrv_descript *nd, vnode_t vp, | ||||
struct nfsclclient *clp, u_int64_t off, u_int64_t len, struct flock *fl, | struct nfsclclient *clp, u_int64_t off, u_int64_t len, struct flock *fl, | ||||
struct ucred *cred, NFSPROC_T *p, void *id, int flags) | struct ucred *cred, NFSPROC_T *p, void *id, int flags) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error, type, size; | int error, type, size; | ||||
uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; | uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; | ||||
struct nfsnode *np; | struct nfsnode *np; | ||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The actual Lock RPC. | * The actual Lock RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_lock(struct nfsrv_descript *nd, struct nfsmount *nmp, vnode_t vp, | nfsrpc_lock(struct nfsrv_descript *nd, struct nfsmount *nmp, vnode_t vp, | ||||
u_int8_t *nfhp, int fhlen, struct nfscllockowner *lp, int newone, | u_int8_t *nfhp, int fhlen, struct nfscllockowner *lp, int newone, | ||||
int reclaim, u_int64_t off, u_int64_t len, short type, struct ucred *cred, | int reclaim, u_int64_t off, u_int64_t len, short type, struct ucred *cred, | ||||
NFSPROC_T *p, int syscred) | NFSPROC_T *p, int syscred) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error, size; | int error, size; | ||||
uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; | uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs statfs rpc | * nfs statfs rpc | ||||
* (always called with the vp for the mount point) | * (always called with the vp for the mount point) | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struct nfsfsinfo *fsp, | nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struct nfsfsinfo *fsp, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | ||||
void *stuff) | void *stuff) | ||||
{ | { | ||||
u_int32_t *tl = NULL; | u_int32_t *tl = NULL; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs pathconf rpc | * nfs pathconf rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, | nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, | ||||
struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, | ||||
void *stuff) | void *stuff) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs version 3 fsinfo rpc call | * nfs version 3 fsinfo rpc call | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_fsinfo(vnode_t vp, struct nfsfsinfo *fsp, struct ucred *cred, | nfsrpc_fsinfo(vnode_t vp, struct nfsfsinfo *fsp, struct ucred *cred, | ||||
NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
int error; | int error; | ||||
*attrflagp = 0; | *attrflagp = 0; | ||||
Show All 22 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* This function performs the Renew RPC. | * This function performs the Renew RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_renew(struct nfsclclient *clp, struct nfsclds *dsp, struct ucred *cred, | nfsrpc_renew(struct nfsclclient *clp, struct nfsclds *dsp, struct ucred *cred, | ||||
NFSPROC_T *p) | NFSPROC_T *p) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
struct nfsmount *nmp; | struct nfsmount *nmp; | ||||
int error; | int error; | ||||
Show All 37 Lines | nfsrpc_renew(struct nfsclclient *clp, struct nfsclds *dsp, struct ucred *cred, | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* This function performs the Releaselockowner RPC. | * This function performs the Releaselockowner RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllockowner *lp, | nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllockowner *lp, | ||||
uint8_t *fh, int fhlen, struct ucred *cred, NFSPROC_T *p) | uint8_t *fh, int fhlen, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
int error; | int error; | ||||
uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; | uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; | ||||
struct nfsclsession *tsep; | struct nfsclsession *tsep; | ||||
Show All 22 Lines | nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllockowner *lp, | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* This function performs the Compound to get the mount pt FH. | * This function performs the Compound to get the mount pt FH. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpath, struct ucred *cred, | nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpath, struct ucred *cred, | ||||
NFSPROC_T *p) | NFSPROC_T *p) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
u_char *cp, *cp2; | u_char *cp, *cp2; | ||||
int error, cnt, len, setnil; | int error, cnt, len, setnil; | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* This function performs the Delegreturn RPC. | * This function performs the Delegreturn RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred *cred, | nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred *cred, | ||||
struct nfsmount *nmp, NFSPROC_T *p, int syscred) | struct nfsmount *nmp, NFSPROC_T *p, int syscred) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
int error; | int error; | ||||
Show All 16 Lines | nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred *cred, | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs getacl call. | * nfs getacl call. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_getacl(vnode_t vp, struct ucred *cred, NFSPROC_T *p, | nfsrpc_getacl(vnode_t vp, struct ucred *cred, NFSPROC_T *p, | ||||
struct acl *aclp, void *stuff) | struct acl *aclp, void *stuff) | ||||
{ | { | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
int error; | int error; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
Show All 13 Lines | else | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* nfs setacl call. | * nfs setacl call. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_setacl(vnode_t vp, struct ucred *cred, NFSPROC_T *p, | nfsrpc_setacl(vnode_t vp, struct ucred *cred, NFSPROC_T *p, | ||||
struct acl *aclp, void *stuff) | struct acl *aclp, void *stuff) | ||||
{ | { | ||||
int error; | int error; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
if (nfsrv_useacl == 0 || !NFSHASNFSV4(nmp)) | if (nfsrv_useacl == 0 || !NFSHASNFSV4(nmp)) | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
▲ Show 20 Lines • Show All 2,116 Lines • ▼ Show 20 Lines | error = nfsrpc_commitds(vp, offset, cnt, dsp, fhp, vers, | ||||
minorvers, cred, p); | minorvers, cred, p); | ||||
NFSCL_DEBUG(4, "nfsio_commitds: error=%d\n", error); | NFSCL_DEBUG(4, "nfsio_commitds: error=%d\n", error); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* NFS Advise rpc | * NFS Advise rpc | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_advise(vnode_t vp, off_t offset, uint64_t cnt, int advise, | nfsrpc_advise(vnode_t vp, off_t offset, uint64_t cnt, int advise, | ||||
struct ucred *cred, NFSPROC_T *p) | struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
struct nfsrv_descript nfsd, *nd = &nfsd; | struct nfsrv_descript nfsd, *nd = &nfsd; | ||||
nfsattrbit_t hints; | nfsattrbit_t hints; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | nfsio_adviseds(vnode_t vp, uint64_t offset, int cnt, int advise, | ||||
NFSCL_DEBUG(4, "nfsio_adviseds: error=%d\n", error); | NFSCL_DEBUG(4, "nfsio_adviseds: error=%d\n", error); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* notyet */ | #endif /* notyet */ | ||||
/* | /* | ||||
* Do the Allocate operation, retrying for recovery. | * Do the Allocate operation, retrying for recovery. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_allocate(vnode_t vp, off_t off, off_t len, struct nfsvattr *nap, | nfsrpc_allocate(vnode_t vp, off_t off, off_t len, struct nfsvattr *nap, | ||||
int *attrflagp, struct ucred *cred, NFSPROC_T *p, void *stuff) | int *attrflagp, struct ucred *cred, NFSPROC_T *p, void *stuff) | ||||
{ | { | ||||
int error, expireret = 0, retrycnt, nostateid; | int error, expireret = 0, retrycnt, nostateid; | ||||
uint32_t clidrev = 0; | uint32_t clidrev = 0; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
struct nfsfh *nfhp = NULL; | struct nfsfh *nfhp = NULL; | ||||
nfsv4stateid_t stateid; | nfsv4stateid_t stateid; | ||||
▲ Show 20 Lines • Show All 1,090 Lines • ▼ Show 20 Lines | if (laystat == 0 && islockedp != NULL) | ||||
*islockedp = 1; | *islockedp = 1; | ||||
} | } | ||||
return (laystat); | return (laystat); | ||||
} | } | ||||
/* | /* | ||||
* nfs copy_file_range operation. | * nfs copy_file_range operation. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_copy_file_range(vnode_t invp, off_t *inoffp, vnode_t outvp, | nfsrpc_copy_file_range(vnode_t invp, off_t *inoffp, vnode_t outvp, | ||||
off_t *outoffp, size_t *lenp, unsigned int flags, int *inattrflagp, | off_t *outoffp, size_t *lenp, unsigned int flags, int *inattrflagp, | ||||
struct nfsvattr *innap, int *outattrflagp, struct nfsvattr *outnap, | struct nfsvattr *innap, int *outattrflagp, struct nfsvattr *outnap, | ||||
struct ucred *cred, bool consecutive, bool *must_commitp) | struct ucred *cred, bool consecutive, bool *must_commitp) | ||||
{ | { | ||||
int commit, error, expireret = 0, retrycnt; | int commit, error, expireret = 0, retrycnt; | ||||
u_int32_t clidrev = 0; | u_int32_t clidrev = 0; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(invp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(invp)); | ||||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Seek operation. | * Seek operation. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_seek(vnode_t vp, off_t *offp, bool *eofp, int content, | nfsrpc_seek(vnode_t vp, off_t *offp, bool *eofp, int content, | ||||
struct ucred *cred, struct nfsvattr *nap, int *attrflagp) | struct ucred *cred, struct nfsvattr *nap, int *attrflagp) | ||||
{ | { | ||||
int error, expireret = 0, retrycnt; | int error, expireret = 0, retrycnt; | ||||
u_int32_t clidrev = 0; | u_int32_t clidrev = 0; | ||||
struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); | ||||
struct nfsnode *np = VTONFS(vp); | struct nfsnode *np = VTONFS(vp); | ||||
struct nfsfh *nfhp = NULL; | struct nfsfh *nfhp = NULL; | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The getextattr RPC. | * The getextattr RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_getextattr(vnode_t vp, const char *name, struct uio *uiop, ssize_t *lenp, | nfsrpc_getextattr(vnode_t vp, const char *name, struct uio *uiop, ssize_t *lenp, | ||||
struct nfsvattr *nap, int *attrflagp, struct ucred *cred, NFSPROC_T *p) | struct nfsvattr *nap, int *attrflagp, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error; | int error; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The setextattr RPC. | * The setextattr RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_setextattr(vnode_t vp, const char *name, struct uio *uiop, | nfsrpc_setextattr(vnode_t vp, const char *name, struct uio *uiop, | ||||
struct nfsvattr *nap, int *attrflagp, struct ucred *cred, NFSPROC_T *p) | struct nfsvattr *nap, int *attrflagp, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error; | int error; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
Show All 31 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The removeextattr RPC. | * The removeextattr RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_rmextattr(vnode_t vp, const char *name, struct nfsvattr *nap, | nfsrpc_rmextattr(vnode_t vp, const char *name, struct nfsvattr *nap, | ||||
int *attrflagp, struct ucred *cred, NFSPROC_T *p) | int *attrflagp, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int error; | int error; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
nfsattrbit_t attrbits; | nfsattrbit_t attrbits; | ||||
Show All 21 Lines | |||||
nfsmout: | nfsmout: | ||||
m_freem(nd->nd_mrep); | m_freem(nd->nd_mrep); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* The listextattr RPC. | * The listextattr RPC. | ||||
*/ | */ | ||||
APPLESTATIC int | int | ||||
nfsrpc_listextattr(vnode_t vp, uint64_t *cookiep, struct uio *uiop, | nfsrpc_listextattr(vnode_t vp, uint64_t *cookiep, struct uio *uiop, | ||||
size_t *lenp, bool *eofp, struct nfsvattr *nap, int *attrflagp, | size_t *lenp, bool *eofp, struct nfsvattr *nap, int *attrflagp, | ||||
struct ucred *cred, NFSPROC_T *p) | struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
uint32_t *tl; | uint32_t *tl; | ||||
int cnt, error, i, len; | int cnt, error, i, len; | ||||
struct nfsrv_descript nfsd; | struct nfsrv_descript nfsd; | ||||
struct nfsrv_descript *nd = &nfsd; | struct nfsrv_descript *nd = &nfsd; | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |