The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=194242604ae4644ced49fac03d9ddc6994ea9e95
commit 194242604ae4644ced49fac03d9ddc6994ea9e95 Author: Rick Macklem <rmack...@freebsd.org> AuthorDate: 2025-01-17 20:29:11 +0000 Commit: Rick Macklem <rmack...@freebsd.org> CommitDate: 2025-01-17 20:29:11 +0000 nfscl: Simplify the deleg argument for nfscl_deleg() The deleg argument to nfscl_deleg() is a "struct nfscldeleg **" although the returned pointer value is never used by callers. This patch changes the argument to "struct nfscldeleg *" to simplify the call and avoid any confusion w.r.t. use of the returned value. This patch should not create any NFS semantics change. --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 6 +++--- sys/fs/nfsclient/nfs_clstate.c | 10 +++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 950e0c097457..00d5b914f4af 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -606,7 +606,7 @@ int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *); int nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *, bool, bool); int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int, - struct ucred *, NFSPROC_T *, struct nfscldeleg **); + struct ucred *, NFSPROC_T *, struct nfscldeleg *); void nfscl_lockinit(struct nfsv4lock *); void nfscl_lockexcl(struct nfsv4lock *, void *); void nfscl_lockunlock(struct nfsv4lock *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index c35d0c6295b9..07f046a82d8b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -452,7 +452,7 @@ nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p) NFSUNLOCKNODE(np); (void) nfscl_deleg(nmp->nm_mountp, op->nfso_own->nfsow_clp, - nfhp->nfh_fh, nfhp->nfh_len, cred, p, &dp); + nfhp->nfh_fh, nfhp->nfh_len, cred, p, dp); } } else if (NFSHASNFSV4N(nmp)) { /* @@ -485,7 +485,7 @@ nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p) NFSUNLOCKNODE(np); (void) nfscl_deleg(nmp->nm_mountp, op->nfso_own->nfsow_clp, - nfhp->nfh_fh, nfhp->nfh_len, cred, p, &dp); + nfhp->nfh_fh, nfhp->nfh_len, cred, p, dp); } } else { error = EIO; @@ -2511,7 +2511,7 @@ nfsrpc_create(vnode_t dvp, char *name, int namelen, struct vattr *vap, */ if (dp != NULL) (void) nfscl_deleg(nmp->nm_mountp, owp->nfsow_clp, - (*nfhpp)->nfh_fh, (*nfhpp)->nfh_len, cred, p, &dp); + (*nfhpp)->nfh_fh, (*nfhpp)->nfh_len, cred, p, dp); nfscl_ownerrelease(nmp, owp, error, newone, unlocked); if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID || error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 0a1eb51e279f..8a82fe77690e 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -432,9 +432,9 @@ nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp, */ int nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, - int fhlen, struct ucred *cred, NFSPROC_T *p, struct nfscldeleg **dpp) + int fhlen, struct ucred *cred, NFSPROC_T *p, struct nfscldeleg *dp) { - struct nfscldeleg *dp = *dpp, *tdp; + struct nfscldeleg *tdp; struct nfsmount *nmp; KASSERT(mp != NULL, ("nfscl_deleg: mp NULL")); @@ -457,7 +457,6 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, NFSUNLOCKCLSTATE(); return (NFSERR_BADSTATEID); } - *dpp = NULL; TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, nfsdl_list); LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, fhlen), dp, nfsdl_hash); @@ -475,18 +474,15 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, (tdp->nfsdl_flags & NFSCLDL_READ) != 0) { TAILQ_REMOVE(&clp->nfsc_deleg, tdp, nfsdl_list); LIST_REMOVE(tdp, nfsdl_hash); - *dpp = NULL; TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, nfsdl_list); LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, fhlen), dp, nfsdl_hash); dp->nfsdl_timestamp = NFSD_MONOSEC + 120; } else { - *dpp = NULL; tdp = dp; /* Return this one. */ } } else { - *dpp = tdp; tdp = NULL; } } @@ -1637,7 +1633,7 @@ nfscl_expireopen(struct nfsclclient *clp, struct nfsclopen *op, } if (dp != NULL) nfscl_deleg(nmp->nm_mountp, clp, op->nfso_fh, - op->nfso_fhlen, cred, p, &dp); + op->nfso_fhlen, cred, p, dp); } /*