diff options
author | phk <phk@FreeBSD.org> | 2003-01-19 11:03:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-01-19 11:03:07 +0000 |
commit | 24596ddb76743273c5d39821727e4e00d025cb02 (patch) | |
tree | a1836e6e7bd999b9e7099048c5c2bd9535ef95cd /sys/kern | |
parent | 49b60b2ebe504ba8584d684a66b1351307a962cf (diff) | |
download | FreeBSD-src-24596ddb76743273c5d39821727e4e00d025cb02.zip FreeBSD-src-24596ddb76743273c5d39821727e4e00d025cb02.tar.gz |
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.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/init_main.c | 30 | ||||
-rw-r--r-- | sys/kern/kern_conf.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 12 | ||||
-rw-r--r-- | sys/kern/tty_tty.c | 7 |
4 files changed, 27 insertions, 29 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 354536f..74424cc 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -554,21 +554,21 @@ start_init(void *dummy) mac_create_root_mount(td->td_ucred, TAILQ_FIRST(&mountlist)); #endif - if (devfs_present) { - /* - * For disk based systems, we probably cannot do this yet - * since the fs will be read-only. But a NFS root - * might be ok. It is worth a shot. - */ - error = kern_mkdir(td, "/dev", UIO_SYSSPACE, 0700); - if (error == EEXIST) - error = 0; - if (error == 0) - error = kernel_vmount(0, "fstype", "devfs", - "fspath", "/dev", NULL); - if (error != 0) - init_does_devfs = 1; - } +#ifndef NODEVFS + /* + * For disk based systems, we probably cannot do this yet + * since the fs will be read-only. But a NFS root + * might be ok. It is worth a shot. + */ + error = kern_mkdir(td, "/dev", UIO_SYSSPACE, 0700); + if (error == EEXIST) + error = 0; + if (error == 0) + error = kernel_vmount(0, "fstype", "devfs", + "fspath", "/dev", NULL); + if (error != 0) + init_does_devfs = 1; +#endif /* * Need just enough stack to hold the faked-up "execve()" arguments. diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 6b04b45..0a98a34 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -62,7 +62,6 @@ static LIST_HEAD(, cdev) dev_free; devfs_create_t *devfs_create_hook; devfs_destroy_t *devfs_destroy_hook; -int devfs_present; static int ready_for_devs; @@ -81,9 +80,11 @@ devsw(dev_t dev) disk_dev_synth(dev); if (dev->si_devsw) return (dev->si_devsw); - if (devfs_present) - return (NULL); +#ifndef NODEVFS + return (NULL); +#else return(cdevsw[major(dev)]); +#endif } /* diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index cf802ab..835ec39 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2152,13 +2152,15 @@ fildesc_drvinit(void *unused) make_dev_alias(dev, "stdout"); dev = make_dev(&fildesc_cdevsw, 2, UID_ROOT, GID_WHEEL, 0666, "fd/2"); make_dev_alias(dev, "stderr"); - if (!devfs_present) { - int fd; +#ifdef NODEVFS + { + int fd; - for (fd = 3; fd < NUMFDESC; fd++) - make_dev(&fildesc_cdevsw, fd, UID_ROOT, GID_WHEEL, - 0666, "fd/%d", fd); + for (fd = 3; fd < NUMFDESC; fd++) + make_dev(&fildesc_cdevsw, fd, UID_ROOT, GID_WHEEL, + 0666, "fd/%d", fd); } +#endif } static fo_rdwr_t badfo_readwrite; diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 3a5524e..d962c18 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -361,12 +361,7 @@ ctty_drvinit(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) |