summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-09-27 12:01:01 +0000
committerphk <phk@FreeBSD.org>2003-09-27 12:01:01 +0000
commit7099deadda891e55e6cf9b433659c61126568e93 (patch)
treeb97e31a4fdc3440a666206b469045b517017d25e
parentc21d189c3f13ce3c60be9f7e4b2d8fc554970d12 (diff)
downloadFreeBSD-src-7099deadda891e55e6cf9b433659c61126568e93.zip
FreeBSD-src-7099deadda891e55e6cf9b433659c61126568e93.tar.gz
The present defaults for the open and close for device drivers which
provide no methods does not make any sense, and is not used by any driver. It is a pretty hard to come up with even a theoretical concept of a device driver which would always fail open and close with ENODEV. Change the defaults to be nullopen() and nullclose() which simply does nothing. Remove explicit initializations to these from the drivers which already used them.
-rw-r--r--sys/dev/adlink/adlink.c1
-rw-r--r--sys/dev/ata/ata-all.c2
-rw-r--r--sys/dev/isp/isp_freebsd.c2
-rw-r--r--sys/dev/md/md.c2
-rw-r--r--sys/dev/null/null.c4
-rw-r--r--sys/dev/ofw/openfirmio.c2
-rw-r--r--sys/geom/geom_ctl.c2
-rw-r--r--sys/i386/bios/smapi.c2
-rw-r--r--sys/i386/i386/elan-mmcr.c2
-rw-r--r--sys/kern/kern_conf.c4
-rw-r--r--sys/kern/subr_devstat.c2
-rw-r--r--sys/kern/tty_tty.c1
-rw-r--r--sys/netncp/ncp_mod.c2
-rw-r--r--sys/opencrypto/cryptodev.c1
14 files changed, 2 insertions, 27 deletions
diff --git a/sys/dev/adlink/adlink.c b/sys/dev/adlink/adlink.c
index 53c81de..909f2ba 100644
--- a/sys/dev/adlink/adlink.c
+++ b/sys/dev/adlink/adlink.c
@@ -394,7 +394,6 @@ adlink_intr(void *arg)
static struct cdevsw adlink_cdevsw = {
.d_open = adlink_open,
- .d_close = nullclose,
.d_ioctl = adlink_ioctl,
.d_mmap = adlink_mmap,
.d_name = "adlink",
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 010c2c2..580f1ea 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$");
/* device structures */
static d_ioctl_t ata_ioctl;
static struct cdevsw ata_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = ata_ioctl,
.d_name = "ata",
.d_maj = 159,
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index ad1dab61..bd41b70 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -54,8 +54,6 @@ static void isp_action(struct cam_sim *, union ccb *);
#define ISP_CDEV_MAJOR 248
static struct cdevsw isp_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = ispioctl,
.d_name = "isp",
.d_maj = ISP_CDEV_MAJOR,
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index d79a4ac..58090ff 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -116,8 +116,6 @@ static dev_t status_dev = 0;
static d_ioctl_t mdctlioctl;
static struct cdevsw mdctl_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = mdctlioctl,
.d_name = MD_NAME,
.d_maj = CDEV_MAJOR
diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c
index 6afa67e..4044bc7 100644
--- a/sys/dev/null/null.c
+++ b/sys/dev/null/null.c
@@ -53,8 +53,6 @@ static d_read_t null_read;
#define ZERO_MINOR 12
static struct cdevsw null_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_read = null_read,
.d_write = null_write,
.d_ioctl = null_ioctl,
@@ -64,8 +62,6 @@ static struct cdevsw null_cdevsw = {
};
static struct cdevsw zero_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_read = zero_read,
.d_write = null_write,
.d_name = "zero",
diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c
index cdf2a09..37f10b5 100644
--- a/sys/dev/ofw/openfirmio.c
+++ b/sys/dev/ofw/openfirmio.c
@@ -67,8 +67,6 @@ static d_ioctl_t openfirm_ioctl;
#define OPENFIRM_MINOR 0
static struct cdevsw openfirm_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = openfirm_ioctl,
.d_name = "openfirm",
};
diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c
index b9f2a92..43a0313 100644
--- a/sys/geom/geom_ctl.c
+++ b/sys/geom/geom_ctl.c
@@ -65,8 +65,6 @@ __FBSDID("$FreeBSD$");
static d_ioctl_t g_ctl_ioctl;
static struct cdevsw g_ctl_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = g_ctl_ioctl,
.d_name = "g_ctl",
};
diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c
index 5b90896..ed1267e 100644
--- a/sys/i386/bios/smapi.c
+++ b/sys/i386/bios/smapi.c
@@ -75,8 +75,6 @@ devclass_t smapi_devclass;
static d_ioctl_t smapi_ioctl;
static struct cdevsw smapi_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = smapi_ioctl,
.d_name = "smapi",
.d_maj = MAJOR_AUTO,
diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c
index 4cd4d59..67fe5f2 100644
--- a/sys/i386/i386/elan-mmcr.c
+++ b/sys/i386/i386/elan-mmcr.c
@@ -174,8 +174,6 @@ static d_mmap_t elan_mmap;
#define CDEV_MAJOR 100 /* Share with xrpu */
static struct cdevsw elan_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_write = elan_write,
.d_ioctl = elan_ioctl,
.d_mmap = elan_mmap,
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index acdf85e..56eaf11 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -276,8 +276,8 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, const
KASSERT((minor & ~0xffff00ff) == 0,
("Invalid minor (0x%x) in make_dev", minor));
- if (devsw->d_open == NULL) devsw->d_open = noopen;
- if (devsw->d_close == NULL) devsw->d_close = noclose;
+ if (devsw->d_open == NULL) devsw->d_open = nullopen;
+ if (devsw->d_close == NULL) devsw->d_close = nullclose;
if (devsw->d_read == NULL) devsw->d_read = noread;
if (devsw->d_write == NULL) devsw->d_write = nowrite;
if (devsw->d_ioctl == NULL) devsw->d_ioctl = noioctl;
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 6a51745..f33aeb0 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -437,8 +437,6 @@ SYSCTL_INT(_kern_devstat, OID_AUTO, version, CTLFLAG_RD,
static d_mmap_t devstat_mmap;
static struct cdevsw devstat_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_mmap = devstat_mmap,
.d_name = "devstat",
};
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 2b3b76a..985a877 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -39,7 +39,6 @@ static d_open_t cttyopen;
static struct cdevsw ctty_cdevsw = {
.d_open = cttyopen,
- .d_close = nullclose,
.d_name = "ctty",
.d_maj = CDEV_MAJOR,
.d_flags = D_TTY,
diff --git a/sys/netncp/ncp_mod.c b/sys/netncp/ncp_mod.c
index 4c119f9..e56495d 100644
--- a/sys/netncp/ncp_mod.c
+++ b/sys/netncp/ncp_mod.c
@@ -66,8 +66,6 @@ static dev_t ncp_dev;
static d_ioctl_t ncp_ioctl;
static struct cdevsw ncp_cdevsw = {
- .d_open = nullopen,
- .d_close = nullclose,
.d_ioctl = ncp_ioctl,
.d_name = "ncp",
};
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 7d544ab..e3bbba5 100644
--- a/sys/opencrypto/cryptodev.c
+++ b/sys/opencrypto/cryptodev.c
@@ -769,7 +769,6 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
#define CRYPTO_MAJOR 70 /* from openbsd */
static struct cdevsw crypto_cdevsw = {
.d_open = cryptoopen,
- .d_close = nullclose,
.d_read = cryptoread,
.d_write = cryptowrite,
.d_ioctl = cryptoioctl,
OpenPOWER on IntegriCloud