diff options
author | phk <phk@FreeBSD.org> | 2000-09-02 19:17:34 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-09-02 19:17:34 +0000 |
commit | e47f61e18396b6e5f61ee91b9f9f832976ee96cf (patch) | |
tree | bc17f23dc3fa3b9663516bac048049a5f02652ea /sys/kern/kern_conf.c | |
parent | 0ab175f21b9e105fcbe4db6569019e946f23e13c (diff) | |
download | FreeBSD-src-e47f61e18396b6e5f61ee91b9f9f832976ee96cf.zip FreeBSD-src-e47f61e18396b6e5f61ee91b9f9f832976ee96cf.tar.gz |
Avoid the modules madness I inadvertently introduced by making the
cloning infrastructure standard in kern_conf. Modules are now
the same with or without devfs support.
If you need to detect if devfs is present, in modules or elsewhere,
check the integer variable "devfs_present".
This happily removes an ugly hack from kern/vfs_conf.c.
This forces a rename of the eventhandler and the standard clone
helper function.
Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include
like <sys/queue.h>
Remove all #includes of opt_devfs.h they no longer matter.
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r-- | sys/kern/kern_conf.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 1e344e3..fb15afd 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -42,6 +42,7 @@ #include <sys/conf.h> #include <sys/vnode.h> #include <sys/queue.h> +#include <sys/ctype.h> #include <machine/stdarg.h> #define cdevsw_ALLOCSTART (NUMCDEVSW/2) @@ -69,7 +70,8 @@ static LIST_HEAD(, specinfo) dev_hash[DEVT_HASH]; static LIST_HEAD(, specinfo) dev_free; devfs_create_t *devfs_create_hook; -devfs_remove_t *devfs_remove_hook; +devfs_destroy_t *devfs_destroy_hook; +int devfs_present; static int free_devt; SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); @@ -352,8 +354,8 @@ make_dev_alias(dev_t pdev, char *fmt, ...) void destroy_dev(dev_t dev) { - if (devfs_remove_hook) - devfs_remove_hook(dev); + if (devfs_destroy_hook) + devfs_destroy_hook(dev); dev->si_drv1 = 0; dev->si_drv2 = 0; dev->si_devsw = 0; @@ -381,3 +383,26 @@ devtoname(dev_t dev) } return (dev->si_name); } + +int +dev_stdclone(char *name, char **namep, char *stem, int *unit) +{ + int u, i; + + if (bcmp(stem, name, strlen(stem)) != 0) + return (0); + i = strlen(stem); + if (!isdigit(name[i])) + return (0); + u = 0; + while (isdigit(name[i])) { + u *= 10; + u += name[i++] - '0'; + } + *unit = u; + if (namep) + *namep = &name[i]; + if (name[i]) + return (2); + return (1); +} |