summaryrefslogtreecommitdiffstats
path: root/sys/fs/specfs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-09-25 16:21:39 +0000
committerphk <phk@FreeBSD.org>1999-09-25 16:21:39 +0000
commita2c68c62dba7acc1de5dd6a6141484d9c12844fe (patch)
treec55829a482e5222c5ae63cf589d4fd2a7ec13aec /sys/fs/specfs
parent869afb6bbe2f0a063d91bf2099b7121d2d03c1b2 (diff)
downloadFreeBSD-src-a2c68c62dba7acc1de5dd6a6141484d9c12844fe.zip
FreeBSD-src-a2c68c62dba7acc1de5dd6a6141484d9c12844fe.tar.gz
This patch clears the way for removing a number of tty related
fields in struct cdevsw: d_stop moved to struct tty. d_reset already unused. d_devtotty linkage now provided by dev_t->si_tty. These fields will be removed from struct cdevsw together with d_params and d_maxio Real Soon Now. The changes in this patch consist of: initialize dev->si_tty in *_open() initialize tty->t_stop remove devtotty functions rename ttpoll to ttypoll a few adjustments to these changes in the generic code a bump of __FreeBSD_version add a couple of FreeBSD tags
Diffstat (limited to 'sys/fs/specfs')
-rw-r--r--sys/fs/specfs/spec_vnops.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index e8a2163..5c003f9 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -46,6 +46,7 @@
#include <sys/fcntl.h>
#include <sys/disklabel.h>
#include <sys/vmmeter.h>
+#include <sys/tty.h>
#include <vm/vm.h>
#include <vm/vm_prot.h>
@@ -167,15 +168,16 @@ spec_open(ap)
if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV))
return (ENXIO);
+ dsw = devsw(dev);
+ if ( (dsw == NULL) || (dsw->d_open == NULL))
+ return ENXIO;
+
/* Make this field valid before any I/O in ->d_open */
if (!dev->si_iosize_max)
dev->si_iosize_max = DFLTPHYS;
switch (vp->v_type) {
case VCHR:
- dsw = devsw(dev);
- if ( (dsw == NULL) || (dsw->d_open == NULL))
- return ENXIO;
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
* When running in very secure mode, do not allow
@@ -208,9 +210,6 @@ spec_open(ap)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
break;
case VBLK:
- dsw = devsw(dev);
- if ( (dsw == NULL) || (dsw->d_open == NULL))
- return ENXIO;
/*
* When running in very secure mode, do not allow
* opens for writing of any disk block devices.
@@ -230,10 +229,26 @@ spec_open(ap)
error = (*dsw->d_open)(dev, ap->a_mode, S_IFBLK, p);
break;
default:
- error = 0;
+ error = ENXIO;
break;
}
+ if (error)
+ return (error);
+
+ if (dsw->d_flags & D_TTY) {
+ if (!dev->si_tty) {
+ printf("Warning:%s: no si_tty\n", devtoname(dev));
+ } else {
+ struct tty *tp;
+ tp = dev->si_tty;
+ if (!tp->t_stop) {
+ printf("Warning:%s: no t_stop, using nostop\n", devtoname(dev));
+ tp->t_stop = nostop;
+ }
+ }
+ }
+
if (vn_isdisk(vp)) {
if (!dev->si_bsize_phys)
dev->si_bsize_phys = DEV_BSIZE;
OpenPOWER on IntegriCloud