From ad925439e08646e188eb1c0e0be355f0685c8739 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 21 Feb 2004 21:10:55 +0000 Subject: [PATCH] Device megapatch 4/6: Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. --- sys/alpha/alpha/mem.c | 3 ++- sys/alpha/alpha/promcons.c | 3 ++- sys/alpha/tlsb/zs_tlsb.c | 3 ++- sys/amd64/amd64/mem.c | 3 ++- sys/cam/cam_xpt.c | 2 ++ sys/cam/scsi/scsi_ch.c | 2 ++ sys/cam/scsi/scsi_pass.c | 2 ++ sys/cam/scsi/scsi_pt.c | 2 ++ sys/cam/scsi/scsi_sa.c | 3 ++- sys/cam/scsi/scsi_ses.c | 2 ++ sys/cam/scsi/scsi_target.c | 2 ++ sys/coda/coda_fbsd.c | 2 ++ sys/contrib/ipfilter/netinet/ip_fil.c | 2 ++ sys/contrib/ipfilter/netinet/mlfk_ipl.c | 2 ++ sys/dev/aac/aac.c | 2 ++ sys/dev/acpica/acpi.c | 2 ++ sys/dev/adlink/adlink.c | 2 ++ sys/dev/agp/agp.c | 2 ++ sys/dev/amr/amr.c | 2 ++ sys/dev/asr/asr.c | 2 ++ sys/dev/ata/ata-all.c | 2 ++ sys/dev/ata/atapi-tape.c | 3 ++- sys/dev/atkbdc/psm.c | 2 ++ sys/dev/bktr/bktr_os.c | 2 ++ sys/dev/ciss/ciss.c | 3 ++- sys/dev/cx/if_cx.c | 3 ++- sys/dev/cy/cy.c | 3 ++- sys/dev/cy/cy_isa.c | 3 ++- sys/dev/dcons/dcons.c | 3 ++- sys/dev/digi/digi.c | 3 ++- sys/dev/drm/drm_drv.h | 3 ++- sys/dev/fb/fb.c | 2 ++ sys/dev/fdc/fdc.c | 3 ++- sys/dev/firewire/fwdev.c | 6 +++--- sys/dev/hfa/fore_load.c | 2 ++ sys/dev/ida/ida.c | 2 ++ sys/dev/iicbus/iic.c | 2 ++ sys/dev/iir/iir_ctrl.c | 2 ++ sys/dev/ips/ips.c | 2 ++ sys/dev/isp/isp_freebsd.c | 2 ++ sys/dev/joy/joy.c | 2 ++ sys/dev/kbd/kbd.c | 2 ++ sys/dev/led/led.c | 2 ++ sys/dev/matcd/matcd.c | 3 ++- sys/dev/mcd/mcd.c | 4 ++-- sys/dev/md/md.c | 2 ++ sys/dev/mlx/mlx.c | 3 ++- sys/dev/mly/mly.c | 3 ++- sys/dev/mse/mse.c | 2 ++ sys/dev/nmdm/nmdm.c | 5 +++-- sys/dev/null/null.c | 5 +++-- sys/dev/ofw/ofw_console.c | 4 ++-- sys/dev/ofw/openfirmio.c | 2 ++ sys/dev/ofw/openpromio.c | 2 ++ sys/dev/pci/pci_user.c | 2 ++ sys/dev/ppbus/lpt.c | 2 ++ sys/dev/ppbus/pcfclock.c | 2 ++ sys/dev/ppbus/ppi.c | 2 ++ sys/dev/ppbus/pps.c | 2 ++ sys/dev/raidframe/rf_freebsdkintf.c | 2 ++ sys/dev/random/randomdev.c | 2 ++ sys/dev/rc/rc.c | 3 ++- sys/dev/rp/rp.c | 3 ++- sys/dev/sab/sab.c | 3 ++- sys/dev/scd/scd.c | 3 ++- sys/dev/si/si.c | 3 ++- sys/dev/sio/sio.c | 3 ++- sys/dev/smbus/smb.c | 2 ++ sys/dev/snp/snp.c | 2 ++ sys/dev/sound/midi/midi.c | 2 ++ sys/dev/sound/midi/sequencer.c | 2 ++ sys/dev/sound/pcm/dsp.c | 2 ++ sys/dev/sound/pcm/mixer.c | 2 ++ sys/dev/sound/pcm/sndstat.c | 2 ++ sys/dev/speaker/spkr.c | 2 ++ sys/dev/streams/streams.c | 2 ++ sys/dev/syscons/syscons.c | 6 ++---- sys/dev/syscons/sysmouse.c | 3 ++- sys/dev/tdfx/tdfx_pci.c | 2 ++ sys/dev/tga/tga_pci.c | 2 ++ sys/dev/ti/if_ti.c | 2 ++ sys/dev/twe/twe_freebsd.c | 2 ++ sys/dev/uart/uart_tty.c | 3 ++- sys/dev/usb/ucom.c | 3 ++- sys/dev/usb/ufm.c | 2 ++ sys/dev/usb/ugen.c | 2 ++ sys/dev/usb/uhid.c | 2 ++ sys/dev/usb/ulpt.c | 2 ++ sys/dev/usb/ums.c | 2 ++ sys/dev/usb/urio.c | 2 ++ sys/dev/usb/usb.c | 2 ++ sys/dev/usb/uscanner.c | 2 ++ sys/dev/zs/zs.c | 3 ++- sys/fs/coda/coda_fbsd.c | 2 ++ sys/fs/specfs/spec_vnops.c | 16 ++++++++-------- sys/geom/geom_ctl.c | 2 ++ sys/geom/geom_dev.c | 3 ++- sys/i386/acpica/acpi_machdep.c | 2 ++ sys/i386/bios/apm.c | 2 ++ sys/i386/bios/smapi.c | 3 ++- sys/i386/i386/elan-mmcr.c | 2 ++ sys/i386/i386/mem.c | 3 ++- sys/i386/i386/perfmon.c | 2 ++ sys/i386/isa/asc.c | 2 ++ sys/i386/isa/ctx.c | 2 ++ sys/i386/isa/cy.c | 3 ++- sys/i386/isa/gpib.c | 2 ++ sys/i386/isa/gsc.c | 2 ++ sys/i386/isa/istallion.c | 3 ++- sys/i386/isa/mse.c | 2 ++ sys/i386/isa/pcvt/pcvt_drv.c | 4 ++-- sys/i386/isa/spic.c | 2 ++ sys/i386/isa/spigot.c | 2 ++ sys/i386/isa/spkr.c | 2 ++ sys/i386/isa/stallion.c | 3 ++- sys/i386/isa/wt.c | 2 ++ sys/i4b/driver/i4b_ctl.c | 2 ++ sys/i4b/driver/i4b_rbch.c | 2 ++ sys/i4b/driver/i4b_tel.c | 2 ++ sys/i4b/driver/i4b_trace.c | 2 ++ sys/i4b/layer4/i4b_i4bdrv.c | 2 ++ sys/ia64/ia64/mem.c | 3 ++- sys/ia64/ia64/ssc.c | 3 ++- sys/isa/fd.c | 3 ++- sys/isa/psm.c | 2 ++ sys/isa/vga_isa.c | 2 ++ sys/kern/kern_conf.c | 2 ++ sys/kern/kern_descrip.c | 2 ++ sys/kern/subr_bus.c | 2 ++ sys/kern/subr_devstat.c | 2 ++ sys/kern/subr_log.c | 2 ++ sys/kern/tty_cons.c | 3 ++- sys/kern/tty_pty.c | 6 ++++-- sys/kern/tty_tty.c | 3 ++- sys/net/bpf.c | 2 ++ sys/net/if.c | 2 ++ sys/net/if_tap.c | 2 ++ sys/net/if_tun.c | 2 ++ sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 2 ++ .../bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 2 ++ sys/netgraph/ng_device.c | 2 ++ sys/netncp/ncp_mod.c | 2 ++ sys/netsmb/smb_dev.c | 2 ++ sys/nfs4client/nfs4_dev.c | 2 ++ sys/opencrypto/cryptodev.c | 2 ++ sys/pc98/cbus/fdc.c | 3 ++- sys/pc98/cbus/gdc.c | 2 ++ sys/pc98/cbus/olpt.c | 2 ++ sys/pc98/cbus/sio.c | 3 ++- sys/pc98/pc98/fd.c | 3 ++- sys/pc98/pc98/mse.c | 2 ++ sys/pc98/pc98/olpt.c | 2 ++ sys/pc98/pc98/pc98gdc.c | 2 ++ sys/pc98/pc98/sio.c | 3 ++- sys/pc98/pc98/wd_cd.c | 3 ++- sys/pccard/pccard.c | 2 ++ sys/pci/agp.c | 2 ++ sys/pci/if_ti.c | 2 ++ sys/pci/xrpu.c | 2 ++ sys/sparc64/creator/creator_upa.c | 2 ++ sys/sparc64/sparc64/mem.c | 3 ++- sys/sys/conf.h | 9 ++++++++- sys/sys/linedisc.h | 9 ++++++++- 163 files changed, 349 insertions(+), 73 deletions(-) diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index 7edc6f13dd92..6c30c9796603 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -83,6 +83,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -91,7 +92,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; struct mem_range_softc mem_range_softc; diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 473f0fc515e5..4d41abced4f0 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -64,11 +64,12 @@ static d_close_t promclose; static d_ioctl_t promioctl; static struct cdevsw prom_cdevsw = { + .d_version = D_VERSION, .d_open = promopen, .d_close = promclose, .d_ioctl = promioctl, .d_name = "prom", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 035ac45678c7..749dd6da5eb8 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -71,11 +71,12 @@ static d_close_t zsclose; static d_ioctl_t zsioctl; static struct cdevsw zs_cdevsw = { + .d_version = D_VERSION, .d_open = zsopen, .d_close = zsclose, .d_ioctl = zsioctl, .d_name = "zs", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static void zsstart(struct tty *); diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index c2c702f0b464..74c6e10c1135 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -81,6 +81,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -89,7 +90,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 03eaf544439e..7e3bfce96196 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -636,6 +636,8 @@ static d_close_t xptclose; static d_ioctl_t xptioctl; static struct cdevsw xpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = xptopen, .d_close = xptclose, .d_ioctl = xptioctl, diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index a9ed37376c23..7caaf0a2d2a2 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -212,6 +212,8 @@ static struct periph_driver chdriver = PERIPHDRIVER_DECLARE(ch, chdriver); static struct cdevsw ch_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = chopen, .d_close = chclose, .d_ioctl = chioctl, diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 13c1017e5ca1..67c73d9216c2 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -105,6 +105,8 @@ static struct periph_driver passdriver = PERIPHDRIVER_DECLARE(pass, passdriver); static struct cdevsw pass_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = passopen, .d_close = passclose, .d_ioctl = passioctl, diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index cc3afa6ce58c..9e053f88d09a 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -118,6 +118,8 @@ PERIPHDRIVER_DECLARE(pt, ptdriver); static struct cdevsw pt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ptopen, .d_close = ptclose, .d_read = physread, diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index c41e4166ef91..b1fbd225a74e 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -425,6 +425,7 @@ PERIPHDRIVER_DECLARE(sa, sadriver); static struct cdevsw sa_cdevsw = { + .d_version = D_VERSION, .d_open = saopen, .d_close = saclose, .d_read = physread, @@ -432,7 +433,7 @@ static struct cdevsw sa_cdevsw = { .d_ioctl = saioctl, .d_strategy = sastrategy, .d_name = "sa", - .d_flags = D_TAPE, + .d_flags = D_TAPE | D_NEEDGIANT, }; static int diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index 8f594ae2bcd5..a0a2f14b3802 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -175,10 +175,12 @@ static struct periph_driver sesdriver = { PERIPHDRIVER_DECLARE(ses, sesdriver); static struct cdevsw ses_cdevsw = { + .d_version = D_VERSION, .d_open = sesopen, .d_close = sesclose, .d_ioctl = sesioctl, .d_name = "ses", + .d_flags = D_NEEDGIANT, }; static void diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 7e0d28fbd83b..9310efe434aa 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -105,6 +105,8 @@ static struct filterops targread_filtops = { 1, NULL, targreadfiltdetach, targreadfilt }; static struct cdevsw targ_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = targopen, .d_close = targclose, .d_read = targread, diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 1c061b1ae6ef..9dc260c04ee5 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #define VC_DEV_NO 93 static struct cdevsw codadevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = vc_nb_open, .d_close = vc_nb_close, .d_read = vc_nb_read, diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c index 6b9bafb053da..8a36dc3aae5e 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ b/sys/contrib/ipfilter/netinet/ip_fil.c @@ -206,6 +206,8 @@ toid_t ipfr_slowtimer_ch; defined(_KERNEL) # include const struct cdevsw ipl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, iplopen, iplclose, iplread, nowrite, iplioctl, nostop, notty, nopoll, nommap, }; diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index f1500039bb8f..df1bb75a2cfe 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -105,6 +105,8 @@ SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_minttllog, CTLFLAG_RW, #define CDEV_MAJOR 79 static struct cdevsw ipl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = iplopen, .d_close = iplclose, .d_read = iplread, diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 0d08883e26e8..77e18c8345ee 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -181,6 +181,8 @@ static int aac_return_aif(struct aac_softc *sc, caddr_t uptr); static int aac_query_disk(struct aac_softc *sc, caddr_t uptr); static struct cdevsw aac_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = aac_open, .d_close = aac_close, .d_ioctl = aac_ioctl, diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 3c7b038e9a85..aefd7e925dd8 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -67,6 +67,8 @@ static d_close_t acpiclose; static d_ioctl_t acpiioctl; static struct cdevsw acpi_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = acpiopen, .d_close = acpiclose, .d_ioctl = acpiioctl, diff --git a/sys/dev/adlink/adlink.c b/sys/dev/adlink/adlink.c index 909f2ba9a28c..f8a7253f6cc3 100644 --- a/sys/dev/adlink/adlink.c +++ b/sys/dev/adlink/adlink.c @@ -393,6 +393,8 @@ adlink_intr(void *arg) } static struct cdevsw adlink_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = adlink_open, .d_ioctl = adlink_ioctl, .d_mmap = adlink_mmap, diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 6f09660fad6a..6a01e20565ed 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -70,6 +70,8 @@ static d_ioctl_t agp_ioctl; static d_mmap_t agp_mmap; static struct cdevsw agp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = agp_open, .d_close = agp_close, .d_ioctl = agp_ioctl, diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 8eece8e05b6f..0fce75505c24 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -91,6 +91,8 @@ static d_close_t amr_close; static d_ioctl_t amr_ioctl; static struct cdevsw amr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = amr_open, .d_close = amr_close, .d_ioctl = amr_ioctl, diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index 481ff305d882..2d2ba205d153 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -578,6 +578,8 @@ DATA_SET (mode0_pciset, mode0_pcidev); */ #define CDEV_MAJOR 154 /* preferred default character major */ STATIC struct cdevsw asr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = asr_open, .d_close = asr_close, .d_ioctl = asr_ioctl, diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index bd59faf2b44f..27c2c1360b3e 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); /* device structures */ static d_ioctl_t ata_ioctl; static struct cdevsw ata_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ata_ioctl, .d_name = "ata", }; diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index cd45cd0000ea..aef27a688325 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -53,6 +53,7 @@ static d_close_t ast_close; static d_ioctl_t ast_ioctl; static d_strategy_t ast_strategy; static struct cdevsw ast_cdevsw = { + .d_version = D_VERSION, .d_open = ast_open, .d_close = ast_close, .d_read = physread, @@ -61,7 +62,7 @@ static struct cdevsw ast_cdevsw = { .d_strategy = ast_strategy, .d_name = "ast", .d_maj = 119, - .d_flags = D_TAPE | D_TRACKCLOSE | D_NOGIANT, + .d_flags = D_TAPE | D_TRACKCLOSE, }; /* prototypes */ diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index e886e8cc9e4b..dd2fd7e2cc89 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -348,6 +348,8 @@ static driver_t psm_driver = { static struct cdevsw psm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = psmopen, .d_close = psmclose, .d_read = psmread, diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index 92c7fbea8d74..be2ed086d391 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -258,6 +258,8 @@ static d_mmap_t bktr_mmap; static d_poll_t bktr_poll; static struct cdevsw bktr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = bktr_open, .d_close = bktr_close, .d_read = bktr_read, diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 843577de431d..9a4603c95e14 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -212,8 +212,9 @@ static d_open_t ciss_open; static d_close_t ciss_close; static d_ioctl_t ciss_ioctl; - static struct cdevsw ciss_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ciss_open, .d_close = ciss_close, .d_ioctl = ciss_ioctl, diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index 52fc80dcbce6..842348eb1f72 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -2550,6 +2550,7 @@ static struct cdevsw cx_cdevsw = { }; #else /* __FreeBSD_version > 501000 */ static struct cdevsw cx_cdevsw = { + .d_version = D_VERSION, .d_open = cx_open, .d_close = cx_close, .d_read = cx_read, @@ -2557,7 +2558,7 @@ static struct cdevsw cx_cdevsw = { .d_ioctl = cx_ioctl, .d_name = "cx", .d_maj = CDEV_MAJOR, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #endif diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 2a715c03046b..7207846b6380 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -386,12 +386,13 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int comconsole = -1; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 2a715c03046b..7207846b6380 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -386,12 +386,13 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int comconsole = -1; diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c index 8e6732626c09..d798f84f8f11 100644 --- a/sys/dev/dcons/dcons.c +++ b/sys/dev/dcons/dcons.c @@ -88,11 +88,12 @@ static d_ioctl_t dcons_ioctl; static struct cdevsw dcons_cdevsw = { #if __FreeBSD_version >= 500104 + .d_version = D_VERSION, .d_open = dcons_open, .d_close = dcons_close, .d_ioctl = dcons_ioctl, .d_name = "dcons", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, #else /* open */ dcons_open, /* close */ dcons_close, diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 87ebbef528c0..e2cb568fe1dd 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -142,13 +142,14 @@ const struct digi_control_signals digi_normal_signals = { }; static struct cdevsw digi_sw = { + .d_version = D_VERSION, .d_open = digiopen, .d_close = digiclose, .d_read = digiread, .d_write = digiwrite, .d_ioctl = digiioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static void diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index e0dfbccf5257..848794ae1cfc 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -212,6 +212,7 @@ const char *DRM(find_description)(int vendor, int device); #ifdef __FreeBSD__ static struct cdevsw DRM(cdevsw) = { + .d_version = D_VERSION, .d_open = DRM( open ), .d_close = DRM( close ), .d_read = DRM( read ), @@ -219,7 +220,7 @@ static struct cdevsw DRM(cdevsw) = { .d_poll = DRM( poll ), .d_mmap = DRM( mmap ), .d_name = DRIVER_NAME, - .d_flags = D_TRACKCLOSE, + .d_flags = D_TRACKCLOSE | D_NEEDGIANT, #if __FreeBSD_version < 500000 .d_bmaj = -1 #endif diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 5ce670841029..38b967092795 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -363,6 +363,8 @@ static d_mmap_t fbmmap; static struct cdevsw fb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = fbopen, .d_close = fbclose, .d_read = fbread, diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 5a506334d5c4..808c537e3f0f 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -482,6 +482,7 @@ fdin_rd(fdc_p fdc) } static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -489,7 +490,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 9a34ff95fd3c..b5a7d5d03c41 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -73,9 +73,9 @@ static d_write_t fw_write; static d_mmap_t fw_mmap; static d_strategy_t fw_strategy; -struct cdevsw firewire_cdevsw = -{ +struct cdevsw firewire_cdevsw = { #if __FreeBSD_version >= 500104 + .d_version = D_VERSION, .d_open = fw_open, .d_close = fw_close, .d_read = fw_read, @@ -85,7 +85,7 @@ struct cdevsw firewire_cdevsw = .d_mmap = fw_mmap, .d_strategy = fw_strategy, .d_name = "fw", - .d_flags = D_MEM + .d_flags = D_MEM | D_NEEDGIANT #else fw_open, fw_close, fw_read, fw_write, fw_ioctl, fw_poll, fw_mmap, fw_strategy, "fw", CDEV_MAJOR, diff --git a/sys/dev/hfa/fore_load.c b/sys/dev/hfa/fore_load.c index fffdf654632e..77ddaaeabd4d 100644 --- a/sys/dev/hfa/fore_load.c +++ b/sys/dev/hfa/fore_load.c @@ -505,6 +505,8 @@ fore_reset(fup) * Driver entry points */ static struct cdevsw fore_cdev = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_maj = -1, }; diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index db4813eecdfb..47f27a78bd4c 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -66,6 +66,8 @@ static int ida_wait(struct ida_softc *ida, struct ida_qcb *qcb); static d_ioctl_t ida_ioctl; static struct cdevsw ida_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ida_ioctl, .d_name = "ida", }; diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index 0951f1f5847d..7f4221a60dd5 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -93,6 +93,8 @@ static d_read_t iicread; static d_ioctl_t iicioctl; static struct cdevsw iic_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = iicopen, .d_close = iicclose, .d_read = iicread, diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index 8417595ef427..9aeb099ecc67 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -70,6 +70,8 @@ static d_ioctl_t iir_ioctl; /* Normally, this is a static structure. But we need it in pci/iir_pci.c */ static struct cdevsw iir_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = iir_open, .d_close = iir_close, .d_read = iir_read, diff --git a/sys/dev/ips/ips.c b/sys/dev/ips/ips.c index 9b076d299d11..d735f83be97f 100644 --- a/sys/dev/ips/ips.c +++ b/sys/dev/ips/ips.c @@ -38,6 +38,8 @@ static d_close_t ips_close; static d_ioctl_t ips_ioctl; static struct cdevsw ips_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ips_open, .d_close = ips_close, .d_ioctl = ips_ioctl, diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index e7526ab94207..460d43001468 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -53,6 +53,8 @@ static void isp_action(struct cam_sim *, union ccb *); static struct cdevsw isp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ispioctl, .d_name = "isp", }; diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 2ef286bebef9..4746e77b49a0 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -69,6 +69,8 @@ static d_read_t joyread; static d_ioctl_t joyioctl; static struct cdevsw joy_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = joyopen, .d_close = joyclose, .d_read = joyread, diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index e7a67db70957..485ce709d6b8 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -433,6 +433,8 @@ static d_poll_t genkbdpoll; static struct cdevsw kbd_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = genkbdopen, .d_close = genkbdclose, .d_read = genkbdread, diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index 77c68efe9ca6..7177547c39d0 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -211,6 +211,8 @@ led_write(dev_t dev, struct uio *uio, int ioflag) } static struct cdevsw led_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_write = led_write, .d_name = "LED", }; diff --git a/sys/dev/matcd/matcd.c b/sys/dev/matcd/matcd.c index bc57012c93dc..9e28d25c7013 100644 --- a/sys/dev/matcd/matcd.c +++ b/sys/dev/matcd/matcd.c @@ -740,6 +740,7 @@ static int matcd_pitch(int ldrive, int cdrive, int controller, ---------------------------------------------------------------------------*/ static struct cdevsw matcd_cdevsw = { + .d_version = D_VERSION, .d_open = matcdopen, /* open */ .d_close = matcdclose, /* close */ .d_read = physread, /* read */ @@ -750,7 +751,7 @@ static struct cdevsw matcd_cdevsw = { .d_strategy = matcdstrategy, /* strategy */ .d_name = "matcd", /* name */ .d_maj = RAW_DEVICE, /* maj */ - .d_flags = D_DISK, /* flags */ + .d_flags = D_DISK | D_NEEDGIANT, }; diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 285d57dcbf24..ebc233e89002 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -160,15 +160,15 @@ static d_close_t mcdclose; static d_ioctl_t mcdioctl; static d_strategy_t mcdstrategy; - static struct cdevsw mcd_cdevsw = { + .d_version = D_VERSION, .d_open = mcdopen, .d_close = mcdclose, .d_read = physread, .d_ioctl = mcdioctl, .d_strategy = mcdstrategy, .d_name = "mcd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; #define MCD_RETRYS 5 diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index b0f179504d83..9b68ce291148 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -116,6 +116,8 @@ static dev_t status_dev = 0; static d_ioctl_t mdctlioctl; static struct cdevsw mdctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = mdctlioctl, .d_name = MD_NAME, }; diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index bf9412c1e989..67d1b2b49f80 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -53,8 +53,9 @@ #include #include - static struct cdevsw mlx_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mlx_open, .d_close = mlx_close, .d_ioctl = mlx_ioctl, diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 6dacf2778fd7..5f4c1eca06bb 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -149,8 +149,9 @@ static driver_t mly_pci_driver = { static devclass_t mly_devclass; DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0); - static struct cdevsw mly_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mly_user_open, .d_close = mly_user_close, .d_ioctl = mly_user_ioctl, diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index b2c821b59154..8cd40f1bbd03 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -140,6 +140,8 @@ static d_ioctl_t mseioctl; static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 27625068a08a..22b9b51fb768 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -72,13 +72,14 @@ static d_write_t nmdmwrite; static d_ioctl_t nmdmioctl; static struct cdevsw nmdm_cdevsw = { + .d_version = D_VERSION, .d_open = nmdmopen, .d_close = nmdmclose, .d_read = nmdmread, .d_write = nmdmwrite, .d_ioctl = nmdmioctl, - .d_name = "nmdm", - .d_flags = D_TTY | D_PSEUDO, + .d_name = "nmdn", + .d_flags = D_TTY | D_PSEUDO | D_NEEDGIANT, }; #define BUFSIZ 100 /* Chunk size iomoved to/from user */ diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index 84dae3010ddf..314f460fe544 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -52,20 +52,21 @@ static d_read_t zero_read; #define ZERO_MINOR 12 static struct cdevsw null_cdevsw = { + .d_version = D_VERSION, .d_read = (d_read_t *)nullop, .d_write = null_write, .d_ioctl = null_ioctl, .d_name = "null", .d_maj = CDEV_MAJOR, - .d_flags = D_NOGIANT, }; static struct cdevsw zero_cdevsw = { + .d_version = D_VERSION, .d_read = zero_read, .d_write = null_write, .d_name = "zero", .d_maj = CDEV_MAJOR, - .d_flags = D_MMAP_ANON | D_NOGIANT, + .d_flags = D_MMAP_ANON, }; static void *zbuf; diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index dd5537661e5e..506b894aeacf 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -51,13 +51,13 @@ static d_open_t ofw_dev_open; static d_close_t ofw_dev_close; static d_ioctl_t ofw_dev_ioctl; - static struct cdevsw ofw_cdevsw = { + .d_version = D_VERSION, .d_open = ofw_dev_open, .d_close = ofw_dev_close, .d_ioctl = ofw_dev_ioctl, .d_name = "ofw", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct tty *ofw_tp = NULL; diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index 37f10b5202a9..8d8302249c9f 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -67,6 +67,8 @@ static d_ioctl_t openfirm_ioctl; #define OPENFIRM_MINOR 0 static struct cdevsw openfirm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = openfirm_ioctl, .d_name = "openfirm", }; diff --git a/sys/dev/ofw/openpromio.c b/sys/dev/ofw/openpromio.c index d4c98518b4ab..5bf5e698d1c6 100644 --- a/sys/dev/ofw/openpromio.c +++ b/sys/dev/ofw/openpromio.c @@ -58,6 +58,8 @@ static int openprom_node_valid(phandle_t node); static int openprom_node_search(phandle_t root, phandle_t node); static struct cdevsw openprom_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = openprom_open, .d_close = openprom_close, .d_ioctl = openprom_ioctl, diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 3c279781ed54..0ce8da9e3f4e 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -74,6 +74,8 @@ static d_ioctl_t pci_ioctl; #endif struct cdevsw pcicdev = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = pci_open, .d_close = pci_close, .d_ioctl = pci_ioctl, diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 687e7ade284f..f0bdea72e3d0 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -190,6 +190,8 @@ static d_read_t lptread; static d_ioctl_t lptioctl; static struct cdevsw lpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_read = lptread, diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index bf0a01d64430..fd4c010d66f2 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -68,6 +68,8 @@ static d_close_t pcfclock_close; static d_read_t pcfclock_read; static struct cdevsw pcfclock_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = pcfclock_open, .d_close = pcfclock_close, .d_read = pcfclock_read, diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index c2783a66ea71..7df5851ca03a 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -91,6 +91,8 @@ static d_write_t ppiwrite; static d_read_t ppiread; static struct cdevsw ppi_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ppiopen, .d_close = ppiclose, .d_read = ppiread, diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index e7e1373ed3cd..20a8b02e7054 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -63,6 +63,8 @@ static d_close_t ppsclose; static d_ioctl_t ppsioctl; static struct cdevsw pps_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ppsopen, .d_close = ppsclose, .d_ioctl = ppsioctl, diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index 78490f8266f3..0dfc43623e01 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -215,6 +215,8 @@ d_close_t raidctlclose; d_ioctl_t raidctlioctl; static struct cdevsw raidctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = raidctlopen, .d_close = raidctlclose, .d_ioctl = raidctlioctl, diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index d0e272eea48b..bc5f1666b1ad 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -64,6 +64,8 @@ static d_poll_t random_poll; #define RANDOM_FIFO_MAX 256 /* How many events to queue up */ static struct cdevsw random_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_close = random_close, .d_read = random_read, .d_write = random_write, diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index e519177db935..b7a8e12298f5 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -147,11 +147,12 @@ static d_close_t rcclose; static d_ioctl_t rcioctl; static struct cdevsw rc_cdevsw = { + .d_version = D_VERSION, .d_open = rcopen, .d_close = rcclose, .d_ioctl = rcioctl, .d_name = "rc", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static devclass_t rc_devclass; diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 1088de23496f..3f9f49f33ac8 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -572,12 +572,13 @@ static d_write_t rpwrite; static d_ioctl_t rpioctl; struct cdevsw rp_cdevsw = { + .d_version = D_VERSION, .d_open = rpopen, .d_close = rpclose, .d_write = rpwrite, .d_ioctl = rpioctl, .d_name = "rp", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int rp_num_ports_open = 0; diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index 36b6c1f9c53f..af1bf131278d 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -161,11 +161,12 @@ static void sabttystop(struct tty *tp, int rw); static int sabttyparam(struct tty *tp, struct termios *t); static struct cdevsw sabtty_cdevsw = { + .d_version = D_VERSION, .d_open = sabttyopen, .d_close = sabttyclose, .d_ioctl = sabttyioctl, .d_name = "sabtty", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static device_method_t sab_methods[] = { diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index d455e095902f..2a66a00189c7 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -147,13 +147,14 @@ static d_strategy_t scdstrategy; static struct cdevsw scd_cdevsw = { + .d_version = D_VERSION, .d_open = scdopen, .d_close = scdclose, .d_read = physread, .d_ioctl = scdioctl, .d_strategy = scdstrategy, .d_name = "scd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; int diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index fa0d9dba4f6d..1b76ad07abcc 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -118,12 +118,13 @@ static d_write_t siwrite; static d_ioctl_t siioctl; static struct cdevsw si_cdevsw = { + .d_version = D_VERSION, .d_open = siopen, .d_close = siclose, .d_write = siwrite, .d_ioctl = siioctl, .d_name = "si", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int si_Nports; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 42c78b6fd587..93ed290e076d 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -323,13 +323,14 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_read = sioread, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = sio_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int comconsole = -1; diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index 280bda52da49..85ab273b8b6a 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -88,6 +88,8 @@ static d_read_t smbread; static d_ioctl_t smbioctl; static struct cdevsw smb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = smbopen, .d_close = smbclose, .d_read = smbread, diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 2c1c3c6fd6ba..543a7242b2b4 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -39,6 +39,8 @@ static d_ioctl_t snpioctl; static d_poll_t snppoll; static struct cdevsw snp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = snpopen, .d_close = snpclose, .d_read = snpread, diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 2da6415dee82..a9d018496bd7 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -70,6 +70,8 @@ static int midi_readstatus(char *buf, int *ptr, struct uio *uio); #define CDEV_MAJOR MIDI_CDEV_MAJOR static struct cdevsw midi_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = midiopen, .d_close = midiclose, .d_read = midiread, diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index 17c79efaaaf2..bea493616d40 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -135,6 +135,8 @@ static d_poll_t seqpoll; #define CDEV_MAJOR SEQ_CDEV_MAJOR static struct cdevsw seq_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = seqopen, .d_close = seqclose, .d_read = seqread, diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index cffbe6bb1640..ac00603b8d48 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -42,6 +42,8 @@ static d_poll_t dsp_poll; static d_mmap_t dsp_mmap; struct cdevsw dsp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = dsp_open, .d_close = dsp_close, .d_read = dsp_read, diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 61d6c09003f6..b5a67edfc61f 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -73,6 +73,8 @@ static d_open_t mixer_open; static d_close_t mixer_close; static struct cdevsw mixer_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mixer_open, .d_close = mixer_close, .d_ioctl = mixer_ioctl, diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 77c63f3eb78b..e96a8025fde5 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -41,6 +41,8 @@ static d_close_t sndstat_close; static d_read_t sndstat_read; static struct cdevsw sndstat_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = sndstat_open, .d_close = sndstat_close, .d_read = sndstat_read, diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index e82ef46c9f40..e73ab8d73324 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -34,6 +34,8 @@ static d_write_t spkrwrite; static d_ioctl_t spkrioctl; static struct cdevsw spkr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spkropen, .d_close = spkrclose, .d_write = spkrwrite, diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 8e5ac5713bbd..b67e39b83862 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -102,6 +102,8 @@ static struct fileops svr4_netops = { }; static struct cdevsw streams_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = streamsopen, .d_name = "streams", }; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index f05de849f341..69ab21ff412e 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -194,8 +194,6 @@ static int update_kbd_state(scr_stat *scp, int state, int mask); static int update_kbd_leds(scr_stat *scp, int which); static timeout_t blink_screen; -#define CDEV_MAJOR 12 - static cn_probe_t sccnprobe; static cn_init_t sccninit; static cn_getc_t sccngetc; @@ -218,14 +216,14 @@ static d_ioctl_t scioctl; static d_mmap_t scmmap; static struct cdevsw sc_cdevsw = { + .d_version = D_VERSION, .d_open = scopen, .d_close = scclose, .d_read = scread, .d_ioctl = scioctl, .d_mmap = scmmap, .d_name = "sc", - .d_maj = CDEV_MAJOR, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index 08847a0dad5e..7aa72cffd31c 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -49,11 +49,12 @@ static d_close_t smclose; static d_ioctl_t smioctl; static struct cdevsw sm_cdevsw = { + .d_version = D_VERSION, .d_open = smopen, .d_close = smclose, .d_ioctl = smioctl, .d_name = "sysmouse", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; /* local variables */ diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index dda1eb5a27eb..ac07d80b27cf 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -104,6 +104,8 @@ LINUX_IOCTL_SET(tdfx, LINUX_IOCTL_TDFX_MIN, LINUX_IOCTL_TDFX_MAX); /* Char. Dev. file operations structure */ static struct cdevsw tdfx_cdev = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = tdfx_open, .d_close = tdfx_close, .d_ioctl = tdfx_ioctl, diff --git a/sys/dev/tga/tga_pci.c b/sys/dev/tga/tga_pci.c index f6f336dfa73c..902b7daea3ae 100644 --- a/sys/dev/tga/tga_pci.c +++ b/sys/dev/tga/tga_pci.c @@ -100,6 +100,8 @@ static struct gfb_type tga_devs[] = { #ifdef FB_INSTALL_CDEV static struct cdevsw tga_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = pcigfb_open, .d_close = pcigfb_close, .d_read = pcigfb_read, diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 9e8c8f1165e7..b0118d63d982 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -186,6 +186,8 @@ static d_close_t ti_close; static d_ioctl_t ti_ioctl2; static struct cdevsw ti_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ti_open, .d_close = ti_close, .d_ioctl = ti_ioctl2, diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 6a3a8ff09db3..32175c13a379 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -67,6 +67,8 @@ static d_close_t twe_close; static d_ioctl_t twe_ioctl_wrapper; static struct cdevsw twe_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = twe_open, .d_close = twe_close, .d_ioctl = twe_ioctl_wrapper, diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index 66ce71658e25..94ddb953052b 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -67,11 +67,12 @@ static d_close_t uart_tty_close; static d_ioctl_t uart_tty_ioctl; static struct cdevsw uart_cdevsw = { + .d_version = D_VERSION, .d_open = uart_tty_open, .d_close = uart_tty_close, .d_ioctl = uart_tty_ioctl, .d_name = uart_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct uart_devinfo uart_console; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index ad0a3d1ec099..4bea235f68a9 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -128,13 +128,14 @@ Static d_ioctl_t ucomioctl; static struct cdevsw ucom_cdevsw = { + .d_version = D_VERSION, .d_open = ucomopen, .d_close = ucomclose, .d_read = ucomread, .d_write = ucomwrite, .d_ioctl = ucomioctl, .d_name = "ucom", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, #if __FreeBSD_version < 500014 .d_bmaj = -1, #endif diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 26916f1f4f39..db008ea91eb4 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -89,6 +89,8 @@ d_close_t ufmclose; d_ioctl_t ufmioctl; Static struct cdevsw ufm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ufmopen, .d_close = ufmclose, .d_ioctl = ufmioctl, diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 408d14b06bdc..a9074235254b 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -151,6 +151,8 @@ d_poll_t ugenpoll; Static struct cdevsw ugen_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ugenopen, .d_close = ugenclose, .d_read = ugenread, diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index ec46474a1c0b..a574d1f0279f 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -156,6 +156,8 @@ d_poll_t uhidpoll; Static struct cdevsw uhid_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = uhidopen, .d_close = uhidclose, .d_read = uhidread, diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 3dadd00633f2..48aeb0956edc 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -147,6 +147,8 @@ Static d_ioctl_t ulptioctl; Static struct cdevsw ulpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ulptopen, .d_close = ulptclose, .d_write = ulptwrite, diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 4c0d598045da..2104ee3b1d70 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -154,6 +154,8 @@ Static d_poll_t ums_poll; Static struct cdevsw ums_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ums_open, .d_close = ums_close, .d_read = ums_read, diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 57979cdf3f38..eaec4e5b1007 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -117,6 +117,8 @@ d_ioctl_t urioioctl; Static struct cdevsw urio_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = urioopen, .d_close = urioclose, .d_read = urioread, diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 6ff8ed3e81e8..44a554449b51 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -146,6 +146,8 @@ d_ioctl_t usbioctl; d_poll_t usbpoll; struct cdevsw usb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = usbopen, .d_close = usbclose, .d_read = usbread, diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index ab46721c113a..02b8e0e5e786 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -268,6 +268,8 @@ d_poll_t uscannerpoll; Static struct cdevsw uscanner_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = uscanneropen, .d_close = uscannerclose, .d_read = uscannerread, diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c index c3895a6457f2..5f5ceb88b5af 100644 --- a/sys/dev/zs/zs.c +++ b/sys/dev/zs/zs.c @@ -152,11 +152,12 @@ static void zsttystop(struct tty *tp, int rw); static int zsttyparam(struct tty *tp, struct termios *t); static struct cdevsw zstty_cdevsw = { + .d_version = D_VERSION, .d_open = zsttyopen, .d_close = zsttyclose, .d_ioctl = zsttyioctl, .d_name = "zstty", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct zstty_softc *zstty_cons; diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 1c061b1ae6ef..9dc260c04ee5 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #define VC_DEV_NO 93 static struct cdevsw codadevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = vc_nb_open, .d_close = vc_nb_close, .d_read = vc_nb_read, diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 31d9bfe9f578..4682b5df6190 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -194,7 +194,7 @@ spec_open(ap) vp->v_vflag |= VV_ISTTY; VOP_UNLOCK(vp, 0, td); - if(dsw->d_flags & D_NOGIANT) { + if(!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); if (dsw->d_fdopen != NULL) error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx); @@ -267,7 +267,7 @@ spec_read(ap) dsw = devsw(dev); VOP_UNLOCK(vp, 0, td); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_read(dev, uio, ap->a_ioflag); PICKUP_GIANT(); @@ -307,7 +307,7 @@ spec_write(ap) resid = uio->uio_resid; VOP_UNLOCK(vp, 0, td); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_write(dev, uio, ap->a_ioflag); PICKUP_GIANT(); @@ -342,7 +342,7 @@ spec_ioctl(ap) dev = ap->a_vp->v_rdev; dsw = devsw(dev); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_ioctl(dev, ap->a_command, ap->a_data, ap->a_fflag, ap->a_td); @@ -371,7 +371,7 @@ spec_poll(ap) dev = ap->a_vp->v_rdev; dsw = devsw(dev); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_poll(dev, ap->a_events, ap->a_td); PICKUP_GIANT(); @@ -394,7 +394,7 @@ spec_kqfilter(ap) dev = ap->a_vp->v_rdev; dsw = devsw(dev); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_kqfilter(dev, ap->a_kn); PICKUP_GIANT(); @@ -509,7 +509,7 @@ spec_xstrategy(struct vnode *vp, struct buf *bp) ("No strategy on dev %s responsible for buffer %p\n", devtoname(bp->b_dev), bp)); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { /* XXX: notyet DROP_GIANT(); */ DEV_STRATEGY(bp); /* XXX: notyet PICKUP_GIANT(); */ @@ -631,7 +631,7 @@ spec_close(ap) return (0); } VI_UNLOCK(vp); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_close(dev, ap->a_fflag, S_IFCHR, td); PICKUP_GIANT(); diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index 43a03135cd30..3e50eb350889 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$"); static d_ioctl_t g_ctl_ioctl; static struct cdevsw g_ctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = g_ctl_ioctl, .d_name = "g_ctl", }; diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 97abc2a893d9..9ad3f70b0f0e 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -58,6 +58,7 @@ static d_strategy_t g_dev_strategy; static d_ioctl_t g_dev_ioctl; static struct cdevsw g_dev_cdevsw = { + .d_version = D_VERSION, .d_open = g_dev_open, .d_close = g_dev_close, .d_read = physread, @@ -66,7 +67,7 @@ static struct cdevsw g_dev_cdevsw = { .d_strategy = g_dev_strategy, .d_name = "g_dev", .d_maj = GEOM_MAJOR, - .d_flags = D_DISK | D_TRACKCLOSE | D_NOGIANT, + .d_flags = D_DISK | D_TRACKCLOSE, }; static g_taste_t g_dev_taste; diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index a6c186a9a610..5d4f0a4eb400 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -73,6 +73,8 @@ static d_ioctl_t apmioctl; static d_poll_t apmpoll; static struct cdevsw apm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = apmopen, .d_close = apmclose, .d_write = apmwrite, diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 1e2371fef54a..6145d9f71e98 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -108,6 +108,8 @@ static d_ioctl_t apmioctl; static d_poll_t apmpoll; static struct cdevsw apm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = apmopen, .d_close = apmclose, .d_write = apmwrite, diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c index 200bcfc760fb..3e9aab8189f7 100644 --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -75,9 +75,10 @@ devclass_t smapi_devclass; static d_ioctl_t smapi_ioctl; static struct cdevsw smapi_cdevsw = { + .d_version = D_VERSION, .d_ioctl = smapi_ioctl, .d_name = "smapi", - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; static void smapi_identify (driver_t *, device_t); diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index 9e3de8f5ef41..80d8759b3cce 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -327,6 +327,8 @@ static d_ioctl_t elan_ioctl; static d_mmap_t elan_mmap; static struct cdevsw elan_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = elan_ioctl, .d_mmap = elan_mmap, .d_name = "elan", diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 85011671e288..342ced5fad7e 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -80,6 +80,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -88,7 +89,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index 3b765f49223a..eaccb5a6ba1b 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -72,6 +72,8 @@ static void perfmon_init_dev(void *); SYSINIT(cpu, SI_SUB_DRIVERS, SI_ORDER_ANY, perfmon_init_dev, NULL); static struct cdevsw perfmon_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = perfmon_open, .d_close = perfmon_close, .d_ioctl = perfmon_ioctl, diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 8aff8c105f62..140ae5a060e1 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -197,6 +197,8 @@ static d_poll_t ascpoll; static struct cdevsw asc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ascopen, .d_close = ascclose, .d_read = ascread, diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index 28adedc60f48..5d18a7beed9e 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -143,6 +143,8 @@ static d_write_t ctxwrite; static d_ioctl_t ctxioctl; static struct cdevsw ctx_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ctxopen, .d_close = ctxclose, .d_read = ctxread, diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 2a715c03046b..7207846b6380 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -386,12 +386,13 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int comconsole = -1; diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c index 480448a14071..0a653fe1c239 100644 --- a/sys/i386/isa/gpib.c +++ b/sys/i386/isa/gpib.c @@ -73,6 +73,8 @@ static d_write_t gpwrite; static d_ioctl_t gpioctl; static struct cdevsw gp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gpopen, .d_close = gpclose, .d_write = gpwrite, diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c index d4dff76327a8..6cd11227914e 100644 --- a/sys/i386/isa/gsc.c +++ b/sys/i386/isa/gsc.c @@ -192,6 +192,8 @@ static d_read_t gscread; static d_ioctl_t gscioctl; static struct cdevsw gsc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gscopen, .d_close = gscclose, .d_read = gscread, diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index ee82892b6f14..f6f10b180eb4 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -643,13 +643,14 @@ COMPAT_ISA_DRIVER(stli, stlidriver); */ static struct cdevsw stli_cdevsw = { + .d_version = D_VERSION, .d_open = stliopen, .d_close = stliclose, .d_read = stliread, .d_write = stliwrite, .d_ioctl = stliioctl, .d_name = stli_drvname, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #endif diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index b2c821b59154..8cd40f1bbd03 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -140,6 +140,8 @@ static d_ioctl_t mseioctl; static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index af16af93b75c..0b4fdc04d0fd 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -93,14 +93,14 @@ static d_close_t pcvt_close; static d_ioctl_t pcvt_ioctl; static d_mmap_t pcvt_mmap; - static struct cdevsw vt_cdevsw = { + .d_version = D_VERSION, .d_open = pcvt_open, .d_close = pcvt_close, .d_ioctl = pcvt_ioctl, .d_mmap = pcvt_mmap, .d_name = "vt", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int pcvt_probe(device_t dev); diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index e73b8b6dbc05..a649f13e1003 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -85,6 +85,8 @@ static d_ioctl_t spicioctl; static d_poll_t spicpoll; static struct cdevsw spic_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spicopen, .d_close = spicclose, .d_read = spicread, diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index dd23abd690d2..b94233a92a2a 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -105,6 +105,8 @@ static d_ioctl_t spigot_ioctl; static d_mmap_t spigot_mmap; static struct cdevsw spigot_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spigot_open, .d_close = spigot_close, .d_read = spigot_read, diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index e82ef46c9f40..e73ab8d73324 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -34,6 +34,8 @@ static d_write_t spkrwrite; static d_ioctl_t spkrioctl; static struct cdevsw spkr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spkropen, .d_close = spkrclose, .d_write = spkrwrite, diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index de0b2ccc9301..9a99f74aec03 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -537,11 +537,12 @@ COMPAT_PCI_DRIVER (stlpci, stlpcidriver); */ static struct cdevsw stl_cdevsw = { + .d_version = D_VERSION, .d_open = stlopen, .d_close = stlclose, .d_ioctl = stlioctl, .d_name = "stl", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #endif diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 941fc082f403..9ca1e2535d15 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -186,6 +186,8 @@ static d_strategy_t wtstrategy; static struct cdevsw wt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = wtopen, .d_close = wtclose, .d_read = physread, diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c index 79cd1ab57fa6..630c064f537a 100644 --- a/sys/i4b/driver/i4b_ctl.c +++ b/sys/i4b/driver/i4b_ctl.c @@ -58,6 +58,8 @@ static d_poll_t i4bctlpoll; static struct cdevsw i4bctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4bctlopen, .d_close = i4bctlclose, .d_ioctl = i4bctlioctl, diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index f632186d4c28..5738335e3ddb 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -112,6 +112,8 @@ static d_poll_t i4brbchpoll; static struct cdevsw i4brbch_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4brbchopen, .d_close = i4brbchclose, .d_read = i4brbchread, diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index 5acce731a376..703bfc1688b2 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -134,6 +134,8 @@ static d_poll_t i4btelpoll; static struct cdevsw i4btel_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4btelopen, .d_close = i4btelclose, .d_read = i4btelread, diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index 348c6dd49b22..c5c3832d116a 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -75,6 +75,8 @@ static d_poll_t i4btrcpoll; static struct cdevsw i4btrc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4btrcopen, .d_close = i4btrcclose, .d_read = i4btrcread, diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 42330efdc729..7b19aec6a460 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -78,6 +78,8 @@ static d_poll_t i4bpoll; static struct cdevsw i4b_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4bopen, .d_close = i4bclose, .d_read = i4bread, diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index a904172bb14c..c1a2872fb497 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -82,6 +82,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -90,7 +91,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; struct mem_range_softc mem_range_softc; diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c index 1f21be121773..68f4727efe42 100644 --- a/sys/ia64/ia64/ssc.c +++ b/sys/ia64/ia64/ssc.c @@ -58,11 +58,12 @@ static d_close_t sscclose; static d_ioctl_t sscioctl; static struct cdevsw ssc_cdevsw = { + .d_version = D_VERSION, .d_open = sscopen, .d_close = sscclose, .d_ioctl = sscioctl, .d_name = "ssc", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct tty *ssc_tp = NULL; diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 5a506334d5c4..808c537e3f0f 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -482,6 +482,7 @@ fdin_rd(fdc_p fdc) } static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -489,7 +490,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/isa/psm.c b/sys/isa/psm.c index e886e8cc9e4b..dd2fd7e2cc89 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -348,6 +348,8 @@ static driver_t psm_driver = { static struct cdevsw psm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = psmopen, .d_close = psmclose, .d_read = psmread, diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index c820be21ce55..ce330f8ec919 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -72,6 +72,8 @@ static d_ioctl_t isavga_ioctl; static d_mmap_t isavga_mmap; static struct cdevsw isavga_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = isavga_open, .d_close = isavga_close, .d_read = isavga_read, diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 19592ad56017..85f5ba27ec42 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -115,6 +115,8 @@ dead_strategy(struct bio *bp) #define dead_kqfilter (d_kqfilter_t *)enxio static struct cdevsw dead_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, /* XXX: does dead_strategy need this ? */ .d_open = dead_open, .d_close = dead_close, .d_read = dead_read, diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index c5e005bc2a15..3b534730e108 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -87,6 +87,8 @@ static d_open_t fdopen; #define CDEV_MAJOR 22 static struct cdevsw fildesc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = fdopen, .d_name = "FD", .d_maj = CDEV_MAJOR, diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 092f410d4d0f..4f2f836414a2 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -220,6 +220,8 @@ static d_poll_t devpoll; #define CDEV_MAJOR 173 static struct cdevsw dev_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = devopen, .d_close = devclose, .d_read = devread, diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index f33aeb03d40f..04abe89494c3 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -437,6 +437,8 @@ SYSCTL_INT(_kern_devstat, OID_AUTO, version, CTLFLAG_RD, static d_mmap_t devstat_mmap; static struct cdevsw devstat_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_mmap = devstat_mmap, .d_name = "devstat", }; diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index b2ece2d3e9e7..48b4d58178a3 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -69,6 +69,8 @@ static void logtimeout(void *arg); #define CDEV_MAJOR 7 static struct cdevsw log_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = logopen, .d_close = logclose, .d_read = logread, diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 272cc4aed4bf..5791978e21ba 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -78,6 +78,7 @@ static d_kqfilter_t cnkqfilter; * XXX: kern_conf.c knows what to do when it sees 256. */ static struct cdevsw cn_cdevsw = { + .d_version = D_VERSION, .d_open = cnopen, .d_close = cnclose, .d_read = cnread, @@ -86,7 +87,7 @@ static struct cdevsw cn_cdevsw = { .d_poll = cnpoll, .d_name = "console", .d_maj = 256, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, .d_kqfilter = cnkqfilter, }; diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index ab3ef5dbf1e4..5648e7218836 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -80,6 +80,7 @@ static d_poll_t ptcpoll; #define CDEV_MAJOR_S 5 static struct cdevsw pts_cdevsw = { + .d_version = D_VERSION, .d_open = ptsopen, .d_close = ptsclose, .d_read = ptsread, @@ -87,11 +88,12 @@ static struct cdevsw pts_cdevsw = { .d_ioctl = ptyioctl, .d_name = "pts", .d_maj = CDEV_MAJOR_S, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #define CDEV_MAJOR_C 6 static struct cdevsw ptc_cdevsw = { + .d_version = D_VERSION, .d_open = ptcopen, .d_close = ptcclose, .d_read = ptcread, @@ -100,7 +102,7 @@ static struct cdevsw ptc_cdevsw = { .d_poll = ptcpoll, .d_name = "ptc", .d_maj = CDEV_MAJOR_C, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #define BUFSIZ 100 /* Chunk size iomoved to/from user */ diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 985a87750a71..96fa84ba27fb 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -38,10 +38,11 @@ static d_open_t cttyopen; #define CDEV_MAJOR 1 static struct cdevsw ctty_cdevsw = { + .d_version = D_VERSION, .d_open = cttyopen, .d_name = "ctty", .d_maj = CDEV_MAJOR, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static dev_t ctty; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 9a8d35a9e83d..a24cce97ac4b 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -127,6 +127,8 @@ static d_poll_t bpfpoll; static d_kqfilter_t bpfkqfilter; static struct cdevsw bpf_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = bpfopen, .d_close = bpfclose, .d_read = bpfread, diff --git a/sys/net/if.c b/sys/net/if.c index 303166181136..8cea0c4fe5d4 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -134,6 +134,8 @@ static d_ioctl_t netioctl; static d_kqfilter_t netkqfilter; static struct cdevsw net_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = netopen, .d_close = netclose, .d_ioctl = netioctl, diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index f83243b39998..c7d380ec1c40 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -97,6 +97,8 @@ static d_ioctl_t tapioctl; static d_poll_t tappoll; static struct cdevsw tap_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = tapopen, .d_close = tapclose, .d_read = tapread, diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 4a64da456072..3c297c6a13a4 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -104,6 +104,8 @@ static d_ioctl_t tunioctl; static d_poll_t tunpoll; static struct cdevsw tun_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = tunopen, .d_close = tunclose, .d_read = tunread, diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index e353caf007fa..1e2013247fc3 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -226,6 +226,8 @@ Static void ubt_create_device_nodes (ubt_softc_p); Static void ubt_destroy_device_nodes (ubt_softc_p); Static struct cdevsw ubt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ubt_open, .d_close = ubt_close, .d_read = ubt_read, diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index 44e763fe73a8..7f6b6c16d852 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -92,6 +92,8 @@ Static d_ioctl_t ubtbcmfw_ioctl; Static d_poll_t ubtbcmfw_poll; Static struct cdevsw ubtbcmfw_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ubtbcmfw_open, .d_close = ubtbcmfw_close, .d_read = ubtbcmfw_read, diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index ae3237fa33da..7bd1ed0be6b0 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -113,6 +113,8 @@ static d_ioctl_t ngdioctl; static d_poll_t ngdpoll; static struct cdevsw ngd_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ngdopen, .d_close = ngdclose, .d_read = ngdread, diff --git a/sys/netncp/ncp_mod.c b/sys/netncp/ncp_mod.c index e56495d6a2c8..6594b52e5a5b 100644 --- a/sys/netncp/ncp_mod.c +++ b/sys/netncp/ncp_mod.c @@ -66,6 +66,8 @@ static dev_t ncp_dev; static d_ioctl_t ncp_ioctl; static struct cdevsw ncp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ncp_ioctl, .d_name = "ncp", }; diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index debf080ff58e..258a37a9cdc5 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -87,6 +87,8 @@ int smb_dev_queue(struct smb_dev *ndp, struct smb_rq *rqp, int prio); */ static struct cdevsw nsmb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = nsmb_dev_open, .d_close = nsmb_dev_close, .d_ioctl = nsmb_dev_ioctl, diff --git a/sys/nfs4client/nfs4_dev.c b/sys/nfs4client/nfs4_dev.c index f9a84d879031..4a318e2fb5fc 100644 --- a/sys/nfs4client/nfs4_dev.c +++ b/sys/nfs4client/nfs4_dev.c @@ -94,6 +94,8 @@ static d_ioctl_t nfs4dev_ioctl; static d_poll_t nfs4dev_poll; static struct cdevsw nfs4dev_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = nfs4dev_open, .d_close = nfs4dev_close, .d_ioctl = nfs4dev_ioctl, diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 1d2398f1a31f..4ad2797c1a8c 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -765,6 +765,8 @@ 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_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = cryptoopen, .d_read = cryptoread, .d_write = cryptowrite, diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index a2ebaa4ce381..df37273b74c0 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -623,6 +623,7 @@ fdin_rd(fdc_p fdc) #endif /* PC98 */ static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -630,7 +631,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 5a232829c604..0307f6cf8ae2 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -102,6 +102,8 @@ static d_ioctl_t gdcioctl; static d_mmap_t gdcmmap; static struct cdevsw gdc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gdcopen, .d_close = gdcclose, .d_read = gdcread, diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index f17604617487..0ebd84c479ce 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -230,6 +230,8 @@ static d_write_t lptwrite; static d_ioctl_t lptioctl; static struct cdevsw lpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_write = lptwrite, diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 3c309c00a7ea..39269ea261b5 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -416,13 +416,14 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_read = sioread, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = sio_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int comconsole = -1; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index a2ebaa4ce381..df37273b74c0 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -623,6 +623,7 @@ fdin_rd(fdc_p fdc) #endif /* PC98 */ static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -630,7 +631,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c index cc439a0b17ff..4ddeb63b8d9b 100644 --- a/sys/pc98/pc98/mse.c +++ b/sys/pc98/pc98/mse.c @@ -137,6 +137,8 @@ static d_ioctl_t mseioctl; static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, diff --git a/sys/pc98/pc98/olpt.c b/sys/pc98/pc98/olpt.c index f17604617487..0ebd84c479ce 100644 --- a/sys/pc98/pc98/olpt.c +++ b/sys/pc98/pc98/olpt.c @@ -230,6 +230,8 @@ static d_write_t lptwrite; static d_ioctl_t lptioctl; static struct cdevsw lpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_write = lptwrite, diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index 5a232829c604..0307f6cf8ae2 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -102,6 +102,8 @@ static d_ioctl_t gdcioctl; static d_mmap_t gdcmmap; static struct cdevsw gdc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gdcopen, .d_close = gdcclose, .d_read = gdcread, diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 3c309c00a7ea..39269ea261b5 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -416,13 +416,14 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_read = sioread, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = sio_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int comconsole = -1; diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index 878091716967..ef508c0394e8 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -49,6 +49,7 @@ static d_strategy_t acdstrategy; static struct cdevsw acd_cdevsw = { + .d_version = D_VERSION, .d_open = acdopen, .d_close = acdclose, .d_read = physread, @@ -56,7 +57,7 @@ static struct cdevsw acd_cdevsw = { .d_ioctl = acdioctl, .d_strategy = acdstrategy, .d_name = "wcd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; #define NUNIT 16 /* Max # of devices */ diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index bc5f240c0ae1..b4d15ffdd23f 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -81,6 +81,8 @@ static d_ioctl_t crdioctl; static d_poll_t crdpoll; static struct cdevsw crd_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = crdopen, .d_close = crdclose, .d_read = crdread, diff --git a/sys/pci/agp.c b/sys/pci/agp.c index 6f09660fad6a..6a01e20565ed 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -70,6 +70,8 @@ static d_ioctl_t agp_ioctl; static d_mmap_t agp_mmap; static struct cdevsw agp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = agp_open, .d_close = agp_close, .d_ioctl = agp_ioctl, diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 9e8c8f1165e7..b0118d63d982 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -186,6 +186,8 @@ static d_close_t ti_close; static d_ioctl_t ti_ioctl2; static struct cdevsw ti_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ti_open, .d_close = ti_close, .d_ioctl = ti_ioctl2, diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index d6c6cd336ef0..6c1d8fda2837 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -43,6 +43,8 @@ static d_ioctl_t xrpu_ioctl; static d_mmap_t xrpu_mmap; static struct cdevsw xrpu_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = xrpu_open, .d_close = xrpu_close, .d_ioctl = xrpu_ioctl, diff --git a/sys/sparc64/creator/creator_upa.c b/sys/sparc64/creator/creator_upa.c index cb4762d09d06..ee7384214587 100644 --- a/sys/sparc64/creator/creator_upa.c +++ b/sys/sparc64/creator/creator_upa.c @@ -74,6 +74,8 @@ static driver_t creator_upa_driver = { static devclass_t creator_upa_devclass; static struct cdevsw creator_devsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = creator_open, .d_close = creator_close, .d_ioctl = creator_ioctl, diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index a099f4ada326..cee4c0fd645e 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -83,13 +83,14 @@ static d_read_t mmrw; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, .d_write = mmrw, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; static int diff --git a/sys/sys/conf.h b/sys/sys/conf.h index a203c11fd0c8..2a2b984f4e94 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -202,12 +202,19 @@ typedef int dumper_t( #define D_TRACKCLOSE 0x00080000 /* track all closes */ #define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */ #define D_PSEUDO 0x00200000 /* make_dev() can return NULL */ -#define D_NOGIANT 0x00400000 /* Doesn't want Giant */ +#define D_NEEDGIANT 0x00400000 /* driver want Giant */ + +/* + * Version numbers. + */ +#define D_VERSION_00 0x20011966 +#define D_VERSION D_VERSION_00 /* * Character device switch table */ struct cdevsw { + int d_version; int d_maj; u_int d_flags; const char *d_name; diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index a203c11fd0c8..2a2b984f4e94 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -202,12 +202,19 @@ typedef int dumper_t( #define D_TRACKCLOSE 0x00080000 /* track all closes */ #define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */ #define D_PSEUDO 0x00200000 /* make_dev() can return NULL */ -#define D_NOGIANT 0x00400000 /* Doesn't want Giant */ +#define D_NEEDGIANT 0x00400000 /* driver want Giant */ + +/* + * Version numbers. + */ +#define D_VERSION_00 0x20011966 +#define D_VERSION D_VERSION_00 /* * Character device switch table */ struct cdevsw { + int d_version; int d_maj; u_int d_flags; const char *d_name;