Date: Sat, 27 Sep 2025 04:01:11 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 01c8e2e33df8 - main - vfs: retire the NULLVP macro Message-ID: <202509270401.58R41BlL014863@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=01c8e2e33df81b242d73a23de49a6b61f33c24c1 commit 01c8e2e33df81b242d73a23de49a6b61f33c24c1 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2025-09-27 02:07:04 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2025-09-27 04:00:59 +0000 vfs: retire the NULLVP macro The kernel was already mostly using plain NULL, just whack it and be doen with the legacy. Churn generated with coccinelle: @@ @@ - NULLVP + NULL --- sys/fs/cd9660/cd9660_vfsops.c | 8 +- sys/fs/devfs/devfs_vnops.c | 2 +- sys/fs/ext2fs/ext2_vfsops.c | 4 +- sys/fs/fdescfs/fdesc_vnops.c | 6 +- sys/fs/fuse/fuse_vfsops.c | 4 +- sys/fs/msdosfs/msdosfs_vfsops.c | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 6 +- sys/fs/nfsclient/nfs_clvnops.c | 14 +- sys/fs/nullfs/null_subr.c | 6 +- sys/fs/nullfs/null_vnops.c | 8 +- sys/fs/p9fs/p9fs_vfsops.c | 10 +- sys/fs/p9fs/p9fs_vnops.c | 6 +- sys/fs/pseudofs/pseudofs_vncache.c | 2 +- sys/fs/smbfs/smbfs_vnops.c | 4 +- sys/fs/tarfs/tarfs_vfsops.c | 6 +- sys/fs/tarfs/tarfs_vnops.c | 4 +- sys/fs/tmpfs/tmpfs_vnops.c | 4 +- sys/fs/udf/udf_vfsops.c | 4 +- sys/fs/unionfs/union_subr.c | 106 ++++++------- sys/fs/unionfs/union_vfsops.c | 6 +- sys/fs/unionfs/union_vnops.c | 304 ++++++++++++++++++------------------- sys/kern/uipc_mqueue.c | 2 +- sys/kern/vfs_lookup.c | 2 +- sys/kern/vfs_mountroot.c | 2 +- sys/kern/vfs_syscalls.c | 2 +- sys/sys/vnode.h | 2 - sys/ufs/ffs/ffs_softdep.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 2 +- sys/ufs/ufs/ufs_quota.c | 38 ++--- 29 files changed, 283 insertions(+), 285 deletions(-) diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index b4db4c4f7331..ce6d03b73290 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -617,13 +617,13 @@ cd9660_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) #endif if ((error = VFS_VGET(mp, ifh.ifid_ino, LK_EXCLUSIVE, &nvp)) != 0) { - *vpp = NULLVP; + *vpp = NULL; return (error); } ip = VTOI(nvp); if (ip->inode.iso_mode == 0) { vput(nvp); - *vpp = NULLVP; + *vpp = NULL; return (ESTALE); } *vpp = nvp; @@ -704,7 +704,7 @@ cd9660_vget_internal(struct mount *mp, ino_t ino, int flags, /* Allocate a new vnode/iso_node. */ if ((error = getnewvnode("isofs", mp, &cd9660_vnodeops, &vp)) != 0) { - *vpp = NULLVP; + *vpp = NULL; return (error); } ip = malloc(sizeof(struct iso_node), M_ISOFSNODE, @@ -717,7 +717,7 @@ cd9660_vget_internal(struct mount *mp, ino_t ino, int flags, error = insmntque(vp, mp); if (error != 0) { free(ip, M_ISOFSNODE); - *vpp = NULLVP; + *vpp = NULL; return (error); } error = vfs_hash_insert(vp, ino, flags, td, vpp, cd9660_vfs_hash_cmp, diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 3a64c205186f..590e04ac9aa5 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1061,7 +1061,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock) mp = dvp->v_mount; dmp = VFSTODEVFS(mp); dd = dvp->v_data; - *vpp = NULLVP; + *vpp = NULL; if ((flags & ISLASTCN) && nameiop == RENAME) return (EOPNOTSUPP); diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 9e7a03fffd71..0f3808a7c747 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -1334,14 +1334,14 @@ ext2_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) error = VFS_VGET(mp, ufhp->ufid_ino, LK_EXCLUSIVE, &nvp); if (error) { - *vpp = NULLVP; + *vpp = NULL; return (error); } ip = VTOI(nvp); if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen || ip->i_nlink <= 0) { vput(nvp); - *vpp = NULLVP; + *vpp = NULL; return (ESTALE); } *vpp = nvp; diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 58a22b8bdc50..3014136fcbdb 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -196,7 +196,7 @@ loop: if (error != 0) { vgone(vp); vput(vp); - *vpp = NULLVP; + *vpp = NULL; return (error); } @@ -211,7 +211,7 @@ loop: mtx_unlock(&fdesc_hashmtx); vgone(vp); vput(vp); - *vpp = NULLVP; + *vpp = NULL; return (-1); } @@ -227,7 +227,7 @@ loop: vput(vp); /* If we didn't get it, return no vnode. */ if (error) - vp2 = NULLVP; + vp2 = NULL; *vpp = vp2; return (error); } diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c index 1b858a988289..b617925c4e5f 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -278,13 +278,13 @@ fuse_vfsop_fhtovp(struct mount *mp, struct fid *fhp, int flags, error = VFS_VGET(mp, ffhp->nid, LK_EXCLUSIVE, &nvp); if (error) { - *vpp = NULLVP; + *vpp = NULL; return (error); } fvdat = VTOFUD(nvp); if (fvdat->generation != ffhp->gen ) { vput(nvp); - *vpp = NULLVP; + *vpp = NULL; return (ESTALE); } *vpp = nvp; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 4431d36c8a8e..30c63cfa8a35 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -1184,7 +1184,7 @@ msdosfs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) error = deget(pmp, defhp->defid_dirclust, defhp->defid_dirofs, LK_EXCLUSIVE, &dep); if (error) { - *vpp = NULLVP; + *vpp = NULL; return (error); } *vpp = DETOV(dep); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 4ec621de2eff..6c2e35713287 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3981,7 +3981,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, int len, left; struct dirent *dp = NULL; u_int32_t *tl; - vnode_t newvp = NULLVP; + vnode_t newvp = NULL; struct nfsrv_descript nfsd, *nd = &nfsd; struct nameidata nami, *ndp = &nami; struct componentname *cnp = &ndp->ni_cnd; @@ -4436,7 +4436,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, } } nfhp = NULL; - if (newvp != NULLVP) { + if (newvp != NULL) { if (attr_ok) error = nfscl_loadattrcache(&newvp, &nfsva, NULL, 0, 0); @@ -4466,7 +4466,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, vput(newvp); else vrele(newvp); - newvp = NULLVP; + newvp = NULL; } } } else if (nfhp != NULL) { diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index eee571a04821..683d6099401e 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1284,7 +1284,7 @@ nfs_lookup(struct vop_lookup_args *ap) bool is_nameddir, needs_nameddir, opennamed; dattrflag = 0; - *vpp = NULLVP; + *vpp = NULL; nmp = VFSTONFS(mp); opennamed = (flags & (OPENNAMED | ISLASTCN)) == (OPENNAMED | ISLASTCN); if (opennamed && (!NFSHASNFSV4(nmp) || !NFSHASNFSV4N(nmp))) @@ -1309,7 +1309,7 @@ nfs_lookup(struct vop_lookup_args *ap) /* * If the named attribute directory is needed, acquire it now. */ - newvp = NULLVP; + newvp = NULL; if (needs_nameddir) { KASSERT(np->n_v4 == NULL, ("nfs_lookup: O_NAMEDATTR when" " n_v4 not NULL")); @@ -1322,7 +1322,7 @@ nfs_lookup(struct vop_lookup_args *ap) } dvp = newvp; np = VTONFS(dvp); - newvp = NULLVP; + newvp = NULL; } else if (opennamed && cnp->cn_namelen == 1 && *cnp->cn_nameptr == '.') { VREF(dvp); @@ -1399,7 +1399,7 @@ nfs_lookup(struct vop_lookup_args *ap) vput(newvp); else vrele(newvp); - *vpp = NULLVP; + *vpp = NULL; } else if (error == ENOENT) { if (VN_IS_DOOMED(dvp)) return (ENOENT); @@ -1450,7 +1450,7 @@ nfs_lookup(struct vop_lookup_args *ap) NFSUNLOCKMNT(nmp); #endif - newvp = NULLVP; + newvp = NULL; NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses); nanouptime(&ts); error = nfsrpc_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen, @@ -1464,9 +1464,9 @@ nfs_lookup(struct vop_lookup_args *ap) } handle_error: if (error) { - if (newvp != NULLVP) { + if (newvp != NULL) { vput(newvp); - *vpp = NULLVP; + *vpp = NULL; } if (error != ENOENT) { diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index 7dcc83880bb9..053614b6910d 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -119,7 +119,7 @@ null_hashget_locked(struct mount *mp, struct vnode *lowervp) return (vp); } } - return (NULLVP); + return (NULL); } struct vnode * @@ -130,7 +130,7 @@ null_hashget(struct mount *mp, struct vnode *lowervp) hd = NULL_NHASH(lowervp); if (LIST_EMPTY(hd)) - return (NULLVP); + return (NULL); rw_rlock(&null_hash_lock); vp = null_hashget_locked(mp, lowervp); @@ -298,7 +298,7 @@ null_checkvp(struct vnode *vp, char *fil, int lno) panic("null_checkvp"); } #endif - if (a->null_lowervp == NULLVP) { + if (a->null_lowervp == NULL) { /* Should never happen */ panic("null_checkvp %p", vp); } diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index ba29b0485326..8f25a7c4ca70 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -273,9 +273,9 @@ null_bypass(struct vop_generic_args *ap) * are of our type. Check for and don't map any * that aren't. (We must always map first vp or vclean fails.) */ - if (i != 0 && (*this_vp_p == NULLVP || - (*this_vp_p)->v_op != &null_vnodeops)) { - old_vps[i] = NULLVP; + if (i != 0 && (*this_vp_p == NULL || + (*this_vp_p)->v_op != &null_vnodeops)) { + old_vps[i] = NULL; } else { old_vps[i] = *this_vp_p; *(vps_p[i]) = NULLVPTOLOWERVP(*this_vp_p); @@ -336,7 +336,7 @@ null_bypass(struct vop_generic_args *ap) * must move lock ownership from lower to * upper (reclaimed) vnode. */ - if (lvp != NULLVP) { + if (lvp != NULL) { null_copy_inotify(old_vps[i], lvp, VIRF_INOTIFY); null_copy_inotify(old_vps[i], lvp, diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c index e0e91e7e1709..953e6eda547a 100644 --- a/sys/fs/p9fs/p9fs_vfsops.c +++ b/sys/fs/p9fs/p9fs_vfsops.c @@ -287,7 +287,7 @@ p9fs_vget_common(struct mount *mp, struct p9fs_node *np, int flags, node->flags |= P9FS_NODE_DELETED; vput(vp); - *vpp = NULLVP; + *vpp = NULL; vp = NULL; } else { *vpp = vp; @@ -308,7 +308,7 @@ p9fs_vget_common(struct mount *mp, struct p9fs_node *np, int flags, /* Allocate a new vnode. */ if ((error = getnewvnode("p9fs", mp, &p9fs_vnops, &vp)) != 0) { - *vpp = NULLVP; + *vpp = NULL; P9_DEBUG(ERROR, "%s: getnewvnode failed: %d\n", __func__, error); return (error); } @@ -397,7 +397,7 @@ out: vput(vp); } - *vpp = NULLVP; + *vpp = NULL; return (error); } @@ -525,14 +525,14 @@ p9fs_root(struct mount *mp, int lkflags, struct vnode **vpp) if (vfid == NULL && clnt->trans_status == P9FS_BEGIN_DISCONNECT) vfid = vmp->p9fs_session.mnt_fid; else { - *vpp = NULLVP; + *vpp = NULL; return (error); } } error = p9fs_vget_common(mp, np, lkflags, np, vfid, vpp, NULL); if (error != 0) { - *vpp = NULLVP; + *vpp = NULL; return (error); } np->v_node = *vpp; diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index acb73973d93b..2ed1be82b57f 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -233,7 +233,7 @@ p9fs_lookup(struct vop_lookup_args *ap) dnp = P9FS_VTON(dvp); error = 0; flags = cnp->cn_flags; - *vpp = NULLVP; + *vpp = NULL; if (dnp == NULL) return (ENOENT); @@ -329,7 +329,7 @@ p9fs_lookup(struct vop_lookup_args *ap) else vrele(vp); - *vpp = NULLVP; + *vpp = NULL; } else if (error == ENOENT) { if (VN_IS_DOOMED(dvp)) goto out; @@ -341,7 +341,7 @@ p9fs_lookup(struct vop_lookup_args *ap) } /* Reset values */ error = 0; - vp = NULLVP; + vp = NULL; tmpchr = cnp->cn_nameptr[cnp->cn_namelen]; cnp->cn_nameptr[cnp->cn_namelen] = '\0'; diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index e58aced7f81b..4fd493f8b9d3 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -202,7 +202,7 @@ alloc: error = insmntque(*vpp, mp); if (error != 0) { free(pvd, M_PFSVNCACHE); - *vpp = NULLVP; + *vpp = NULL; return (error); } vn_set_state(*vpp, VSTATE_CONSTRUCTED); diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 63b249c93771..a97bc22b3aca 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -1121,13 +1121,13 @@ smbfs_lookup(struct vop_lookup_args *ap) vput(vp); else vrele(vp); - *vpp = NULLVP; + *vpp = NULL; } /* * entry is not in the cache or has been expired */ error = 0; - *vpp = NULLVP; + *vpp = NULL; scred = smbfs_malloc_scred(); smb_makescred(scred, td, cnp->cn_cred); fap = &fattr; diff --git a/sys/fs/tarfs/tarfs_vfsops.c b/sys/fs/tarfs/tarfs_vfsops.c index a534b18ebf34..4cc70e4d5781 100644 --- a/sys/fs/tarfs/tarfs_vfsops.c +++ b/sys/fs/tarfs/tarfs_vfsops.c @@ -1201,7 +1201,7 @@ tarfs_vget(struct mount *mp, ino_t ino, int lkflags, struct vnode **vpp) return (0); bad: - *vpp = NULLVP; + *vpp = NULL; return (error); } @@ -1220,7 +1220,7 @@ tarfs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) error = VFS_VGET(mp, tfp->ino, LK_EXCLUSIVE, &nvp); if (error != 0) { - *vpp = NULLVP; + *vpp = NULL; return (error); } tnp = VP_TO_TARFS_NODE(nvp); @@ -1228,7 +1228,7 @@ tarfs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) tnp->gen != tfp->gen || tnp->nlink <= 0) { vput(nvp); - *vpp = NULLVP; + *vpp = NULL; return (ESTALE); } *vpp = nvp; diff --git a/sys/fs/tarfs/tarfs_vnops.c b/sys/fs/tarfs/tarfs_vnops.c index c110107bb210..b0921909b3b4 100644 --- a/sys/fs/tarfs/tarfs_vnops.c +++ b/sys/fs/tarfs/tarfs_vnops.c @@ -231,7 +231,7 @@ tarfs_lookup(struct vop_cachedlookup_args *ap) vpp = ap->a_vpp; cnp = ap->a_cnp; - *vpp = NULLVP; + *vpp = NULL; dirnode = VP_TO_TARFS_NODE(dvp); parent = dirnode->parent; tmp = dirnode->tmp; @@ -585,7 +585,7 @@ tarfs_reclaim(struct vop_reclaim_args *ap) vfs_hash_remove(vp); TARFS_NODE_LOCK(tnp); - tnp->vnode = NULLVP; + tnp->vnode = NULL; vp->v_data = NULL; TARFS_NODE_UNLOCK(tnp); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 0f4ea2fdc28c..312d2e717e63 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -98,7 +98,7 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) /* Caller assumes responsibility for ensuring access (VEXEC). */ dnode = VP_TO_TMPFS_DIR(dvp); - *vpp = NULLVP; + *vpp = NULL; /* We cannot be requesting the parent directory of the root node. */ MPASS(IMPLIES(dnode->tn_type == VDIR && @@ -222,7 +222,7 @@ out: * locked. */ if (error == 0) { - MPASS(*vpp != NULLVP); + MPASS(*vpp != NULL); ASSERT_VOP_LOCKED(*vpp, __func__); } else { MPASS(*vpp == NULL); diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index c5ef1f686093..c1627285a174 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -736,14 +736,14 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) ifhp = (struct ifid *)fhp; if ((error = VFS_VGET(mp, ifhp->ifid_ino, LK_EXCLUSIVE, &nvp)) != 0) { - *vpp = NULLVP; + *vpp = NULL; return (error); } np = VTON(nvp); fsize = le64toh(np->fentry->inf_len); if (fsize > OFF_MAX) { - *vpp = NULLVP; + *vpp = NULL; return (EIO); } diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index edcc6716b674..a14f9ca74305 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -160,7 +160,7 @@ unionfs_get_cached_vnode_locked(struct vnode *lookup, struct vnode *dvp) if (VN_IS_DOOMED(vp) || ((vp->v_iflag & VI_DOINGINACT) != 0)) { VI_UNLOCK(vp); - vp = NULLVP; + vp = NULL; } else { vrefl(vp); VI_UNLOCK(vp); @@ -169,7 +169,7 @@ unionfs_get_cached_vnode_locked(struct vnode *lookup, struct vnode *dvp) } } - return (NULLVP); + return (NULL); } @@ -182,11 +182,11 @@ unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp, { struct vnode *vp; - vp = NULLVP; + vp = NULL; VI_LOCK(dvp); - if (uvp != NULLVP) + if (uvp != NULL) vp = unionfs_get_cached_vnode_locked(uvp, dvp); - else if (lvp != NULLVP) + else if (lvp != NULL) vp = unionfs_get_cached_vnode_locked(lvp, dvp); VI_UNLOCK(dvp); @@ -203,22 +203,22 @@ unionfs_ins_cached_vnode(struct unionfs_node *uncp, struct unionfs_node_hashhead *hd; struct vnode *vp; - vp = NULLVP; + vp = NULL; VI_LOCK(dvp); - if (uncp->un_uppervp != NULLVP) { + if (uncp->un_uppervp != NULL) { ASSERT_VOP_ELOCKED(uncp->un_uppervp, __func__); KASSERT(uncp->un_uppervp->v_type == VDIR, ("%s: v_type != VDIR", __func__)); vp = unionfs_get_cached_vnode_locked(uncp->un_uppervp, dvp); - } else if (uncp->un_lowervp != NULLVP) { + } else if (uncp->un_lowervp != NULL) { ASSERT_VOP_ELOCKED(uncp->un_lowervp, __func__); KASSERT(uncp->un_lowervp->v_type == VDIR, ("%s: v_type != VDIR", __func__)); vp = unionfs_get_cached_vnode_locked(uncp->un_lowervp, dvp); } - if (vp == NULLVP) { - hd = unionfs_get_hashhead(dvp, (uncp->un_uppervp != NULLVP ? - uncp->un_uppervp : uncp->un_lowervp)); + if (vp == NULL) { + hd = unionfs_get_hashhead(dvp, (uncp->un_uppervp != NULL ? + uncp->un_uppervp : uncp->un_lowervp)); LIST_INSERT_HEAD(hd, uncp, un_hash); } VI_UNLOCK(dvp); @@ -233,8 +233,8 @@ static void unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp) { KASSERT(unp != NULL, ("%s: null node", __func__)); - KASSERT(dvp != NULLVP, - ("%s: null parent vnode", __func__)); + KASSERT(dvp != NULL, + ("%s: null parent vnode", __func__)); VI_LOCK(dvp); if (unp->un_hash.le_prev != NULL) { @@ -274,13 +274,13 @@ unionfs_nodeget_cleanup(struct vnode *vp, struct unionfs_node *unp) vgone(vp); vput(vp); - if (unp->un_dvp != NULLVP) + if (unp->un_dvp != NULL) vrele(unp->un_dvp); - if (unp->un_uppervp != NULLVP) { + if (unp->un_uppervp != NULL) { vput(unp->un_uppervp); - if (unp->un_lowervp != NULLVP) + if (unp->un_lowervp != NULL) vrele(unp->un_lowervp); - } else if (unp->un_lowervp != NULLVP) + } else if (unp->un_lowervp != NULL) vput(unp->un_lowervp); if (unp->un_hashtbl != NULL) hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, UNIONFSHASHMASK); @@ -313,21 +313,21 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, ump = MOUNTTOUNIONFSMOUNT(mp); lkflags = (cnp ? cnp->cn_lkflags : 0); path = (cnp ? cnp->cn_nameptr : NULL); - *vpp = NULLVP; + *vpp = NULL; - if (uppervp == NULLVP && lowervp == NULLVP) + if (uppervp == NULL && lowervp == NULL) panic("%s: upper and lower are both null", __func__); - vt = (uppervp != NULLVP ? uppervp->v_type : lowervp->v_type); + vt = (uppervp != NULL ? uppervp->v_type : lowervp->v_type); /* If it has no ISLASTCN flag, path check is skipped. */ if (cnp && !(cnp->cn_flags & ISLASTCN)) path = NULL; /* check the cache */ - if (dvp != NULLVP && vt == VDIR) { + if (dvp != NULL && vt == VDIR) { vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp); - if (vp != NULLVP) { + if (vp != NULL) { *vpp = vp; if (lkflags != 0) vn_lock(*vpp, lkflags | LK_RETRY); @@ -343,11 +343,11 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, free(unp, M_UNIONFSNODE); return (error); } - if (dvp != NULLVP) + if (dvp != NULL) vref(dvp); - if (uppervp != NULLVP) + if (uppervp != NULL) vref(uppervp); - if (lowervp != NULLVP) + if (lowervp != NULL) vref(lowervp); if (vt == VDIR) { @@ -361,7 +361,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, unp->un_uppervp = uppervp; unp->un_lowervp = lowervp; unp->un_dvp = dvp; - if (uppervp != NULLVP) + if (uppervp != NULL) vp->v_vnlock = uppervp->v_vnlock; else vp->v_vnlock = lowervp->v_vnlock; @@ -407,7 +407,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, * possibility of deadlock due to some other agent on the system * attempting to lock those two specific vnodes in the opposite order. */ - if (uppervp != NULLVP) + if (uppervp != NULL) vn_lock(uppervp, LK_EXCLUSIVE | LK_RETRY); else vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY); @@ -426,16 +426,16 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, * blocked on our vnode lock, effectively also preventing unmount * of the underlying filesystems. */ - VNASSERT(lowervp == NULLVP || !VN_IS_DOOMED(lowervp), vp, + VNASSERT(lowervp == NULL || !VN_IS_DOOMED(lowervp), vp, ("%s: doomed lowervp %p", __func__, lowervp)); - VNASSERT(uppervp == NULLVP || !VN_IS_DOOMED(uppervp), vp, + VNASSERT(uppervp == NULL || !VN_IS_DOOMED(uppervp), vp, ("%s: doomed lowervp %p", __func__, uppervp)); vn_set_state(vp, VSTATE_CONSTRUCTED); - if (dvp != NULLVP && vt == VDIR) + if (dvp != NULL && vt == VDIR) *vpp = unionfs_ins_cached_vnode(unp, dvp); - if (*vpp != NULLVP) { + if (*vpp != NULL) { unionfs_nodeget_cleanup(vp, unp); if (lkflags != 0) vn_lock(*vpp, lkflags | LK_RETRY); @@ -484,7 +484,7 @@ unionfs_noderem(struct vnode *vp) lvp = unp->un_lowervp; uvp = unp->un_uppervp; dvp = unp->un_dvp; - unlock_lvp = (uvp == NULLVP); + unlock_lvp = (uvp == NULL); /* * Lock the lower vnode in addition to the upper vnode lock in order @@ -496,7 +496,7 @@ unionfs_noderem(struct vnode *vp) * Moreover, during unmount of a non-"below" unionfs mount, the lower * root vnode will already be locked as it is the covered vnode. */ - if (uvp != NULLVP && lvp != NULLVP && (vp->v_vflag & VV_ROOT) == 0) { + if (uvp != NULL && lvp != NULL && (vp->v_vflag & VV_ROOT) == 0) { vn_lock_pair(uvp, true, LK_EXCLUSIVE, lvp, false, LK_EXCLUSIVE); unlock_lvp = true; } @@ -508,7 +508,7 @@ unionfs_noderem(struct vnode *vp) * prevent faults in unionfs_lock(). */ VI_LOCK(vp); - unp->un_lowervp = unp->un_uppervp = NULLVP; + unp->un_lowervp = unp->un_uppervp = NULL; vp->v_vnlock = &(vp->v_lock); vp->v_data = NULL; vp->v_object = NULL; @@ -543,14 +543,14 @@ unionfs_noderem(struct vnode *vp) ("%s: write reference without upper vnode", __func__)); VOP_ADD_WRITECOUNT(uvp, -writerefs); } - if (uvp != NULLVP) + if (uvp != NULL) vput(uvp); if (unlock_lvp) vput(lvp); - else if (lvp != NULLVP) + else if (lvp != NULL) vrele(lvp); - if (dvp != NULLVP) + if (dvp != NULL) unionfs_rem_cached_vnode(unp, dvp); if (unp->un_path != NULL) { @@ -567,7 +567,7 @@ unionfs_noderem(struct vnode *vp) LIST_REMOVE(unsp, uns_list); free(unsp, M_TEMP); } - if (dvp != NULLVP) { + if (dvp != NULL) { mtx_lock(&unionfs_deferred_rele_lock); STAILQ_INSERT_TAIL(&unionfs_deferred_rele_list, unp, un_rele); mtx_unlock(&unionfs_deferred_rele_lock); @@ -793,7 +793,7 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, /* * Re-cache the unionfs vnode against the upper vnode */ - if (dvp != NULLVP && vp->v_type == VDIR) { + if (dvp != NULL && vp->v_type == VDIR) { VI_LOCK(dvp); if (unp->un_hash.le_prev != NULL) { LIST_REMOVE(unp, un_hash); @@ -841,7 +841,7 @@ unionfs_set_in_progress_flag(struct vnode *vp, unsigned int flag) if (unp == NULL) error = ENOENT; else if (flag == UNIONFS_COPY_IN_PROGRESS && - unp->un_uppervp != NULLVP) + unp->un_uppervp != NULL) error = EJUSTRETURN; else if (flag == UNIONFS_LOOKUP_IN_PROGRESS) error = ERELOOKUP; @@ -902,7 +902,7 @@ unionfs_mkshadowdir(struct vnode *dvp, struct vnode *vp, ASSERT_VOP_ELOCKED(vp, __func__); ump = MOUNTTOUNIONFSMOUNT(vp->v_mount); unp = VTOUNIONFS(vp); - if (unp->un_uppervp != NULLVP) + if (unp->un_uppervp != NULL) return (EEXIST); dunp = VTOUNIONFS(dvp); udvp = dunp->un_uppervp; @@ -914,7 +914,7 @@ unionfs_mkshadowdir(struct vnode *dvp, struct vnode *vp, return (error); lvp = unp->un_lowervp; - uvp = NULLVP; + uvp = NULL; credbk = cnp->cn_cred; /* Authority change to root */ @@ -953,7 +953,7 @@ unionfs_mkshadowdir(struct vnode *dvp, struct vnode *vp, vput(udvp); goto unionfs_mkshadowdir_relock; } - if (uvp != NULLVP) { + if (uvp != NULL) { if (udvp == uvp) vrele(uvp); else @@ -1218,7 +1218,7 @@ unionfs_mkwhiteout(struct vnode *dvp, struct vnode *vp, ASSERT_VOP_ELOCKED(vp, __func__); udvp = VTOUNIONFS(dvp)->un_uppervp; - wvp = NULLVP; + wvp = NULL; NDPREINIT(&nd); vref(udvp); VOP_UNLOCK(vp); @@ -1226,7 +1226,7 @@ unionfs_mkwhiteout(struct vnode *dvp, struct vnode *vp, pathlen, CREATE))) { goto unionfs_mkwhiteout_cleanup; } - if (wvp != NULLVP) { + if (wvp != NULL) { if (udvp == wvp) vrele(wvp); else @@ -1281,7 +1281,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, ASSERT_VOP_ELOCKED(vp, __func__); unp = VTOUNIONFS(vp); ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount); - uvp = NULLVP; + uvp = NULL; lvp = unp->un_lowervp; cred = td->td_ucred; fmode = FFLAGS(O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); @@ -1310,7 +1310,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, return (error); } - if (uvp != NULLVP) { + if (uvp != NULL) { if (uvp == udvp) vrele(uvp); else @@ -1433,23 +1433,23 @@ unionfs_copyfile(struct vnode *vp, int docopy, struct ucred *cred, ASSERT_VOP_ELOCKED(vp, __func__); unp = VTOUNIONFS(vp); lvp = unp->un_lowervp; - uvp = NULLVP; + uvp = NULL; if ((UNIONFSTOV(unp)->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); - if (unp->un_dvp == NULLVP) + if (unp->un_dvp == NULL) return (EINVAL); - if (unp->un_uppervp != NULLVP) + if (unp->un_uppervp != NULL) return (EEXIST); - udvp = NULLVP; + udvp = NULL; VI_LOCK(unp->un_dvp); dunp = VTOUNIONFS(unp->un_dvp); if (dunp != NULL) udvp = dunp->un_uppervp; VI_UNLOCK(unp->un_dvp); - if (udvp == NULLVP) + if (udvp == NULL) return (EROFS); if ((udvp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); @@ -1646,7 +1646,7 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) cn.cn_cred = cred; error = VOP_LOOKUP(uvp, &tvp, &cn); - if (tvp != NULLVP) + if (tvp != NULL) vput(tvp); if (error != 0 && error != ENOENT && error != EJUSTRETURN) break; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 9342317ad08e..284b24a604f4 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -256,7 +256,7 @@ unionfs_domount(struct mount *mp) ump->um_lowervp = lowerrootvp; ump->um_uppervp = upperrootvp; } - ump->um_rootvp = NULLVP; + ump->um_rootvp = NULL; ump->um_uid = uid; ump->um_gid = gid; ump->um_udir = udir; @@ -280,7 +280,7 @@ unionfs_domount(struct mount *mp) * Get the unionfs root vnode. */ error = unionfs_nodeget(mp, ump->um_uppervp, ump->um_lowervp, - NULLVP, &(ump->um_rootvp), NULL); + NULL, &(ump->um_rootvp), NULL); if (error != 0) { vrele(upperrootvp); free(ump, M_UNIONFSMNT); @@ -558,7 +558,7 @@ unionfs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, ump = MOUNTTOUNIONFSMOUNT(mp); unp = VTOUNIONFS(filename_vp); - if (unp->un_uppervp != NULLVP) { + if (unp->un_uppervp != NULL) { return (VFS_EXTATTRCTL(ump->um_uppermp, cmd, unp->un_uppervp, namespace, attrname)); } else { diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 03130f0ca949..627b2f6e9a1d 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -114,9 +114,9 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) dunp = VTOUNIONFS(dvp); udvp = dunp->un_uppervp; ldvp = dunp->un_lowervp; - vp = uvp = lvp = NULLVP; + vp = uvp = lvp = NULL; td = curthread; - *(ap->a_vpp) = NULLVP; + *(ap->a_vpp) = NULL; UNIONFS_INTERNAL_DEBUG( "unionfs_lookup: enter: nameiop=%ld, flags=%lx, path=%s\n", @@ -159,7 +159,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) * lookup dotdot */ if (cnflags & ISDOTDOT) { - if (LOOKUP != nameiop && udvp == NULLVP) { + if (LOOKUP != nameiop && udvp == NULL) { error = EROFS; goto unionfs_lookup_return; } @@ -170,7 +170,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) goto unionfs_lookup_return; } - if (udvp != NULLVP) + if (udvp != NULL) dtmpvp = udvp; else dtmpvp = ldvp; @@ -186,7 +186,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) * reference, or (if dvp was reclaimed) we'll need to drop * vp's lock and reference to return early. */ - if (vp != NULLVP) + if (vp != NULL) vput(vp); dunp = VTOUNIONFS(dvp); if (error == 0 && dunp == NULL) @@ -202,7 +202,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) if (VN_IS_DOOMED(dtmpvp)) { vput(dtmpvp); - *(ap->a_vpp) = NULLVP; + *(ap->a_vpp) = NULL; error = ENOENT; } vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); @@ -219,11 +219,11 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) * The cost of this is that we may end up performing an unnecessary * lower layer lookup if a whiteout is present in the upper layer. */ - if (ldvp != NULLVP && !(cnflags & DOWHITEOUT)) { + if (ldvp != NULL && !(cnflags & DOWHITEOUT)) { struct componentname lcn; bool is_dot; *** 1285 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509270401.58R41BlL014863>