git: 746974c0617c - main - nfscl: Clean up the code by not using the vnode_vtype() macro

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Thu, 23 Jun 2022 23:15:02 UTC
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=746974c0617cbdba650c8e04c378778d2e4935f8

commit 746974c0617cbdba650c8e04c378778d2e4935f8
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-06-23 23:13:12 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-06-23 23:13:12 +0000

    nfscl: Clean up the code by not using the vnode_vtype() macro
    
    The vnode_vtype() macro was used to make the code compatible
    with Mac OSX, for the Mac OSX port.
    For FreeBSD, this macro just obscured the code, so
    avoid using it to clean up the code.
    
    This commit should not result in a semantics change.
---
 sys/fs/nfsclient/nfs_clrpcops.c | 12 ++++++------
 sys/fs/nfsclient/nfs_clstate.c  |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index bf4cbe88af95..d48f1887a5a9 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -265,7 +265,7 @@ nfsrpc_access(vnode_t vp, int acmode, struct ucred *cred,
 		mode = NFSACCESS_READ;
 	else
 		mode = 0;
-	if (vnode_vtype(vp) == VDIR) {
+	if (vp->v_type == VDIR) {
 		if (acmode & VWRITE)
 			mode |= (NFSACCESS_MODIFY | NFSACCESS_EXTEND |
 				 NFSACCESS_DELETE);
@@ -370,7 +370,7 @@ nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p)
 	/*
 	 * For NFSv4, Open Ops are only done on Regular Files.
 	 */
-	if (vnode_vtype(vp) != VREG)
+	if (vp->v_type != VREG)
 		return (0);
 	mode = 0;
 	if (amode & FREAD)
@@ -742,7 +742,7 @@ nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p)
 	struct nfsclclient *clp;
 	int error;
 
-	if (vnode_vtype(vp) != VREG)
+	if (vp->v_type != VREG)
 		return (0);
 	if (doclose)
 		error = nfscl_doclose(vp, &clp, p);
@@ -1288,7 +1288,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr *vap, NFSACL_T *aclp,
 			nfhp = VTONFS(vp)->n_fhp;
 			error = nfscl_getstateid(vp, nfhp->nfh_fh,
 			    nfhp->nfh_len, mode, 0, cred, p, &stateid, &lckp);
-			if (error && vnode_vtype(vp) == VREG &&
+			if (error && vp->v_type == VREG &&
 			    (mode == NFSV4OPEN_ACCESSWRITE ||
 			     nfstest_openallsetattr)) {
 				/*
@@ -1359,7 +1359,7 @@ nfsrpc_setattrrpc(vnode_t vp, struct vattr *vap,
 	NFSCL_REQSTART(nd, NFSPROC_SETATTR, vp);
 	if (nd->nd_flag & ND_NFSV4)
 		nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
-	vap->va_type = vnode_vtype(vp);
+	vap->va_type = vp->v_type;
 	nfscl_fillsattr(nd, vap, vp, NFSSATTR_FULL, 0);
 	if (nd->nd_flag & ND_NFSV3) {
 		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
@@ -1407,7 +1407,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct ucred *cred,
 
 	*attrflagp = 0;
 	*dattrflagp = 0;
-	if (vnode_vtype(dvp) != VDIR)
+	if (dvp->v_type != VDIR)
 		return (ENOTDIR);
 	nmp = VFSTONFS(dvp->v_mount);
 	if (len > NFS_MAXNAMLEN)
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 10ce1296f652..41ebbe8213c5 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -543,7 +543,7 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode,
 		stateidp->other[1] = 0;
 		stateidp->other[2] = 0;
 	}
-	if (vnode_vtype(vp) != VREG)
+	if (vp->v_type != VREG)
 		return (EISDIR);
 	np = VTONFS(vp);
 	nmp = VFSTONFS(vp->v_mount);