diff options
author | dfr <dfr@FreeBSD.org> | 1998-06-07 17:13:14 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-06-07 17:13:14 +0000 |
commit | 1d5f38ac2264102518a09c66a7b285f57e81e67e (patch) | |
tree | 83ce2f0e2b8041d2c933d3beffc1f4465ea5b929 /sys/kern/kern_conf.c | |
parent | 83423d0e5a4ad035e44392f0427cb39232031e45 (diff) | |
download | FreeBSD-src-1d5f38ac2264102518a09c66a7b285f57e81e67e.zip FreeBSD-src-1d5f38ac2264102518a09c66a7b285f57e81e67e.tar.gz |
This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.
The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r-- | sys/kern/kern_conf.c | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index e66ebe1..912c4c5 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -30,11 +30,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_conf.c,v 1.22 1997/09/27 13:39:03 kato Exp $ + * $Id: kern_conf.c,v 1.23 1997/11/22 08:35:37 bde Exp $ */ #include <sys/param.h> #include <sys/systm.h> +#include <sys/module.h> #include <sys/conf.h> #include <sys/vnode.h> @@ -212,3 +213,64 @@ bdevsw_add_generic(int bdev, int cdev, struct bdevsw *bdevsw) dev = makedev(bdev, 0); bdevsw_add(&dev, bdevsw , NULL); } + +int +cdevsw_module_handler(module_t mod, modeventtype_t what, void* arg) +{ + struct cdevsw_module_data* data = (struct cdevsw_module_data*) arg; + int error; + + switch (what) { + case MOD_LOAD: + if (error = cdevsw_add(&data->dev, data->cdevsw, NULL)) + return error; + break; + + case MOD_UNLOAD: + if (error = cdevsw_add(&data->dev, NULL, NULL)) + return error; + break; + } + + if (data->chainevh) + return data->chainevh(mod, what, data->chainarg); + else + return 0; +} + +int +bdevsw_module_handler(module_t mod, modeventtype_t what, void* arg) +{ + struct bdevsw_module_data* data = (struct bdevsw_module_data*) arg; + int error; + + switch (what) { + case MOD_LOAD: + /* + * XXX hack alert. + */ + if (isdisk(data->bdev, VBLK) && data->bdevsw->d_flags != D_DISK) { + printf("bdevsw_module_handler: adding D_DISK flag for device %d\n", + major(data->bdev)); + data->bdevsw->d_flags = D_DISK; + } + cdevsw_make(data->bdevsw); + if (error = cdevsw_add(&data->cdev, data->bdevsw->d_cdev, NULL)) + return error; + if (error = bdevsw_add(&data->bdev, data->bdevsw, NULL)) + return error; + break; + + case MOD_UNLOAD: + if (error = cdevsw_add(&data->cdev, NULL, NULL)) + return error; + if (error = cdevsw_add(&data->bdev, NULL, NULL)) + return error; + break; + } + + if (data->chainevh) + return data->chainevh(mod, what, data->chainarg); + else + return 0; +} |