summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/fs/specfs/spec_vnops.c11
-rw-r--r--sys/kern/vfs_bio.c2
-rw-r--r--sys/kern/vfs_export.c23
-rw-r--r--sys/kern/vfs_extattr.c2
-rw-r--r--sys/kern/vfs_subr.c23
-rw-r--r--sys/kern/vfs_syscalls.c2
-rw-r--r--sys/kern/vfs_vnops.c4
-rw-r--r--sys/miscfs/specfs/spec_vnops.c11
8 files changed, 31 insertions, 47 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index ae8e11a..582bece 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -139,21 +139,14 @@ spec_open(ap)
struct cdevsw *dsw;
const char *cp;
+ if (vp->v_type == VBLK)
+ return ENXIO;
/*
* Don't allow open if fs is mounted -nodev.
*/
if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV))
return (ENXIO);
- if (vp->v_type == VBLK) {
- if (*dev->si_name != '\0')
- printf("Device \"%s\" ", dev->si_name);
- else
- printf("Device char-major=%d minor=0x%x ",
- major(dev), minor(dev));
- printf("failed attempt to open in block mode\n");
- return ENXIO;
- }
dsw = devsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index df91cb5..17def1b 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -2241,7 +2241,7 @@ loop:
if (vmio) {
bp->b_flags |= B_VMIO;
#if defined(VFS_BIO_DEBUG)
- if (vp->v_type != VREG && vp->v_type != VBLK)
+ if (vp->v_type != VREG)
printf("getblk: vmioing file type %d???\n", vp->v_type);
#endif
} else {
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index affb166..afb43d7 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -1234,7 +1234,6 @@ reassignbuf(bp, newvp)
delay = dirdelay;
break;
case VCHR:
- case VBLK:
if (newvp->v_rdev->si_mountpoint != NULL) {
delay = metadelay;
break;
@@ -1314,9 +1313,8 @@ reassignbuf(bp, newvp)
}
/*
- * Create a vnode for a block device.
+ * Create a vnode for a device.
* Used for mounting the root file system.
- * XXX: This now changed to a VCHR due to the block/char merging.
*/
int
bdevvp(dev, vpp)
@@ -1362,9 +1360,11 @@ addaliasu(nvp, nvp_rdev)
vop_t **ops;
dev_t dev;
- if (nvp->v_type != VBLK && nvp->v_type != VCHR)
+ if (nvp->v_type == VBLK)
+ return (nvp);
+ if (nvp->v_type != VCHR)
panic("addaliasu on non-special vnode");
- dev = udev2dev(nvp_rdev, nvp->v_type == VBLK ? 1 : 0);
+ dev = udev2dev(nvp_rdev, 0);
/*
* Check to see if we have a bdevvp vnode with no associated
* filesystem. If so, we want to associate the filesystem of
@@ -1405,8 +1405,7 @@ addalias(nvp, dev)
dev_t dev;
{
- KASSERT(nvp->v_type == VBLK || nvp->v_type == VCHR,
- ("addalias on non-special vnode"));
+ KASSERT(nvp->v_type == VCHR, ("addalias on non-special vnode"));
nvp->v_rdev = dev;
simple_lock(&spechash_slock);
SLIST_INSERT_HEAD(&dev->si_hlist, nvp, v_specnext);
@@ -1682,7 +1681,7 @@ loop:
*/
if (flags & FORCECLOSE) {
simple_unlock(&mntvnode_slock);
- if (vp->v_type != VBLK && vp->v_type != VCHR) {
+ if (vp->v_type != VCHR) {
vgonel(vp, p);
} else {
vclean(vp, 0, p);
@@ -1925,7 +1924,7 @@ vgonel(vp, p)
* If special device, remove it from special device alias list
* if it is on one.
*/
- if ((vp->v_type == VBLK || vp->v_type == VCHR) && vp->v_rdev != NULL) {
+ if (vp->v_type == VCHR && vp->v_rdev != NULL && vp->v_rdev != NODEV) {
simple_lock(&spechash_slock);
SLIST_REMOVE(&vp->v_rdev->si_hlist, vp, vnode, v_specnext);
freedev(vp->v_rdev);
@@ -2932,13 +2931,13 @@ sync_print(ap)
}
/*
- * extract the dev_t from a VBLK or VCHR
+ * extract the dev_t from a VCHR
*/
dev_t
vn_todev(vp)
struct vnode *vp;
{
- if (vp->v_type != VBLK && vp->v_type != VCHR)
+ if (vp->v_type != VCHR)
return (NODEV);
return (vp->v_rdev);
}
@@ -2953,7 +2952,7 @@ vn_isdisk(vp, errp)
{
struct cdevsw *cdevsw;
- if (vp->v_type != VBLK && vp->v_type != VCHR) {
+ if (vp->v_type != VCHR) {
if (errp != NULL)
*errp = ENOTBLK;
return (0);
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 83ca1ca..c24d227 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -3189,7 +3189,7 @@ revoke(p, uap)
return (error);
vp = nd.ni_vp;
NDFREE(&nd, NDF_ONLY_PNBUF);
- if (vp->v_type != VCHR && vp->v_type != VBLK) {
+ if (vp->v_type != VCHR) {
error = EINVAL;
goto out;
}
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index affb166..afb43d7 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1234,7 +1234,6 @@ reassignbuf(bp, newvp)
delay = dirdelay;
break;
case VCHR:
- case VBLK:
if (newvp->v_rdev->si_mountpoint != NULL) {
delay = metadelay;
break;
@@ -1314,9 +1313,8 @@ reassignbuf(bp, newvp)
}
/*
- * Create a vnode for a block device.
+ * Create a vnode for a device.
* Used for mounting the root file system.
- * XXX: This now changed to a VCHR due to the block/char merging.
*/
int
bdevvp(dev, vpp)
@@ -1362,9 +1360,11 @@ addaliasu(nvp, nvp_rdev)
vop_t **ops;
dev_t dev;
- if (nvp->v_type != VBLK && nvp->v_type != VCHR)
+ if (nvp->v_type == VBLK)
+ return (nvp);
+ if (nvp->v_type != VCHR)
panic("addaliasu on non-special vnode");
- dev = udev2dev(nvp_rdev, nvp->v_type == VBLK ? 1 : 0);
+ dev = udev2dev(nvp_rdev, 0);
/*
* Check to see if we have a bdevvp vnode with no associated
* filesystem. If so, we want to associate the filesystem of
@@ -1405,8 +1405,7 @@ addalias(nvp, dev)
dev_t dev;
{
- KASSERT(nvp->v_type == VBLK || nvp->v_type == VCHR,
- ("addalias on non-special vnode"));
+ KASSERT(nvp->v_type == VCHR, ("addalias on non-special vnode"));
nvp->v_rdev = dev;
simple_lock(&spechash_slock);
SLIST_INSERT_HEAD(&dev->si_hlist, nvp, v_specnext);
@@ -1682,7 +1681,7 @@ loop:
*/
if (flags & FORCECLOSE) {
simple_unlock(&mntvnode_slock);
- if (vp->v_type != VBLK && vp->v_type != VCHR) {
+ if (vp->v_type != VCHR) {
vgonel(vp, p);
} else {
vclean(vp, 0, p);
@@ -1925,7 +1924,7 @@ vgonel(vp, p)
* If special device, remove it from special device alias list
* if it is on one.
*/
- if ((vp->v_type == VBLK || vp->v_type == VCHR) && vp->v_rdev != NULL) {
+ if (vp->v_type == VCHR && vp->v_rdev != NULL && vp->v_rdev != NODEV) {
simple_lock(&spechash_slock);
SLIST_REMOVE(&vp->v_rdev->si_hlist, vp, vnode, v_specnext);
freedev(vp->v_rdev);
@@ -2932,13 +2931,13 @@ sync_print(ap)
}
/*
- * extract the dev_t from a VBLK or VCHR
+ * extract the dev_t from a VCHR
*/
dev_t
vn_todev(vp)
struct vnode *vp;
{
- if (vp->v_type != VBLK && vp->v_type != VCHR)
+ if (vp->v_type != VCHR)
return (NODEV);
return (vp->v_rdev);
}
@@ -2953,7 +2952,7 @@ vn_isdisk(vp, errp)
{
struct cdevsw *cdevsw;
- if (vp->v_type != VBLK && vp->v_type != VCHR) {
+ if (vp->v_type != VCHR) {
if (errp != NULL)
*errp = ENOTBLK;
return (0);
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 83ca1ca..c24d227 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3189,7 +3189,7 @@ revoke(p, uap)
return (error);
vp = nd.ni_vp;
NDFREE(&nd, NDF_ONLY_PNBUF);
- if (vp->v_type != VCHR && vp->v_type != VBLK) {
+ if (vp->v_type != VCHR) {
error = EINVAL;
goto out;
}
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index e0d7be2..448a2a6 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -311,7 +311,7 @@ vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, p)
if ((ioflg & IO_NODELOCKED) == 0) {
mp = NULL;
if (rw == UIO_WRITE &&
- vp->v_type != VCHR && vp->v_type != VBLK &&
+ vp->v_type != VCHR &&
(error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
@@ -407,7 +407,7 @@ vn_write(fp, uio, cred, flags, p)
(vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS)))
ioflag |= IO_SYNC;
mp = NULL;
- if (vp->v_type != VCHR && vp->v_type != VBLK &&
+ if (vp->v_type != VCHR &&
(error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
VOP_LEASE(vp, p, cred, LEASE_WRITE);
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index ae8e11a..582bece 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -139,21 +139,14 @@ spec_open(ap)
struct cdevsw *dsw;
const char *cp;
+ if (vp->v_type == VBLK)
+ return ENXIO;
/*
* Don't allow open if fs is mounted -nodev.
*/
if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV))
return (ENXIO);
- if (vp->v_type == VBLK) {
- if (*dev->si_name != '\0')
- printf("Device \"%s\" ", dev->si_name);
- else
- printf("Device char-major=%d minor=0x%x ",
- major(dev), minor(dev));
- printf("failed attempt to open in block mode\n");
- return ENXIO;
- }
dsw = devsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
OpenPOWER on IntegriCloud