summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-06-17 17:16:53 +0000
committerphk <phk@FreeBSD.org>2004-06-17 17:16:53 +0000
commit40dd98a3bd2049465e7644b361b60da41a46efa0 (patch)
treefe8b297144afd6d6f7db41275c72cb5eb663ec02 /sys/dev
parent9acfe1e733142ca875624a3acbf96c4ff27b36a4 (diff)
downloadFreeBSD-src-40dd98a3bd2049465e7644b361b60da41a46efa0.zip
FreeBSD-src-40dd98a3bd2049465e7644b361b60da41a46efa0.tar.gz
Second half of the dev_t cleanup.
The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cp/if_cp.c4
-rw-r--r--sys/dev/ctau/if_ct.c4
-rw-r--r--sys/dev/cx/if_cx.c4
-rw-r--r--sys/dev/cy/cy.c2
-rw-r--r--sys/dev/dcons/dcons.c2
-rw-r--r--sys/dev/digi/digi.c2
-rw-r--r--sys/dev/firewire/fwdev.c2
-rw-r--r--sys/dev/led/led.c4
-rw-r--r--sys/dev/nmdm/nmdm.c2
-rw-r--r--sys/dev/snp/snp.c14
-rw-r--r--sys/dev/sound/pcm/dsp.c2
-rw-r--r--sys/dev/sound/pcm/mixer.c2
-rw-r--r--sys/dev/syscons/syscons.c2
-rw-r--r--sys/dev/vinum/vinum.c2
-rw-r--r--sys/dev/vinum/vinumconfig.c4
-rw-r--r--sys/dev/vinum/vinumio.c2
16 files changed, 27 insertions, 27 deletions
diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c
index 04427c3..13b3019 100644
--- a/sys/dev/cp/if_cp.c
+++ b/sys/dev/cp/if_cp.c
@@ -2657,13 +2657,13 @@ static int cp_modevent (module_t mod, int type, void *unused)
struct cdevsw *cdsw;
#if __FreeBSD_version >= 502103
- dev = udev2dev (makeudev(CDEV_MAJOR, 0));
+ dev = findcdev (makedev(CDEV_MAJOR, 0));
#else
dev = makedev (CDEV_MAJOR, 0);
#endif
switch (type) {
case MOD_LOAD:
- if (dev != NODEV &&
+ if (dev != NULL &&
(cdsw = devsw (dev)) &&
cdsw->d_maj == CDEV_MAJOR) {
printf ("Tau-PCI driver is already in system\n");
diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c
index a7462ab..de07c71 100644
--- a/sys/dev/ctau/if_ct.c
+++ b/sys/dev/ctau/if_ct.c
@@ -2629,13 +2629,13 @@ static int ct_modevent (module_t mod, int type, void *unused)
struct cdevsw *cdsw;
#if __FreeBSD_version >= 502103
- dev = udev2dev (makeudev(CDEV_MAJOR, 0));
+ dev = findcdev (makedev(CDEV_MAJOR, 0));
#else
dev = makedev (CDEV_MAJOR, 0);
#endif
switch (type) {
case MOD_LOAD:
- if (dev != NODEV &&
+ if (dev != NULL &&
(cdsw = devsw (dev)) &&
cdsw->d_maj == CDEV_MAJOR) {
printf ("Tau-ISA driver is already in system\n");
diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c
index 45c7f9e..b6b55c7 100644
--- a/sys/dev/cx/if_cx.c
+++ b/sys/dev/cx/if_cx.c
@@ -3177,13 +3177,13 @@ static int cx_modevent (module_t mod, int type, void *unused)
struct cdevsw *cdsw;
#if __FreeBSD_version >= 502103
- dev = udev2dev (makeudev(CDEV_MAJOR, 0));
+ dev = findcdev (makedev(CDEV_MAJOR, 0));
#else
dev = makedev (CDEV_MAJOR, 0);
#endif
switch (type) {
case MOD_LOAD:
- if (dev != NODEV &&
+ if (dev != NULL &&
(cdsw = devsw (dev)) &&
cdsw->d_maj == CDEV_MAJOR) {
printf ("Sigma driver is already in system\n");
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index 7808ecb..53e038d 100644
--- a/sys/dev/cy/cy.c
+++ b/sys/dev/cy/cy.c
@@ -162,7 +162,7 @@ __FBSDID("$FreeBSD$");
#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK)
/*
* Not all of the magic is parametrized in the following macros. 16 and
- * 0xff are related to the bitfields in a udev_t. CY_MAX_PORTS must be
+ * 0xff are related to the bitfields in a dev_t. CY_MAX_PORTS must be
* ((0xff & ~MINOR_MAGIC_MASK) + 1) for things to work.
*/
#define MINOR_TO_UNIT(mynor) (((mynor) >> 16) * CY_MAX_PORTS \
diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c
index 5bdbbfb..c1b320d 100644
--- a/sys/dev/dcons/dcons.c
+++ b/sys/dev/dcons/dcons.c
@@ -598,7 +598,7 @@ dcons_modevent(module_t mode, int type, void *data)
#if CONS_NODEV
gdb_arg = NULL;
#else
- gdbdev = NODEV;
+ gdbdev = NULL;
#endif
#endif
#if __FreeBSD_version >= 500000
diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c
index c330290..2d9184c 100644
--- a/sys/dev/digi/digi.c
+++ b/sys/dev/digi/digi.c
@@ -1017,7 +1017,7 @@ digi_loadmoduledata(struct digi_softc *sc)
modfile = malloc(modlen + 6, M_TEMP, M_WAITOK);
snprintf(modfile, modlen + 6, "digi_%s", sc->module);
if ((res = linker_reference_module(modfile, NULL, &lf)) != 0) {
- if (res == ENOENT && rootdev == NODEV)
+ if (res == ENOENT && rootdev == NULL)
printf("%s: Failed to autoload module: No filesystem\n",
modfile);
else
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c
index 5d10415..cffb636 100644
--- a/sys/dev/firewire/fwdev.c
+++ b/sys/dev/firewire/fwdev.c
@@ -848,7 +848,7 @@ fwdev_clone(void *arg, char *name, int namelen, struct cdev **dev)
int devflag[NDEVTYPE] = {0, FWMEM_FLAG};
int i, unit = 0, sub = 0;
- if (*dev != NODEV)
+ if (*dev != NULL)
return;
for (i = 0; i < NDEVTYPE; i++)
diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c
index 4c19e27..df9f27e 100644
--- a/sys/dev/led/led.c
+++ b/sys/dev/led/led.c
@@ -234,13 +234,13 @@ led_create(led_t *func, void *priv, char const *name)
sb = sbuf_new(NULL, NULL, SPECNAMELEN, SBUF_FIXEDLEN);
if (sb == NULL)
- return (NODEV);
+ return (NULL);
sbuf_cpy(sb, "led/");
sbuf_cat(sb, name);
sbuf_finish(sb);
if (sbuf_overflowed(sb)) {
sbuf_delete(sb);
- return (NODEV);
+ return (NULL);
}
sc = malloc(sizeof *sc, M_LED, M_WAITOK | M_ZERO);
diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c
index 683d06b..e27347b 100644
--- a/sys/dev/nmdm/nmdm.c
+++ b/sys/dev/nmdm/nmdm.c
@@ -100,7 +100,7 @@ nmdm_clone(void *arg, char *name, int nameen, struct cdev **dev)
char *p;
struct cdev *d1, *d2;
- if (*dev != NODEV)
+ if (*dev != NULL)
return;
if (strcmp(name, "nmdm") == 0) {
p = NULL;
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 752dc42..6544810 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -406,7 +406,7 @@ snpopen(dev, flag, mode, td)
* snp_tty == NULL is for inactive snoop devices.
*/
snp->snp_tty = NULL;
- snp->snp_target = NODEV;
+ snp->snp_target = NULL;
LIST_INSERT_HEAD(&snp_sclist, snp, snp_list);
return (0);
@@ -439,7 +439,7 @@ snp_detach(snp)
printf("snp%d: bad attached tty data\n", snp->snp_unit);
snp->snp_tty = NULL;
- snp->snp_target = NODEV;
+ snp->snp_target = NULL;
detach_notty:
selwakeuppri(&snp->snp_sel, PZERO + 1);
@@ -500,8 +500,8 @@ snpioctl(dev, cmd, data, flags, td)
snp = dev->si_drv1;
switch (cmd) {
case SNPSTTY:
- tdev = udev2dev(*((udev_t *)data));
- if (tdev == NODEV)
+ tdev = findcdev(*((dev_t *)data));
+ if (tdev == NULL)
return (snp_down(snp));
tp = snpdevtotty(tdev);
@@ -512,7 +512,7 @@ snpioctl(dev, cmd, data, flags, td)
s = spltty();
- if (snp->snp_target == NODEV) {
+ if (snp->snp_target == NULL) {
tpo = snp->snp_tty;
if (tpo)
tpo->t_state &= ~TS_SNOOP;
@@ -540,7 +540,7 @@ snpioctl(dev, cmd, data, flags, td)
* SNPGTTY happy, else we can't know what is device
* major/minor for tty.
*/
- *((udev_t *)data) = dev2udev(snp->snp_target);
+ *((dev_t *)data) = dev2udev(snp->snp_target);
break;
case FIONBIO:
@@ -609,7 +609,7 @@ snp_clone(arg, name, namelen, dev)
{
int u, i;
- if (*dev != NODEV)
+ if (*dev != NULL)
return;
if (dev_stdclone(name, NULL, "snp", &u) != 1)
return;
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 9200941..29fe27f 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -1123,7 +1123,7 @@ dsp_clone(void *arg, char *name, int namelen, struct cdev **dev)
int devtypes[3] = {SND_DEV_DSP, SND_DEV_DSP16, SND_DEV_AUDIO};
char *devnames[3] = {"dsp", "dspW", "audio"};
- if (*dev != NODEV)
+ if (*dev != NULL)
return;
if (pcm_devclass == NULL)
return;
diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index 47812fe..135a628 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -483,7 +483,7 @@ mixer_clone(void *arg, char *name, int namelen, struct cdev **dev)
{
struct snddev_info *sd;
- if (*dev != NODEV)
+ if (*dev != NULL)
return;
if (strcmp(name, "mixer") == 0) {
sd = devclass_get_softc(pcm_devclass, snd_unit);
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 12f0739..6c1a549 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -2622,7 +2622,7 @@ sc_change_cursor_shape(scr_stat *scp, int flags, int base, int height)
}
for (i = sc->first_vty; i < sc->first_vty + sc->vtys; ++i) {
- if ((dev = SC_DEV(sc, i)) == NODEV)
+ if ((dev = SC_DEV(sc, i)) == NULL)
continue;
if ((scp = sc_get_stat(dev)) == NULL)
continue;
diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c
index 3306c96..062176b 100644
--- a/sys/dev/vinum/vinum.c
+++ b/sys/dev/vinum/vinum.c
@@ -522,7 +522,7 @@ vinum_clone(void *arg, char *name, int namelen, struct cdev ** dev)
struct volume *vol;
int i;
- if (*dev != NODEV)
+ if (*dev != NULL)
return;
if (strncmp(name, "vinum/", sizeof("vinum/") - 1) != 0)
return;
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c
index 8c7e038..989af88 100644
--- a/sys/dev/vinum/vinumconfig.c
+++ b/sys/dev/vinum/vinumconfig.c
@@ -476,7 +476,7 @@ get_empty_drive(void)
bzero(drive, sizeof(struct drive));
drive->driveno = driveno; /* put number in structure */
drive->flags |= VF_NEWBORN; /* newly born drive */
- drive->dev = NODEV;
+ drive->dev = NULL;
strcpy(drive->devicename, "unknown"); /* and make the name ``unknown'' */
return driveno; /* return the index */
}
@@ -595,7 +595,7 @@ free_drive(struct drive *drive)
close_locked_drive(drive); /* close it */
if (drive->freelist)
Free(drive->freelist);
- if (drive->dev != NODEV)
+ if (drive->dev != NULL)
dev_rel(drive->dev);
bzero(drive, sizeof(struct drive)); /* this also sets drive_unallocated */
unlockdrive(drive);
diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c
index e77291e..7edde1d 100644
--- a/sys/dev/vinum/vinumio.c
+++ b/sys/dev/vinum/vinumio.c
@@ -56,7 +56,7 @@ open_drive(struct drive *drive, struct thread *td, int verbose)
return EBUSY; /* don't do it again */
drive->dev = getdiskbyname(drive->devicename);
- if (drive->dev == NODEV) /* didn't find anything */
+ if (drive->dev == NULL) /* didn't find anything */
return ENOENT;
dev_ref(drive->dev);
OpenPOWER on IntegriCloud