nfscl: Clean up the code by removing unused arguments

The "void *stuff" (also called fstuff and dstuff) argument
was used by the Mac OSX port.  For FreeBSD, this argument
is always NULL, so remove it to clean up the code.

This commit gets rid of "stuff" for nfscl_loadattrcache().
Future commits will do the same for other functions.
This commit is contained in:
Rick Macklem 2022-04-13 07:43:13 -07:00
parent 033718abc8
commit 4ad3423bc2
5 changed files with 50 additions and 66 deletions

View File

@ -1006,8 +1006,7 @@ MALLOC_DECLARE(M_NEWNFSDSESSION);
/*
* Prototypes for functions where the arguments vary for different ports.
*/
int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *,
int, int);
int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, int, int);
int newnfs_realign(struct mbuf **, int);
bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep);
void ncl_copy_vattr(struct vattr *dst, struct vattr *src);

View File

@ -433,7 +433,7 @@ ncl_copy_vattr(struct vattr *dst, struct vattr *src)
*/
int
nfscl_loadattrcache(struct vnode **vpp, struct nfsvattr *nap, void *nvaper,
void *stuff, int writeattr, int dontshrink)
int writeattr, int dontshrink)
{
struct vnode *vp = *vpp;
struct vattr *vap, *nvap = &nap->na_vattr, *vaper = nvaper;

View File

@ -4036,7 +4036,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
if (newvp != NULLVP) {
if (attr_ok)
error = nfscl_loadattrcache(&newvp,
&nfsva, NULL, NULL, 0, 0);
&nfsva, NULL, 0, 0);
if (error) {
if (unlocknewvp)
vput(newvp);

View File

@ -338,7 +338,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp)
nfsva.na_vattr.va_size = 512 * 1024;
}
}
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (!error) {
mtx_lock(&nmp->nm_mtx);
if (gotfsinfo || (nmp->nm_flag & NFSMNT_NFSV4))
@ -373,8 +373,7 @@ ncl_fsinfo(struct nfsmount *nmp, struct vnode *vp, struct ucred *cred,
error = nfsrpc_fsinfo(vp, &fs, cred, td, &nfsva, &attrflag, NULL);
if (!error) {
if (attrflag)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
mtx_lock(&nmp->nm_mtx);
nfscl_loadfsinfo(nmp, &fs);
mtx_unlock(&nmp->nm_mtx);
@ -1688,7 +1687,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
nfsva.na_vattr.va_size = 512 * 1024;
lease = 60;
}
(void) nfscl_loadattrcache(vpp, &nfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(vpp, &nfsva, NULL, 0, 1);
if ((argp->flags & NFSMNT_NFSV4) != 0) {
NFSCL_DEBUG(3, "lease=%d\n", (int)lease);
NFSLOCKCLSTATE();

View File

@ -409,7 +409,7 @@ nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td,
error = nfsrpc_accessrpc(vp, wmode, cred, td, &nfsva, &attrflag,
&rmode, NULL);
if (attrflag)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (!error) {
lrupos = 0;
NFSLOCKNODE(np);
@ -953,7 +953,7 @@ nfs_close(struct vop_close_args *ap)
if (!ret) {
np->n_change = nfsva.na_filerev;
(void) nfscl_loadattrcache(&vp, &nfsva, NULL,
NULL, 0, 0);
0, 0);
}
}
@ -1031,7 +1031,7 @@ nfs_getattr(struct vop_getattr_args *ap)
}
error = nfsrpc_getattr(vp, ap->a_cred, td, &nfsva, NULL);
if (!error)
error = nfscl_loadattrcache(&vp, &nfsva, vap, NULL, 0, 0);
error = nfscl_loadattrcache(&vp, &nfsva, vap, 0, 0);
if (!error) {
/*
* Get the local modify time for the case of a write
@ -1189,7 +1189,7 @@ nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
error = nfsrpc_setattr(vp, vap, NULL, cred, td, &nfsva, &attrflag,
NULL);
if (attrflag) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (ret && !error)
error = ret;
}
@ -1356,7 +1356,7 @@ nfs_lookup(struct vop_lookup_args *ap)
cnp->cn_cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
NULL, openmode);
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
if (error) {
if (newvp != NULLVP) {
vput(newvp);
@ -1435,8 +1435,7 @@ nfs_lookup(struct vop_lookup_args *ap)
}
NFSUNLOCKNODE(np);
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
*vpp = newvp;
cnp->cn_flags |= SAVENAME;
return (0);
@ -1478,15 +1477,13 @@ nfs_lookup(struct vop_lookup_args *ap)
if (error != 0)
return (error);
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
} else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) {
free(nfhp, M_NFSFH);
VREF(dvp);
newvp = dvp;
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
} else {
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
cnp->cn_lkflags);
@ -1510,8 +1507,7 @@ nfs_lookup(struct vop_lookup_args *ap)
}
NFSUNLOCKNODE(np);
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
else if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) &&
!(np->n_flag & NMODIFIED)) {
/*
@ -1582,7 +1578,7 @@ ncl_readlinkrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
error = nfsrpc_readlink(vp, uiop, cred, uiop->uio_td, &nfsva,
&attrflag, NULL);
if (attrflag) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (ret && !error)
error = ret;
}
@ -1613,7 +1609,7 @@ ncl_readrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
error = nfsrpc_read(vp, uiop, cred, uiop->uio_td, &nfsva,
&attrflag, NULL);
if (attrflag) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (ret && !error)
error = ret;
}
@ -1646,11 +1642,9 @@ ncl_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
called_from_strategy);
if (attrflag) {
if (VTONFS(vp)->n_flag & ND_NFSV4)
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 1,
1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 1, 1);
else
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (ret && !error)
error = ret;
}
@ -1700,12 +1694,11 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
curthread, &np, NULL, LK_EXCLUSIVE);
}
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
if (!error) {
newvp = NFSTOV(np);
if (attrflag != 0) {
error = nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
error = nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
if (error != 0)
vput(newvp);
}
@ -1816,15 +1809,14 @@ nfs_create(struct vop_create_args *ap)
curthread, &np, NULL, LK_EXCLUSIVE);
}
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
if (!error) {
newvp = NFSTOV(np);
if (attrflag == 0)
error = nfsrpc_getattr(newvp, cnp->cn_cred,
curthread, &nfsva, NULL);
if (error == 0)
error = nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
error = nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
}
if (error) {
if (newvp != NULL) {
@ -1851,7 +1843,7 @@ nfs_create(struct vop_create_args *ap)
}
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL,
NULL, 0, 1);
0, 1);
if (error != 0)
vput(newvp);
}
@ -1984,7 +1976,7 @@ nfs_removerpc(struct vnode *dvp, struct vnode *vp, char *name,
NFSUNLOCKNODE(dnp);
}
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
NFSLOCKNODE(dnp);
dnp->n_flag |= NMODIFIED;
if (!dattrflag) {
@ -2164,7 +2156,7 @@ nfs_renamerpc(struct vnode *fdvp, struct vnode *fvp, char *fnameptr,
fdnp->n_flag |= NMODIFIED;
if (fattrflag != 0) {
NFSUNLOCKNODE(fdnp);
(void) nfscl_loadattrcache(&fdvp, &fnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&fdvp, &fnfsva, NULL, 0, 1);
} else {
fdnp->n_attrstamp = 0;
NFSUNLOCKNODE(fdnp);
@ -2174,7 +2166,7 @@ nfs_renamerpc(struct vnode *fdvp, struct vnode *fvp, char *fnameptr,
tdnp->n_flag |= NMODIFIED;
if (tattrflag != 0) {
NFSUNLOCKNODE(tdnp);
(void) nfscl_loadattrcache(&tdvp, &tnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&tdvp, &tnfsva, NULL, 0, 1);
} else {
tdnp->n_attrstamp = 0;
NFSUNLOCKNODE(tdnp);
@ -2213,14 +2205,14 @@ nfs_link(struct vop_link_args *ap)
tdnp->n_flag |= NMODIFIED;
if (dattrflag != 0) {
NFSUNLOCKNODE(tdnp);
(void) nfscl_loadattrcache(&tdvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&tdvp, &dnfsva, NULL, 0, 1);
} else {
tdnp->n_attrstamp = 0;
NFSUNLOCKNODE(tdnp);
KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(tdvp);
}
if (attrflag)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
else {
np = VTONFS(vp);
NFSLOCKNODE(np);
@ -2277,8 +2269,7 @@ nfs_symlink(struct vop_symlink_args *ap)
}
if (newvp != NULL) {
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
} else if (!error) {
/*
* If we do not have an error and we could not extract the
@ -2305,7 +2296,7 @@ nfs_symlink(struct vop_symlink_args *ap)
dnp->n_flag |= NMODIFIED;
if (dattrflag != 0) {
NFSUNLOCKNODE(dnp);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
} else {
dnp->n_attrstamp = 0;
NFSUNLOCKNODE(dnp);
@ -2356,7 +2347,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
dnp->n_flag |= NMODIFIED;
if (dattrflag != 0) {
NFSUNLOCKNODE(dnp);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
} else {
dnp->n_attrstamp = 0;
NFSUNLOCKNODE(dnp);
@ -2369,7 +2360,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
newvp = NFSTOV(np);
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL,
NULL, 0, 1);
0, 1);
} else if (!error)
error = ret;
}
@ -2433,7 +2424,7 @@ nfs_rmdir(struct vop_rmdir_args *ap)
dnp->n_flag |= NMODIFIED;
if (dattrflag != 0) {
NFSUNLOCKNODE(dnp);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
} else {
dnp->n_attrstamp = 0;
NFSUNLOCKNODE(dnp);
@ -2560,7 +2551,7 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
error = nfsrpc_readdir(vp, uiop, &cookie, cred, td, &nfsva,
&attrflag, &eof, NULL);
if (attrflag)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (!error) {
/*
@ -2623,7 +2614,7 @@ ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
error = nfsrpc_readdirplus(vp, uiop, &cookie, cred, td, &nfsva,
&attrflag, &eof, NULL);
if (attrflag)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (!error) {
/*
@ -2732,7 +2723,7 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred,
error = nfsrpc_lookup(dvp, name, len, cred, td, &dnfsva, &nfsva,
&nfhp, &attrflag, &dattrflag, NULL, 0);
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, 0, 1);
if (npp && !error) {
if (*npp != NULL) {
np = *npp;
@ -2814,8 +2805,7 @@ printf("replace=%s\n",nnn);
return (ENOENT);
}
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 1);
}
if (npp && *npp == NULL) {
if (error) {
@ -2871,8 +2861,7 @@ ncl_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred,
&attrflag, NULL);
}
if (attrflag != 0)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL,
0, 1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error != 0 && NFS_ISV4(vp))
error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
return (error);
@ -3808,7 +3797,7 @@ nfs_allocate(struct vop_allocate_args *ap)
error = EINVAL;
}
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -3906,7 +3895,7 @@ nfs_deallocate(struct vop_deallocate_args *ap)
NFSCL_DEBUG(4, "dealloc: stddeallocate=%d\n", error);
}
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -4040,11 +4029,10 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap)
&inattrflag, &innfsva, &outattrflag, &outnfsva,
ap->a_incred, consecutive, &must_commit);
if (inattrflag != 0)
ret = nfscl_loadattrcache(&invp, &innfsva, NULL, NULL,
0, 1);
ret = nfscl_loadattrcache(&invp, &innfsva, NULL, 0, 1);
if (outattrflag != 0)
ret2 = nfscl_loadattrcache(&outvp, &outnfsva, NULL,
NULL, 1, 1);
1, 1);
if (error == 0) {
if (consecutive == false) {
if (len2 == len) {
@ -4177,7 +4165,7 @@ nfs_ioctl(struct vop_ioctl_args *ap)
error = ENXIO;
}
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -4220,7 +4208,7 @@ nfs_getextattr(struct vop_getextattr_args *ap)
error = nfsrpc_getextattr(vp, ap->a_name, ap->a_uio, &len, &nfsva,
&attrflag, cred, td);
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -4279,7 +4267,7 @@ nfs_setextattr(struct vop_setextattr_args *ap)
error = nfsrpc_setextattr(vp, ap->a_name, ap->a_uio, &nfsva,
&attrflag, cred, td);
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -4344,8 +4332,7 @@ nfs_listextattr(struct vop_listextattr_args *ap)
error = nfsrpc_listextattr(vp, &cookie, ap->a_uio, &len, &eof,
&nfsva, &attrflag, cred, td);
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -4403,7 +4390,7 @@ nfs_deleteextattr(struct vop_deleteextattr_args *ap)
error = nfsrpc_rmextattr(vp, ap->a_name, &nfsva, &attrflag, ap->a_cred,
ap->a_td);
if (attrflag != 0) {
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
ret = nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error == 0 && ret != 0)
error = ret;
}
@ -4455,8 +4442,7 @@ nfs_pathconf(struct vop_pathconf_args *ap)
error = nfsrpc_pathconf(vp, &pc, td->td_ucred, td, &nfsva,
&attrflag, NULL);
if (attrflag != 0)
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
1);
(void) nfscl_loadattrcache(&vp, &nfsva, NULL, 0, 1);
if (error != 0)
return (error);
} else {
@ -4558,7 +4544,7 @@ nfs_pathconf(struct vop_pathconf_args *ap)
&attrflag);
if (attrflag != 0)
nfscl_loadattrcache(&vp, &nfsva,
NULL, NULL, 0, 1);
NULL, 0, 1);
mtx_lock(&nmp->nm_mtx);
if (error == NFSERR_NOTSUPP)
nmp->nm_privflag |= NFSMNTP_SEEKTESTED;