Remove all use of vnode->v_tag, replacing with appropriate substitutes.

v_tag is now const char * and should only be used for debugging.

Additionally:
1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK
2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which
is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP.

Suggested by:   phk
Reviewed by:    bde, rwatson (earlier version)
This commit is contained in:
Nate Lawson 2002-09-14 09:02:28 +00:00
parent fcfa0b48b3
commit 06be2aaa83
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103314
55 changed files with 133 additions and 125 deletions

View File

@ -1959,7 +1959,7 @@ make_coda_node(fid, vfsp, type)
lockinit(&cp->c_lock, PINOD, "cnode", 0, 0);
cp->c_fid = *fid;
err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp);
err = getnewvnode("coda", vfsp, coda_vnodeop_p, &vp);
if (err) {
panic("coda: getnewvnode returned error %d\n", err);
}

View File

@ -708,7 +708,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
return (0);
/* Allocate a new vnode/iso_node. */
if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) {
if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) {
*vpp = NULLVP;
return (error);
}

View File

@ -746,7 +746,7 @@ cd9660_print(ap)
} */ *ap;
{
printf("tag VT_ISOFS, isofs vnode\n");
printf("tag %s, isofs vnode\n", ap->a_vp->v_tag);
return (0);
}

View File

@ -1959,7 +1959,7 @@ make_coda_node(fid, vfsp, type)
lockinit(&cp->c_lock, PINOD, "cnode", 0, 0);
cp->c_fid = *fid;
err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp);
err = getnewvnode("coda", vfsp, coda_vnodeop_p, &vp);
if (err) {
panic("coda: getnewvnode returned error %d\n", err);
}

View File

@ -248,7 +248,7 @@ dead_print(ap)
} */ *ap;
{
printf("tag VT_NON, dead vnode\n");
printf("tag %s, dead vnode\n", ap->a_vp->v_tag);
return (0);
}

View File

@ -144,7 +144,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, stru
} else {
dev = NODEV;
}
error = getnewvnode(VT_DEVFS, mp, devfs_vnodeop_p, &vp);
error = getnewvnode("devfs", mp, devfs_vnodeop_p, &vp);
if (error != 0) {
printf("devfs_allocv: failed to allocate new vnode\n");
return (error);
@ -534,7 +534,7 @@ devfs_print(ap)
} */ *ap;
{
printf("tag VT_DEVFS, devfs vnode\n");
printf("tag %s, devfs vnode\n", ap->a_vp->v_tag);
return (0);
}

View File

@ -135,7 +135,7 @@ fdesc_allocvp(ftype, ix, mp, vpp, td)
*/
MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK);
error = getnewvnode(VT_FDESC, mp, fdesc_vnodeop_p, vpp);
error = getnewvnode("fdesc", mp, fdesc_vnodeop_p, vpp);
if (error) {
FREE(fd, M_TEMP);
goto out;
@ -547,7 +547,7 @@ fdesc_print(ap)
} */ *ap;
{
printf("tag VT_NON, fdesc vnode\n");
printf("tag %s, fdesc vnode\n", ap->a_vp->v_tag);
return (0);
}

View File

@ -564,7 +564,7 @@ fifo_print(ap)
} */ *ap;
{
printf("tag VT_NON");
printf("tag %s", ap->a_vp->v_tag);
fifo_printinfo(ap->a_vp);
printf("\n");
return (0);

View File

@ -496,7 +496,7 @@ hpfs_vget(
MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode),
M_HPFSNO, M_WAITOK);
error = getnewvnode(VT_HPFS, hpmp->hpm_mp, hpfs_vnodeop_p, &vp);
error = getnewvnode("hpfs", hpmp->hpm_mp, hpfs_vnodeop_p, &vp);
if (error) {
printf("hpfs_vget: can't get new vnode\n");
FREE(hp, M_HPFSNO);

View File

@ -659,7 +659,7 @@ hpfs_print(ap)
register struct vnode *vp = ap->a_vp;
register struct hpfsnode *hp = VTOHP(vp);
printf("tag VT_HPFS, ino 0x%x",hp->h_no);
printf("tag %s, ino 0x%x", vp->v_tag, hp->h_no);
lockmgr_printinfo(&hp->h_lock);
printf("\n");
return (0);

View File

@ -253,7 +253,7 @@ deget(pmp, dirclust, diroffset, depp)
* copy it from the passed disk buffer.
*/
/* getnewvnode() does a VREF() on the vnode */
error = getnewvnode(VT_MSDOSFS, mntp, msdosfs_vnodeop_p, &nvp);
error = getnewvnode("msdosfs", mntp, msdosfs_vnodeop_p, &nvp);
if (error) {
*depp = NULL;
FREE(ldep, M_MSDOSFSNODE);

View File

@ -648,7 +648,7 @@ msdosfs_unmount(mp, mntflags, td)
TAILQ_FIRST(&vp->v_cleanblkhd),
TAILQ_FIRST(&vp->v_dirtyblkhd),
vp->v_numoutput, vp->v_type);
printf("union %p, tag %d, data[0] %08x, data[1] %08x\n",
printf("union %p, tag %s, data[0] %08x, data[1] %08x\n",
vp->v_socket, vp->v_tag,
((u_int *)vp->v_data)[0],
((u_int *)vp->v_data)[1]);

View File

@ -1830,9 +1830,9 @@ msdosfs_print(ap)
{
struct denode *dep = VTODE(ap->a_vp);
printf(
"tag VT_MSDOSFS, startcluster %lu, dircluster %lu, diroffset %lu ",
dep->de_StartCluster, dep->de_dirclust, dep->de_diroffset);
printf("tag %s, startcluster %lu, dircluster %lu, diroffset %lu ",
ap->a_vp->v_tag, dep->de_StartCluster,
dep->de_dirclust, dep->de_diroffset);
printf(" dev %d, %d", major(dep->de_dev), minor(dep->de_dev));
lockmgr_printinfo(&ap->a_vp->v_lock);
printf("\n");

View File

@ -732,7 +732,7 @@ ntfs_vgetex(
return (0);
}
error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, ntfs_vnodeop_p, &vp);
error = getnewvnode("ntfs", ntmp->ntm_mountp, ntfs_vnodeop_p, &vp);
if(error) {
ntfs_frele(fp);
ntfs_ntput(ip);

View File

@ -214,7 +214,7 @@ null_nodeget(mp, lowervp, vpp)
MALLOC(xp, struct null_node *, sizeof(struct null_node),
M_NULLFSNODE, M_WAITOK);
error = getnewvnode(VT_NULL, mp, null_vnodeop_p, &vp);
error = getnewvnode("null", mp, null_vnodeop_p, &vp);
if (error) {
FREE(xp, M_NULLFSNODE);
return (error);

View File

@ -770,7 +770,8 @@ null_print(ap)
} */ *ap;
{
register struct vnode *vp = ap->a_vp;
printf ("\ttag VT_NULLFS, vp=%p, lowervp=%p\n", vp, NULLVPTOLOWERVP(vp));
printf("\ttag %s, vp=%p, lowervp=%p\n", vp->v_tag, vp,
NULLVPTOLOWERVP(vp));
return (0);
}

View File

@ -170,7 +170,7 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
* elsewhere if MALLOC should block.
*/
MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO);
error = getnewvnode(VT_NWFS, mp, nwfs_vnodeop_p, &vp);
error = getnewvnode("nwfs", mp, nwfs_vnodeop_p, &vp);
if (error) {
*vpp = NULL;
FREE(np, M_NWNODE);

View File

@ -118,7 +118,7 @@ portal_mount(mp, path, data, ndp, td)
MALLOC(fmp, struct portalmount *, sizeof(struct portalmount),
M_PORTALFSMNT, M_WAITOK); /* XXX */
error = getnewvnode(VT_PORTAL, mp, portal_vnodeop_p, &rvp); /* XXX */
error = getnewvnode("portal", mp, portal_vnodeop_p, &rvp); /* XXX */
if (error) {
FREE(fmp, M_PORTALFSMNT);
FREE(pn, M_TEMP);

View File

@ -135,7 +135,7 @@ portal_lookup(ap)
MALLOC(pt, struct portalnode *, sizeof(struct portalnode),
M_TEMP, M_WAITOK);
error = getnewvnode(VT_PORTAL, dvp->v_mount, portal_vnodeop_p, &fvp);
error = getnewvnode("portal", dvp->v_mount, portal_vnodeop_p, &fvp);
if (error) {
FREE(pt, M_TEMP);
goto bad;
@ -558,7 +558,7 @@ portal_print(ap)
} */ *ap;
{
printf("tag VT_PORTAL, portal vnode\n");
printf("tag %s, portal vnode\n", ap->a_vp->v_tag);
return (0);
}

View File

@ -75,6 +75,9 @@ _pfs_add_node(struct pfs_node *parent, struct pfs_node *node)
node->pn_parent = parent;
node->pn_next = parent->pn_nodes;
parent->pn_nodes = node;
/* Propagate flag to all child nodes (and thus their vnodes) */
if ((parent->pn_flags & PFS_PROCDEP) != 0)
node->pn_flags |= PFS_PROCDEP;
mtx_unlock(&parent->pn_info->pi_mutex);
return (0);
@ -129,7 +132,7 @@ pfs_create_dir(struct pfs_node *parent, char *name,
dir->pn_type = (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir;
dir->pn_attr = attr;
dir->pn_vis = vis;
dir->pn_flags = flags & ~PFS_PROCDEP;
dir->pn_flags = flags;
if (_pfs_add_node(parent, dir) != 0) {
FREE(dir, M_PFSNODES);

View File

@ -135,7 +135,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, M_WAITOK);
if (++pfs_vncache_entries > pfs_vncache_maxentries)
pfs_vncache_maxentries = pfs_vncache_entries;
error = getnewvnode(VT_PSEUDOFS, mp, pfs_vnodeop_p, vpp);
error = getnewvnode("pseudofs", mp, pfs_vnodeop_p, vpp);
if (error)
return (error);
pvd->pvd_pn = pn;
@ -165,6 +165,12 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
default:
panic("%s has unexpected type: %d", pn->pn_name, pn->pn_type);
}
/*
* Propagate flag through to vnode so users know it can change
* if the process changes (i.e. execve)
*/
if ((pn->pn_flags & PFS_PROCDEP) != 0)
(*vpp)->v_vflag |= VV_PROCDEP;
pvd->pvd_vnode = *vpp;
mtx_lock(&pfs_vncache_mutex);
pvd->pvd_prev = NULL;

View File

@ -220,7 +220,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
return ENOENT;
MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK);
error = getnewvnode(VT_SMBFS, mp, smbfs_vnodeop_p, &vp);
error = getnewvnode("smbfs", mp, smbfs_vnodeop_p, &vp);
if (error) {
FREE(np, M_SMBNODE);
return error;

View File

@ -835,8 +835,8 @@ int smbfs_print (ap)
printf("no smbnode data\n");
return (0);
}
printf("tag VT_SMBFS, name = %s, parent = %p, opencount = %d",
np->n_name, np->n_parent ? SMBTOV(np->n_parent) : NULL,
printf("tag %s, name = %s, parent = %p, opencount = %d",
vp->v_tag, np->n_name, np->n_parent ? SMBTOV(np->n_parent) : NULL,
np->n_opencount);
lockmgr_printinfo(&vp->v_lock);
printf("\n");

View File

@ -641,7 +641,8 @@ spec_print(ap)
} */ *ap;
{
printf("tag VT_NON, dev %s\n", devtoname(ap->a_vp->v_rdev));
printf("tag %s, dev %s\n", ap->a_vp->v_tag,
devtoname(ap->a_vp->v_rdev));
return (0);
}

View File

@ -161,7 +161,7 @@ udf_allocv(struct mount *mp, struct vnode **vpp, struct thread *td)
int error;
struct vnode *vp;
error = getnewvnode(VT_UDF, mp, udf_vnodeop_p, &vp);
error = getnewvnode("udf", mp, udf_vnodeop_p, &vp);
if (error) {
printf("udf_allocv: failed to allocate new vnode\n");
return (error);

View File

@ -212,7 +212,7 @@ umap_node_alloc(mp, lowervp, vpp)
MALLOC(xp, struct umap_node *, sizeof(struct umap_node),
M_TEMP, M_WAITOK);
error = getnewvnode(VT_UMAP, mp, umap_vnodeop_p, vpp);
error = getnewvnode("umap", mp, umap_vnodeop_p, vpp);
if (error) {
FREE(xp, M_TEMP);
return (error);

View File

@ -436,7 +436,8 @@ umap_print(ap)
} */ *ap;
{
struct vnode *vp = ap->a_vp;
printf("\ttag VT_UMAPFS, vp=%p, lowervp=%p\n", vp, UMAPVPTOLOWERVP(vp));
printf("\ttag %s, vp=%p, lowervp=%p\n", vp->v_tag, vp,
UMAPVPTOLOWERVP(vp));
return (0);
}

View File

@ -443,7 +443,8 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache)
do {
scan = VTOUNION(scan)->un_pvp;
} while (scan && scan->v_tag == VT_UNION && scan != dvp);
} while (scan && scan->v_op == union_vnodeop_p &&
scan != dvp);
if (scan != dvp) {
/*
* our new un is above dvp (we never saw dvp
@ -545,7 +546,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache)
* Create new node rather then replace old node
*/
error = getnewvnode(VT_UNION, mp, union_vnodeop_p, vpp);
error = getnewvnode("union", mp, union_vnodeop_p, vpp);
if (error) {
/*
* If an error occurs clear out vnodes.

View File

@ -1832,8 +1832,8 @@ union_print(ap)
{
struct vnode *vp = ap->a_vp;
printf("\ttag VT_UNION, vp=%p, uppervp=%p, lowervp=%p\n",
vp, UPPERVP(vp), LOWERVP(vp));
printf("\ttag %s, vp=%p, uppervp=%p, lowervp=%p\n", vp->v_tag,
vp, UPPERVP(vp), LOWERVP(vp));
if (UPPERVP(vp) != NULLVP)
vprint("union: upper", UPPERVP(vp));
if (LOWERVP(vp) != NULLVP)

View File

@ -1008,7 +1008,7 @@ ext2_vget(mp, ino, flags, vpp)
MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK);
/* Allocate a new vnode/inode. */
if ((error = getnewvnode(VT_UFS, mp, ext2_vnodeop_p, &vp)) != 0) {
if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) {
if (ext2fs_inode_hash_lock < 0)
wakeup(&ext2fs_inode_hash_lock);
ext2fs_inode_hash_lock = 0;

View File

@ -1557,9 +1557,9 @@ ext2_print(ap)
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
printf("tag VT_UFS, ino %lu, on dev %s (%d, %d)",
(u_long)ip->i_number, devtoname(ip->i_dev), major(ip->i_dev),
minor(ip->i_dev));
printf("tag %s, ino %lu, on dev %s (%d, %d)",
vp->v_tag, (u_long)ip->i_number, devtoname(ip->i_dev),
major(ip->i_dev), minor(ip->i_dev));
if (vp->v_type == VFIFO)
fifo_printinfo(vp);
lockmgr_printinfo(&vp->v_lock);

View File

@ -1008,7 +1008,7 @@ ext2_vget(mp, ino, flags, vpp)
MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK);
/* Allocate a new vnode/inode. */
if ((error = getnewvnode(VT_UFS, mp, ext2_vnodeop_p, &vp)) != 0) {
if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) {
if (ext2fs_inode_hash_lock < 0)
wakeup(&ext2fs_inode_hash_lock);
ext2fs_inode_hash_lock = 0;

View File

@ -1557,9 +1557,9 @@ ext2_print(ap)
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
printf("tag VT_UFS, ino %lu, on dev %s (%d, %d)",
(u_long)ip->i_number, devtoname(ip->i_dev), major(ip->i_dev),
minor(ip->i_dev));
printf("tag %s, ino %lu, on dev %s (%d, %d)",
vp->v_tag, (u_long)ip->i_number, devtoname(ip->i_dev),
major(ip->i_dev), minor(ip->i_dev));
if (vp->v_type == VFIFO)
fifo_printinfo(vp);
lockmgr_printinfo(&vp->v_lock);

View File

@ -708,7 +708,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
return (0);
/* Allocate a new vnode/iso_node. */
if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) {
if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) {
*vpp = NULLVP;
return (error);
}

View File

@ -746,7 +746,7 @@ cd9660_print(ap)
} */ *ap;
{
printf("tag VT_ISOFS, isofs vnode\n");
printf("tag %s, isofs vnode\n", ap->a_vp->v_tag);
return (0);
}

View File

@ -53,6 +53,7 @@
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/namei.h>
#include <sys/file.h>
@ -1407,11 +1408,8 @@ fdfree(td)
/*
* For setugid programs, we don't want to people to use that setugidness
* to generate error messages which write to a file which otherwise would
* otherwise be off-limits to the process.
*
* This is a gross hack to plug the hole. A better solution would involve
* a special vop or other form of generalized access control mechanism. We
* go ahead and just reject all procfs filesystems accesses as dangerous.
* otherwise be off-limits to the process. We check for filesystems where
* the vnode can change out from under us after execve (like [lin]procfs).
*
* Since setugidsafety calls this only for fd 0, 1 and 2, this check is
* sufficient. We also don't for check setugidness since we know we are.
@ -1419,9 +1417,12 @@ fdfree(td)
static int
is_unsafe(struct file *fp)
{
if (fp->f_type == DTYPE_VNODE &&
((struct vnode *)(fp->f_data))->v_tag == VT_PROCFS)
return (1);
if (fp->f_type == DTYPE_VNODE) {
struct vnode *vp = (struct vnode *)fp->f_data;
if ((vp->v_vflag & VV_PROCDEP) != 0)
return (1);
}
return (0);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1211,7 +1211,8 @@ brelse(struct buf * bp)
* background write.
*/
if ((bp->b_flags & B_VMIO)
&& !(bp->b_vp->v_tag == VT_NFS &&
&& !(bp->b_vp->v_mount != NULL &&
(bp->b_vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 &&
!vn_isdisk(bp->b_vp, NULL) &&
(bp->b_flags & B_DELWRI))
) {

View File

@ -792,7 +792,7 @@ vcanrecycle(struct vnode *vp)
*/
int
getnewvnode(tag, mp, vops, vpp)
enum vtagtype tag;
const char *tag;
struct mount *mp;
vop_t **vops;
struct vnode **vpp;
@ -1591,14 +1591,16 @@ sched_sync(void)
s = splbio();
if (LIST_FIRST(slp) == vp) {
/*
* Note: v_tag VT_VFS vps can remain on the
* Note: VFS vnodes can remain on the
* worklist too with no dirty blocks, but
* since sync_fsync() moves it to a different
* slot we are safe.
*/
if (TAILQ_EMPTY(&vp->v_dirtyblkhd) &&
!vn_isdisk(vp, NULL))
panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag);
!vn_isdisk(vp, NULL)) {
panic("sched_sync: fsync failed "
"vp %p tag %s", vp, vp->v_tag);
}
/*
* Put us back on the worklist. The worklist
* routine will remove us from our current
@ -1812,7 +1814,7 @@ bdevvp(dev, vpp)
}
if (vfinddev(dev, VCHR, vpp))
return (0);
error = getnewvnode(VT_NON, (struct mount *)0, spec_vnodeop_p, &nvp);
error = getnewvnode("none", (struct mount *)0, spec_vnodeop_p, &nvp);
if (error) {
*vpp = NULLVP;
return (error);
@ -2382,7 +2384,7 @@ vclean(vp, flags, td)
vp->v_op = dead_vnodeop_p;
if (vp->v_pollinfo != NULL)
vn_pollgone(vp);
vp->v_tag = VT_NON;
vp->v_tag = "none";
vp->v_iflag &= ~VI_XLOCK;
vp->v_vxproc = NULL;
if (vp->v_iflag & VI_XWANT) {
@ -3190,7 +3192,7 @@ vfs_allocate_syncvnode(mp)
int error;
/* Allocate a new vnode */
if ((error = getnewvnode(VT_VFS, mp, sync_vnodeop_p, &vp)) != 0) {
if ((error = getnewvnode("vfs", mp, sync_vnodeop_p, &vp)) != 0) {
mp->mnt_syncer = NULL;
return (error);
}

View File

@ -223,7 +223,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp)
*/
np = uma_zalloc(nfsnode_zone, M_WAITOK);
error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp);
error = getnewvnode("nfs", mntp, nfsv2_vnodeop_p, &nvp);
if (error) {
if (nfs_node_hash_lock < 0)
wakeup(&nfs_node_hash_lock);

View File

@ -2863,8 +2863,8 @@ nfs_print(struct vop_print_args *ap)
struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
printf("tag VT_NFS, fileid %ld fsid 0x%x",
np->n_vattr.va_fileid, np->n_vattr.va_fsid);
printf("tag %s fileid %ld fsid 0x%x",
vp->v_tag, np->n_vattr.va_fileid, np->n_vattr.va_fsid);
if (vp->v_type == VFIFO)
fifo_printinfo(vp);
printf("\n");

View File

@ -73,7 +73,7 @@ lomacfs_node_alloc(struct mount *mp, struct componentname *cnp,
return (EEXIST);
}
}
error = getnewvnode(VT_NULL, mp, lomacfs_vnodeop_p, vpp);
error = getnewvnode("lomacfs", mp, lomacfs_vnodeop_p, vpp);
if (error) {
vput(lowervp);
free(lp, M_LOMACFS);

View File

@ -175,7 +175,7 @@ lomacfs_print(
) {
struct vnode *vp = ap->a_vp;
printf ("\ttag VT_LOMACFS, vp=%p, lowervp=%p\n", vp,
printf ("\ttag %s, vp=%p, lowervp=%p\n", vp->v_tag, vp,
VTOLVP(vp));
return (0);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (0);
*/
/* printf("vn_refreshlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
if (vp->v_type != VNON)
printf(
"vn_refreshlabel: null v_mount with non-VT_NON\n");
"vn_refreshlabel: null v_mount with non-VNON\n");
return (EBADF);
}
@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred)
if (vp->v_mount == NULL) {
/* printf("vn_setlabel: null v_mount\n"); */
if (vp->v_tag != VT_NON)
printf("vn_setlabel: null v_mount with non-VT_NON\n");
if (vp->v_type != VNON)
printf("vn_setlabel: null v_mount with non-VNON\n");
return (EBADF);
}

View File

@ -64,18 +64,6 @@
*/
enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
/*
* Vnode tag types.
* These are for the benefit of external programs only (e.g., pstat)
* and should NEVER be inspected by the kernel.
*/
enum vtagtype {
VT_NON, VT_UFS, VT_NFS, VT_UNUSED, VT_PC, VT_LFS, VT_LOFS, VT_FDESC,
VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS,
VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS,
VT_HPFS, VT_NWFS, VT_PSEUDOFS, VT_SMBFS, VT_UDF
};
/*
* Each underlying filesystem allocates its own private area and hangs
* it from v_data. If non-null, this area is freed in getnewvnode().
@ -142,7 +130,7 @@ struct vnode {
struct vm_object *v_object; /* Place to store VM object */
struct lock v_lock; /* used if fs don't have one */
struct lock *v_vnlock; /* pointer to vnode lock */
enum vtagtype v_tag; /* type of underlying data */
const char *v_tag; /* type of underlying data */
void *v_data; /* private data for fs */
LIST_HEAD(, namecache) v_cache_src; /* Cache entries from us */
TAILQ_HEAD(, namecache) v_cache_dst; /* Cache entries to us */
@ -235,6 +223,7 @@ struct xvnode {
#define VV_TEXT 0x0020 /* vnode is a pure text prototype */
#define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */
#define VV_SYSTEM 0x0080 /* vnode being used by kernel */
#define VV_PROCDEP 0x0100 /* vnode is process dependent */
/*
* Vnode attributes. A field value of VNOVAL represents a field whose value
@ -693,8 +682,8 @@ void cache_purgevfs(struct mount *mp);
int cache_leaf_test(struct vnode *vp);
void cvtstat(struct stat *st, struct ostat *ost);
void cvtnstat(struct stat *sb, struct nstat *nsb);
int getnewvnode(enum vtagtype tag,
struct mount *mp, vop_t **vops, struct vnode **vpp);
int getnewvnode(const char *tag, struct mount *mp, vop_t **vops,
struct vnode **vpp);
int lease_check(struct vop_lease_args *ap);
int spec_vnoperate(struct vop_generic_args *);
int speedup_syncer(void);

View File

@ -1215,7 +1215,7 @@ ffs_vget(mp, ino, flags, vpp)
ump->um_malloctype, M_WAITOK);
/* Allocate a new vnode/inode. */
error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp);
error = getnewvnode("ufs", mp, ffs_vnodeop_p, &vp);
if (error) {
*vpp = NULL;
FREE(ip, ump->um_malloctype);

View File

@ -1979,9 +1979,9 @@ ufs_print(ap)
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
printf("tag VT_UFS, ino %lu, on dev %s (%d, %d)",
(u_long)ip->i_number, devtoname(ip->i_dev), major(ip->i_dev),
minor(ip->i_dev));
printf("tag %s, ino %lu, on dev %s (%d, %d)",
vp->v_tag, (u_long)ip->i_number, devtoname(ip->i_dev),
major(ip->i_dev), minor(ip->i_dev));
if (vp->v_type == VFIFO)
fifo_printinfo(vp);
lockmgr_printinfo(&vp->v_lock);

View File

@ -52,6 +52,7 @@
#include <sys/conf.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/mount.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_param.h>
@ -222,7 +223,8 @@ swapon(td, uap)
if (vn_isdisk(vp, &error))
error = swaponvp(td, vp, vp->v_rdev, 0);
else if (vp->v_type == VREG && vp->v_tag == VT_NFS &&
else if (vp->v_type == VREG &&
(vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 &&
(error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) == 0) {
/*
* Allow direct swapping to NFS regular files in the same
@ -265,7 +267,7 @@ swaponvp(td, vp, dev, nblks)
u_long aligned_nblks;
if (!swapdev_vp) {
error = getnewvnode(VT_NON, NULL, swapdev_vnodeop_p,
error = getnewvnode("none", NULL, swapdev_vnodeop_p,
&swapdev_vp);
if (error)
panic("Cannot get vnode for swapdev");