Originally when DEVFS was added, a global variable "devfs_present"
was used to control code which were conditional on DEVFS' precense since this avoided the need for large-scale source pollution with #include "opt_geom.h" Now that we approach making DEVFS standard, replace these tests with an #ifdef to facilitate mechanical removal once DEVFS becomes non-optional. No functional change by this commit.
This commit is contained in:
parent
eaa6ad0521
commit
be470e56d7
@ -450,7 +450,6 @@ devfs_init(void *junk)
|
|||||||
{
|
{
|
||||||
devfs_create_hook = devfs_create;
|
devfs_create_hook = devfs_create;
|
||||||
devfs_destroy_hook = devfs_destroy;
|
devfs_destroy_hook = devfs_destroy;
|
||||||
devfs_present = 1;
|
|
||||||
devfs_rules_init();
|
devfs_rules_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ start_init(void *dummy)
|
|||||||
mac_create_root_mount(td->td_ucred, TAILQ_FIRST(&mountlist));
|
mac_create_root_mount(td->td_ucred, TAILQ_FIRST(&mountlist));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (devfs_present) {
|
#ifndef NODEVFS
|
||||||
/*
|
/*
|
||||||
* For disk based systems, we probably cannot do this yet
|
* For disk based systems, we probably cannot do this yet
|
||||||
* since the fs will be read-only. But a NFS root
|
* since the fs will be read-only. But a NFS root
|
||||||
@ -568,7 +568,7 @@ start_init(void *dummy)
|
|||||||
"fspath", "/dev", NULL);
|
"fspath", "/dev", NULL);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
init_does_devfs = 1;
|
init_does_devfs = 1;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need just enough stack to hold the faked-up "execve()" arguments.
|
* Need just enough stack to hold the faked-up "execve()" arguments.
|
||||||
|
@ -62,7 +62,6 @@ static LIST_HEAD(, cdev) dev_free;
|
|||||||
|
|
||||||
devfs_create_t *devfs_create_hook;
|
devfs_create_t *devfs_create_hook;
|
||||||
devfs_destroy_t *devfs_destroy_hook;
|
devfs_destroy_t *devfs_destroy_hook;
|
||||||
int devfs_present;
|
|
||||||
|
|
||||||
static int ready_for_devs;
|
static int ready_for_devs;
|
||||||
|
|
||||||
@ -81,9 +80,11 @@ devsw(dev_t dev)
|
|||||||
disk_dev_synth(dev);
|
disk_dev_synth(dev);
|
||||||
if (dev->si_devsw)
|
if (dev->si_devsw)
|
||||||
return (dev->si_devsw);
|
return (dev->si_devsw);
|
||||||
if (devfs_present)
|
#ifndef NODEVFS
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
#else
|
||||||
return(cdevsw[major(dev)]);
|
return(cdevsw[major(dev)]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2152,13 +2152,15 @@ fildesc_drvinit(void *unused)
|
|||||||
make_dev_alias(dev, "stdout");
|
make_dev_alias(dev, "stdout");
|
||||||
dev = make_dev(&fildesc_cdevsw, 2, UID_ROOT, GID_WHEEL, 0666, "fd/2");
|
dev = make_dev(&fildesc_cdevsw, 2, UID_ROOT, GID_WHEEL, 0666, "fd/2");
|
||||||
make_dev_alias(dev, "stderr");
|
make_dev_alias(dev, "stderr");
|
||||||
if (!devfs_present) {
|
#ifdef NODEVFS
|
||||||
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
for (fd = 3; fd < NUMFDESC; fd++)
|
for (fd = 3; fd < NUMFDESC; fd++)
|
||||||
make_dev(&fildesc_cdevsw, fd, UID_ROOT, GID_WHEEL,
|
make_dev(&fildesc_cdevsw, fd, UID_ROOT, GID_WHEEL,
|
||||||
0666, "fd/%d", fd);
|
0666, "fd/%d", fd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static fo_rdwr_t badfo_readwrite;
|
static fo_rdwr_t badfo_readwrite;
|
||||||
|
@ -361,12 +361,7 @@ ctty_drvinit(unused)
|
|||||||
void *unused;
|
void *unused;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (devfs_present) {
|
|
||||||
EVENTHANDLER_REGISTER(dev_clone, ctty_clone, 0, 1000);
|
|
||||||
ctty = make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "ctty");
|
|
||||||
} else {
|
|
||||||
make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "tty");
|
make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "tty");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSINIT(cttydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctty_drvinit,NULL)
|
SYSINIT(cttydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctty_drvinit,NULL)
|
||||||
|
@ -178,13 +178,13 @@ tapmodevent(mod, type, data)
|
|||||||
goto bail2;
|
goto bail2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devfs_present) {
|
#ifdef NODEVFS
|
||||||
error = cdevsw_add(&tap_cdevsw);
|
error = cdevsw_add(&tap_cdevsw);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
EVENTHANDLER_DEREGISTER(dev_clone, eh_tag);
|
EVENTHANDLER_DEREGISTER(dev_clone, eh_tag);
|
||||||
goto bail2;
|
goto bail2;
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
bail2:
|
bail2:
|
||||||
@ -229,8 +229,9 @@ tapmodevent(mod, type, data)
|
|||||||
if (tapbasedev != NOUDEV)
|
if (tapbasedev != NOUDEV)
|
||||||
destroy_dev(udev2dev(tapbasedev, 0));
|
destroy_dev(udev2dev(tapbasedev, 0));
|
||||||
|
|
||||||
if (!devfs_present)
|
#ifdef NODEVFS
|
||||||
cdevsw_remove(&tap_cdevsw);
|
cdevsw_remove(&tap_cdevsw);
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -147,13 +147,13 @@ tunmodevent(module_t mod, int type, void *data)
|
|||||||
tag = EVENTHANDLER_REGISTER(dev_clone, tunclone, 0, 1000);
|
tag = EVENTHANDLER_REGISTER(dev_clone, tunclone, 0, 1000);
|
||||||
if (tag == NULL)
|
if (tag == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
if (!devfs_present) {
|
#ifdef NODEVFS
|
||||||
err = cdevsw_add(&tun_cdevsw);
|
err = cdevsw_add(&tun_cdevsw);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
EVENTHANDLER_DEREGISTER(dev_clone, tag);
|
EVENTHANDLER_DEREGISTER(dev_clone, tag);
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
tununits.rm_type = RMAN_ARRAY;
|
tununits.rm_type = RMAN_ARRAY;
|
||||||
tununits.rm_descr = "open if_tun units";
|
tununits.rm_descr = "open if_tun units";
|
||||||
err = rman_init(&tununits);
|
err = rman_init(&tununits);
|
||||||
@ -200,8 +200,9 @@ tunmodevent(module_t mod, int type, void *data)
|
|||||||
if (tunbasedev != NOUDEV)
|
if (tunbasedev != NOUDEV)
|
||||||
destroy_dev(udev2dev(tunbasedev, 0));
|
destroy_dev(udev2dev(tunbasedev, 0));
|
||||||
|
|
||||||
if (!devfs_present)
|
#ifdef NODEVFS
|
||||||
cdevsw_remove(&tun_cdevsw);
|
cdevsw_remove(&tun_cdevsw);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -323,7 +323,6 @@ typedef void devfs_destroy_t(dev_t dev);
|
|||||||
|
|
||||||
extern devfs_create_t *devfs_create_hook;
|
extern devfs_create_t *devfs_create_hook;
|
||||||
extern devfs_destroy_t *devfs_destroy_hook;
|
extern devfs_destroy_t *devfs_destroy_hook;
|
||||||
extern int devfs_present;
|
|
||||||
|
|
||||||
#define UID_ROOT 0
|
#define UID_ROOT 0
|
||||||
#define UID_BIN 3
|
#define UID_BIN 3
|
||||||
|
@ -323,7 +323,6 @@ typedef void devfs_destroy_t(dev_t dev);
|
|||||||
|
|
||||||
extern devfs_create_t *devfs_create_hook;
|
extern devfs_create_t *devfs_create_hook;
|
||||||
extern devfs_destroy_t *devfs_destroy_hook;
|
extern devfs_destroy_t *devfs_destroy_hook;
|
||||||
extern int devfs_present;
|
|
||||||
|
|
||||||
#define UID_ROOT 0
|
#define UID_ROOT 0
|
||||||
#define UID_BIN 3
|
#define UID_BIN 3
|
||||||
|
Loading…
Reference in New Issue
Block a user