Introduce swopen to prevent blockdevice opens and insist on minor==0.

This commit is contained in:
Poul-Henning Kamp 1999-10-04 13:09:30 +00:00
parent adab70d67a
commit 9753e1c4c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51930

View File

@ -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;