diff options
author | phk <phk@FreeBSD.org> | 1999-10-04 13:09:30 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-10-04 13:09:30 +0000 |
commit | ff20b1e15daec9c5e888431ce34127a17fe142ed (patch) | |
tree | 882bd37a8d9b23c0091ef184c646104e5bde2d6d /sys | |
parent | a8e22c41f54af176056ab89124555e2194ea8dce (diff) | |
download | FreeBSD-src-ff20b1e15daec9c5e888431ce34127a17fe142ed.zip FreeBSD-src-ff20b1e15daec9c5e888431ce34127a17fe142ed.tar.gz |
Introduce swopen to prevent blockdevice opens and insist on minor==0.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/vm_swap.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 4fc57a0..bafe434 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -49,6 +49,7 @@ #include <sys/kernel.h> #include <sys/lock.h> #include <sys/conf.h> +#include <sys/stat.h> #include <vm/vm.h> #include <vm/vm_extern.h> #include <vm/swap_pager.h> @@ -63,13 +64,14 @@ * provided as a character (raw) device. */ +static d_open_t swopen; static d_strategy_t swstrategy; #define CDEV_MAJOR 4 #define BDEV_MAJOR 26 static struct cdevsw sw_cdevsw = { - /* open */ nullopen, + /* open */ swopen, /* close */ nullclose, /* read */ physread, /* write */ physwrite, @@ -108,6 +110,20 @@ int vm_swap_size; * The bp is expected to be locked and *not* B_DONE on call. */ +static int +swopen(dev, flag, mode, p) + dev_t dev; + int flag; + int mode; + struct proc *p; +{ + + if (mode == S_IFBLK || minor(dev)) + return (ENXIO); + return (0); +} + + static void swstrategy(bp) register struct buf *bp; |