Update for conf.h, and add a real chrtoblktbl[].
This commit is contained in:
parent
a9fe4eea9f
commit
a7b5f01159
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.24 1995/03/02 20:39:55 pk Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.25 1995/04/10 07:01:04 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -51,86 +51,31 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
int rawread __P((dev_t, struct uio *, int));
|
||||
int rawwrite __P((dev_t, struct uio *, int));
|
||||
void swstrategy __P((struct buf *));
|
||||
int ttselect __P((dev_t, int, struct proc *));
|
||||
|
||||
#define dev_type_open(n) int n __P((dev_t, int, int, struct proc *))
|
||||
#define dev_type_close(n) int n __P((dev_t, int, int, struct proc *))
|
||||
#define dev_type_strategy(n) void n __P((struct buf *))
|
||||
#define dev_type_ioctl(n) \
|
||||
int n __P((dev_t, u_long, caddr_t, int, struct proc *))
|
||||
#define dev_type_stop(n) int n __P((struct tty *, int))
|
||||
|
||||
/* bdevsw-specific types */
|
||||
#define dev_type_dump(n) int n __P(()) /* sorry, cannot prototype */
|
||||
#define dev_type_size(n) int n __P((dev_t))
|
||||
|
||||
/* error/nullop functions */
|
||||
#define error_open ((dev_type_open((*))) enodev)
|
||||
#define error_close ((dev_type_close((*))) enodev)
|
||||
#define error_ioctl ((dev_type_ioctl((*))) enodev)
|
||||
#define error_stop ((dev_type_stop((*))) enodev)
|
||||
#define error_dump ((dev_type_dump((*))) enodev)
|
||||
|
||||
#define null_open ((dev_type_open((*))) nullop)
|
||||
#define null_close ((dev_type_close((*))) nullop)
|
||||
|
||||
#define dev_decl(n,t) __CONCAT(dev_type_,t)(__CONCAT(n,t))
|
||||
#define dev_init(c,n,t) \
|
||||
(c > 0 ? __CONCAT(n,t) : (__CONCAT(dev_type_,t)((*))) enxio)
|
||||
|
||||
/* bdevsw-specific initializations */
|
||||
#define dev_size_init(c,n) (c > 0 ? __CONCAT(n,size) : 0)
|
||||
|
||||
#define bdev_decl(n) \
|
||||
dev_decl(n,open); dev_decl(n,close); dev_decl(n,strategy); \
|
||||
dev_decl(n,ioctl); dev_decl(n,dump); dev_decl(n,size)
|
||||
|
||||
#define bdev_disk_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), \
|
||||
dev_init(c,n,strategy), dev_init(c,n,ioctl), \
|
||||
dev_init(c,n,dump), dev_size_init(c,n), 0 }
|
||||
|
||||
#define bdev_tape_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), \
|
||||
dev_init(c,n,strategy), dev_init(c,n,ioctl), \
|
||||
dev_init(c,n,dump), 0, B_TAPE }
|
||||
|
||||
#define bdev_swap_init() { \
|
||||
error_open, error_close, swstrategy, error_ioctl, error_dump, 0, 0 }
|
||||
|
||||
#define bdev_notdef() bdev_tape_init(0,no)
|
||||
bdev_decl(no); /* dummy declarations */
|
||||
|
||||
#include "sd.h"
|
||||
#include "st.h"
|
||||
#include "cd.h"
|
||||
#include "fd.h"
|
||||
#include "vnd.h"
|
||||
|
||||
bdev_decl(sd);
|
||||
bdev_decl(st);
|
||||
bdev_decl(cd);
|
||||
bdev_decl(vnd);
|
||||
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
|
||||
#define fdclose Fdclose /* conflicts with fdclose() in kern_descrip.c */
|
||||
bdev_decl(fd);
|
||||
#undef fdopen
|
||||
#undef fdclose
|
||||
|
||||
#ifdef LKM
|
||||
int lkmenodev(); /* lkm "nodev" routine */
|
||||
int lkmenodev();
|
||||
#else
|
||||
#define lkmenodev enodev
|
||||
#endif
|
||||
|
||||
#define bdev_lkm_stub() { \
|
||||
((dev_type_open((*)))lkmenodev), dev_init(0,no,close), \
|
||||
dev_init(0,no,strategy), dev_init(0,no,ioctl), \
|
||||
dev_init(0,no,dump), 0, 0 }
|
||||
#include "sd.h"
|
||||
bdev_decl(sd);
|
||||
#include "st.h"
|
||||
bdev_decl(st);
|
||||
#include "cd.h"
|
||||
bdev_decl(cd);
|
||||
#include "vnd.h"
|
||||
bdev_decl(vnd);
|
||||
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
|
||||
#include "fd.h"
|
||||
bdev_decl(fd);
|
||||
#undef fdopen
|
||||
|
||||
struct bdevsw bdevsw[] =
|
||||
{
|
||||
@ -141,8 +86,8 @@ struct bdevsw bdevsw[] =
|
||||
bdev_notdef(), /* 4 */
|
||||
bdev_notdef(), /* 5 */
|
||||
bdev_notdef(), /* 6 */
|
||||
bdev_disk_init(NSD,sd), /* 7: scsi disk */
|
||||
bdev_disk_init(NVND,vnd), /* 8: vnode */
|
||||
bdev_disk_init(NSD,sd), /* 7: SCSI disk */
|
||||
bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */
|
||||
bdev_notdef(), /* 9: */
|
||||
bdev_notdef(), /* 10: */
|
||||
bdev_tape_init(NST,st), /* 11: SCSI tape */
|
||||
@ -151,55 +96,18 @@ struct bdevsw bdevsw[] =
|
||||
bdev_notdef(), /* 14: */
|
||||
bdev_notdef(), /* 15: */
|
||||
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
|
||||
#define fdclose Fdclose /* conflicts with fdclose() in kern_descrip.c */
|
||||
bdev_disk_init(NFD,fd), /* 16: floppy disk */
|
||||
#undef fdopen
|
||||
#undef fdclose
|
||||
bdev_notdef(), /* 17: */
|
||||
bdev_disk_init(NCD,cd), /* 18: scsi cdrom */
|
||||
bdev_lkm_stub(), /* 19: LKM STUB */
|
||||
bdev_lkm_stub(), /* 20: LKM STUB */
|
||||
bdev_lkm_stub(), /* 21: LKM STUB */
|
||||
bdev_lkm_stub(), /* 22: LKM STUB */
|
||||
bdev_lkm_stub(), /* 23: LKM STUB */
|
||||
bdev_lkm_stub(), /* 24: LKM STUB */
|
||||
bdev_disk_init(NCD,cd), /* 18: SCSI CD-ROM */
|
||||
bdev_lkm_dummy(), /* 19: LKM STUB */
|
||||
bdev_lkm_dummy(), /* 20: LKM STUB */
|
||||
bdev_lkm_dummy(), /* 21: LKM STUB */
|
||||
bdev_lkm_dummy(), /* 22: LKM STUB */
|
||||
bdev_lkm_dummy(), /* 23: LKM STUB */
|
||||
bdev_lkm_dummy(), /* 24: LKM STUB */
|
||||
};
|
||||
|
||||
int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
|
||||
|
||||
/* cdevsw-specific types */
|
||||
#define dev_type_read(n) int n __P((dev_t, struct uio *, int))
|
||||
#define dev_type_write(n) int n __P((dev_t, struct uio *, int))
|
||||
#define dev_type_select(n) int n __P((dev_t, int, struct proc *))
|
||||
#define dev_type_map(n) int n __P(())
|
||||
|
||||
#define error_read ((dev_type_read((*))) enodev)
|
||||
#define error_write ((dev_type_write((*))) enodev)
|
||||
#define error_select ((dev_type_select((*))) enodev)
|
||||
|
||||
#define cdev_decl(n) \
|
||||
dev_decl(n,open); dev_decl(n,close); dev_decl(n,read); \
|
||||
dev_decl(n,write); dev_decl(n,ioctl); dev_decl(n,stop); \
|
||||
dev_decl(n,select); dev_decl(n,map); dev_decl(n,strategy); \
|
||||
extern struct tty *__CONCAT(n,_tty)[];
|
||||
|
||||
#define dev_tty_init(c,n) (c > 0 ? __CONCAT(n,_tty) : (struct tty **)0)
|
||||
|
||||
/* open, close, read, write, ioctl, strategy */
|
||||
#define cdev_disk_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), rawread, rawwrite, \
|
||||
dev_init(c,n,ioctl), 0, 0, 0, seltrue, 0, dev_init(c,n,strategy) }
|
||||
|
||||
/* open, close, read, write, ioctl, strategy */
|
||||
#define cdev_tape_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), rawread, rawwrite, \
|
||||
dev_init(c,n,ioctl), 0, 0, 0, seltrue, 0, dev_init(c,n,strategy) }
|
||||
|
||||
/* open, close, read, write, ioctl, tty */
|
||||
#define cdev_tty_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
|
||||
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
|
||||
0, dev_tty_init(c,n), ttselect, 0, 0 }
|
||||
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
|
||||
|
||||
/* open, close, read, write, ioctl, select */
|
||||
#define cdev_gen_init(c,n) { \
|
||||
@ -209,41 +117,31 @@ int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
|
||||
|
||||
/* open, close, ioctl, mmap */
|
||||
#define cdev_fb_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), error_read, error_write, \
|
||||
dev_init(c,n,ioctl), 0, 0, 0, seltrue, dev_init(c,n,map), 0 }
|
||||
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
|
||||
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
|
||||
(dev_type_stop((*))) nullop, (dev_type_reset((*))) nullop, 0, \
|
||||
seltrue, dev_init(c,n,mmap), 0 }
|
||||
|
||||
#define cdev_notdef() { \
|
||||
error_open, error_close, error_read, error_write, \
|
||||
error_ioctl, 0, 0, 0, seltrue, 0, 0 }
|
||||
|
||||
cdev_decl(no); /* dummy declarations */
|
||||
/* open, close, ioctl */
|
||||
#define cdev_openprom_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
|
||||
(dev_type_write((*))) enodev, dev_init(c,n,ioctl),
|
||||
(dev_type_stop((*))) nullop, (dev_type_reset((*))) nullop, 0, \
|
||||
(dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, 0 }
|
||||
|
||||
cdev_decl(cn);
|
||||
/* open, close, read, write, ioctl, select -- XXX should be a tty */
|
||||
extern struct tty *cn_tty[];
|
||||
#define cdev_cn_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
|
||||
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
|
||||
0, cn_tty, dev_init(c,n,select), 0, 0 }
|
||||
|
||||
cdev_decl(ctty);
|
||||
/* open, read, write, ioctl, select -- XXX should be a tty */
|
||||
#define cdev_ctty_init(c,n) { \
|
||||
dev_init(c,n,open), null_close, dev_init(c,n,read), \
|
||||
dev_init(c,n,write), dev_init(c,n,ioctl), 0, \
|
||||
0, 0, dev_init(c,n,select), 0, 0 }
|
||||
|
||||
dev_type_read(mmrw);
|
||||
/* read/write */
|
||||
#define cdev_mm_init(c,n) { \
|
||||
null_open, null_close, mmrw, mmrw, error_ioctl, 0, 0, 0, \
|
||||
seltrue, 0, 0 }
|
||||
|
||||
/* read, write, strategy */
|
||||
#define cdev_swap_init(c,n) { \
|
||||
null_open, null_close, rawread, rawwrite, error_ioctl, 0, 0, 0, \
|
||||
seltrue, 0, dev_init(c,n,strategy) }
|
||||
|
||||
#define mmread mmrw
|
||||
#define mmwrite mmrw
|
||||
cdev_devl(mm);
|
||||
#include "zs.h"
|
||||
cdev_decl(zs);
|
||||
cdev_decl(ms);
|
||||
cdev_decl(log);
|
||||
cdev_decl(sd);
|
||||
cdev_decl(st);
|
||||
#include "ch.h"
|
||||
cdev_decl(ch);
|
||||
#include "pty.h"
|
||||
#define pts_tty pt_tty
|
||||
#define ptsioctl ptyioctl
|
||||
@ -251,87 +149,34 @@ cdev_decl(pts);
|
||||
#define ptc_tty pt_tty
|
||||
#define ptcioctl ptyioctl
|
||||
cdev_decl(ptc);
|
||||
|
||||
/* open, close, read, write, ioctl, tty, select */
|
||||
#define cdev_ptc_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
|
||||
dev_init(c,n,write), dev_init(c,n,ioctl), 0, \
|
||||
0, dev_tty_init(c,n), dev_init(c,n,select), 0, 0 }
|
||||
|
||||
cdev_decl(log);
|
||||
/* open, close, read, ioctl, select -- XXX should be a generic device */
|
||||
#define cdev_log_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
|
||||
error_write, dev_init(c,n,ioctl), 0, 0, 0, dev_init(c,n,select), 0, 0 }
|
||||
|
||||
dev_type_open(fdopen);
|
||||
/* open */
|
||||
#define cdev_fd_init(c,n) { \
|
||||
dev_init(c,n,open), error_close, error_read, error_write, \
|
||||
error_ioctl, 0, 0, 0, error_select, 0, 0 }
|
||||
|
||||
#include "zs.h"
|
||||
cdev_decl(zs);
|
||||
|
||||
cdev_decl(kbd);
|
||||
cdev_decl(ms);
|
||||
cdev_decl(fb);
|
||||
|
||||
dev_decl(fd,open);
|
||||
#include "bwtwo.h"
|
||||
cdev_decl(bwtwo);
|
||||
|
||||
cdev_decl(kbd);
|
||||
#define fdopen Fdopen
|
||||
cdev_decl(fd);
|
||||
#undef fdopen
|
||||
#include "cgthree.h"
|
||||
cdev_decl(cgthree);
|
||||
|
||||
cdev_decl(sd);
|
||||
cdev_decl(st);
|
||||
cdev_decl(cd);
|
||||
#include "cgsix.h"
|
||||
cdev_decl(cgsix);
|
||||
#include "bsdaudio.h"
|
||||
cdev_decl(oudio);
|
||||
cdev_decl(openprom);
|
||||
#include "bpfilter.h"
|
||||
cdev_decl(bpf);
|
||||
cdev_decl(vnd);
|
||||
|
||||
#include "tun.h"
|
||||
cdev_decl(tun);
|
||||
#ifdef LKM
|
||||
#define NLKM 1
|
||||
#else
|
||||
#define NLKM 0
|
||||
#endif
|
||||
cdev_decl(lkm);
|
||||
#define cdev_lkm_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), error_read, error_write, \
|
||||
dev_init(c,n,ioctl), 0, 0, 0, error_select, 0, 0 }
|
||||
#define cdev_lkm_stub() { \
|
||||
((dev_type_open((*)))lkmenodev), dev_init(0,no,close), \
|
||||
error_read, error_write, error_ioctl, 0, 0, 0, error_select, 0, 0 }
|
||||
|
||||
#include "ch.h"
|
||||
cdev_decl(ch);
|
||||
/* open, close, ioctl */
|
||||
#define cdev_ch_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), error_read, error_write, \
|
||||
dev_init(c,n,ioctl), 0, 0, 0, error_select, 0, 0 }
|
||||
|
||||
#include "cgsix.h"
|
||||
cdev_decl(cgsix);
|
||||
|
||||
#include "bsdaudio.h"
|
||||
cdev_decl(oudio);
|
||||
|
||||
#include "tun.h"
|
||||
cdev_decl(tun);
|
||||
|
||||
cdev_decl(openprom);
|
||||
/* open, close, ioctl */
|
||||
#define cdev_openprom_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), error_read, error_write, \
|
||||
dev_init(c,n,ioctl), 0, 0, 0, error_select, 0, 0 }
|
||||
|
||||
#include "bpfilter.h"
|
||||
cdev_decl(bpf);
|
||||
/* open, close, read, write, ioctl, select -- XXX should be generic device */
|
||||
#define cdev_bpf_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
|
||||
dev_init(c,n,write), dev_init(c,n,ioctl), 0, 0, 0, \
|
||||
dev_init(c,n,select), 0, 0 }
|
||||
|
||||
/* prototype sun-equivalent cdevsw[] */
|
||||
struct cdevsw cdevsw[] =
|
||||
{
|
||||
cdev_cn_init(1,cn), /* 0: virtual console */
|
||||
@ -351,14 +196,14 @@ struct cdevsw cdevsw[] =
|
||||
cdev_notdef(), /* 14 */
|
||||
cdev_notdef(), /* 15: sun /dev/winNNN */
|
||||
cdev_log_init(1,log), /* 16: /dev/klog */
|
||||
cdev_disk_init(NSD,sd), /* 17: scsi disk */
|
||||
cdev_tape_init(NST,st), /* 18: scsi tape */
|
||||
cdev_disk_init(NSD,sd), /* 17: SCSI disk */
|
||||
cdev_tape_init(NST,st), /* 18: SCSI tape */
|
||||
cdev_ch_init(NCH,ch), /* 19: SCSI autochanger */
|
||||
cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
|
||||
cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
|
||||
cdev_fb_init(1,fb), /* 22: /dev/fb indirect driver */
|
||||
cdev_notdef(), /* 23 */
|
||||
cdev_fd_init(1,fd), /* 24: /dev/std{in,out,err} */
|
||||
cdev_fd_init(1,fd), /* 24: file descriptor pseudo-device */
|
||||
cdev_notdef(), /* 25 */
|
||||
cdev_notdef(), /* 26 */
|
||||
cdev_fb_init(NBWTWO,bwtwo), /* 27: /dev/bwtwo */
|
||||
@ -389,14 +234,12 @@ struct cdevsw cdevsw[] =
|
||||
cdev_notdef(), /* 52 */
|
||||
cdev_notdef(), /* 53 */
|
||||
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
|
||||
#define fdclose Fdclose /* conflicts with fdclose() in kern_descrip.c */
|
||||
cdev_disk_init(NFD,fd), /* 54: floppy disk */
|
||||
#undef fdopen
|
||||
#undef fdclose
|
||||
cdev_fb_init(NCGTHREE,cgthree), /* 55: /dev/cgthree */
|
||||
cdev_notdef(), /* 56 */
|
||||
cdev_notdef(), /* 57 */
|
||||
cdev_disk_init(NCD,cd), /* 58 scsi cdrom */
|
||||
cdev_disk_init(NCD,cd), /* 58 SCSI CD-ROM */
|
||||
cdev_notdef(), /* 59 */
|
||||
cdev_notdef(), /* 60 */
|
||||
cdev_notdef(), /* 61 */
|
||||
@ -443,23 +286,22 @@ struct cdevsw cdevsw[] =
|
||||
cdev_notdef(), /* 102 */
|
||||
cdev_notdef(), /* 103 */
|
||||
cdev_notdef(), /* 104 */
|
||||
cdev_bpf_init(NBPFILTER,bpf), /* 105: packet filter */
|
||||
cdev_bpftun_init(NBPFILTER,bpf),/* 105: packet filter */
|
||||
cdev_notdef(), /* 106 */
|
||||
cdev_notdef(), /* 107 */
|
||||
cdev_notdef(), /* 108 */
|
||||
cdev_notdef(), /* 109 */
|
||||
cdev_disk_init(NVND,vnd), /* 110: vnode disk */
|
||||
cdev_gen_init(NTUN,tun), /* 111: tunnel */
|
||||
cdev_disk_init(NVND,vnd), /* 110: vnode disk driver */
|
||||
cdev_bpftun_init(NTUN,tun), /* 111: network tunnel */
|
||||
cdev_lkm_init(NLKM,lkm), /* 112: loadable kernel modules */
|
||||
cdev_lkm_stub(), /* 113: LKM STUB */
|
||||
cdev_lkm_stub(), /* 114: LKM STUB */
|
||||
cdev_lkm_stub(), /* 115: LKM STUB */
|
||||
cdev_lkm_stub(), /* 116: LKM STUB */
|
||||
cdev_lkm_stub(), /* 117: LKM STUB */
|
||||
cdev_lkm_stub(), /* 118: LKM STUB */
|
||||
cdev_lkm_dummy(), /* 113: LKM STUB */
|
||||
cdev_lkm_dummy(), /* 114: LKM STUB */
|
||||
cdev_lkm_dummy(), /* 115: LKM STUB */
|
||||
cdev_lkm_dummy(), /* 116: LKM STUB */
|
||||
cdev_lkm_dummy(), /* 117: LKM STUB */
|
||||
cdev_lkm_dummy(), /* 118: LKM STUB */
|
||||
};
|
||||
|
||||
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
|
||||
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
|
||||
|
||||
int mem_no = 3; /* major device number of memory special file */
|
||||
|
||||
@ -483,59 +325,151 @@ iskmemdev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
|
||||
return (major(dev) == 3 && minor(dev) < 2);
|
||||
return (major(dev) == mem_no && minor(dev) < 2);
|
||||
}
|
||||
|
||||
iszerodev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
return (major(dev) == 3 && minor(dev) == 12);
|
||||
return (major(dev) == mem_no && minor(dev) == 12);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Routine to determine if a device is a disk.
|
||||
*
|
||||
* A minimal stub routine can always return 0.
|
||||
*/
|
||||
isdisk(dev, type)
|
||||
dev_t dev;
|
||||
int type;
|
||||
{
|
||||
|
||||
#ifdef notyet
|
||||
/* someday, something like this, perhaps */
|
||||
dev = devtab[major(dev)];
|
||||
return (dev != NULL && dev->dv_class == DV_DISK);
|
||||
#else
|
||||
switch (major(dev)) {
|
||||
case 7:
|
||||
case 16:
|
||||
if (type == VBLK)
|
||||
return (1);
|
||||
return (0);
|
||||
case 17:
|
||||
case 54:
|
||||
if (type == VCHR)
|
||||
return (1);
|
||||
/* fall through */
|
||||
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
static int chrtoblktbl[] = {
|
||||
/* XXXX This needs to be dynamic for LKMs. */
|
||||
/*VCHR*/ /*VBLK*/
|
||||
/* 0 */ NODEV,
|
||||
/* 1 */ NODEV,
|
||||
/* 2 */ NODEV,
|
||||
/* 3 */ NODEV,
|
||||
/* 4 */ NODEV,
|
||||
/* 5 */ NODEV,
|
||||
/* 6 */ NODEV,
|
||||
/* 7 */ NODEV,
|
||||
/* 8 */ NODEV,
|
||||
/* 9 */ NODEV,
|
||||
/* 10 */ NODEV,
|
||||
/* 11 */ NODEV,
|
||||
/* 12 */ NODEV,
|
||||
/* 13 */ NODEV,
|
||||
/* 14 */ NODEV,
|
||||
/* 15 */ NODEV,
|
||||
/* 16 */ NODEV,
|
||||
/* 17 */ 7,
|
||||
/* 18 */ 11,
|
||||
/* 19 */ NODEV,
|
||||
/* 20 */ NODEV,
|
||||
/* 21 */ NODEV,
|
||||
/* 22 */ NODEV,
|
||||
/* 23 */ NODEV,
|
||||
/* 24 */ NODEV,
|
||||
/* 25 */ NODEV,
|
||||
/* 26 */ NODEV,
|
||||
/* 27 */ NODEV,
|
||||
/* 28 */ NODEV,
|
||||
/* 29 */ NODEV,
|
||||
/* 30 */ NODEV,
|
||||
/* 31 */ NODEV,
|
||||
/* 32 */ NODEV,
|
||||
/* 33 */ NODEV,
|
||||
/* 34 */ NODEV,
|
||||
/* 35 */ NODEV,
|
||||
/* 36 */ NODEV,
|
||||
/* 37 */ NODEV,
|
||||
/* 38 */ NODEV,
|
||||
/* 39 */ NODEV,
|
||||
/* 40 */ NODEV,
|
||||
/* 41 */ NODEV,
|
||||
/* 42 */ NODEV,
|
||||
/* 43 */ NODEV,
|
||||
/* 44 */ NODEV,
|
||||
/* 45 */ NODEV,
|
||||
/* 46 */ NODEV,
|
||||
/* 47 */ NODEV,
|
||||
/* 48 */ NODEV,
|
||||
/* 49 */ NODEV,
|
||||
/* 50 */ NODEV,
|
||||
/* 51 */ NODEV,
|
||||
/* 52 */ NODEV,
|
||||
/* 53 */ NODEV,
|
||||
/* 54 */ 16,
|
||||
/* 55 */ NODEV,
|
||||
/* 56 */ NODEV,
|
||||
/* 57 */ NODEV,
|
||||
/* 58 */ 18,
|
||||
/* 59 */ NODEV,
|
||||
/* 60 */ NODEV,
|
||||
/* 61 */ NODEV,
|
||||
/* 62 */ NODEV,
|
||||
/* 63 */ NODEV,
|
||||
/* 64 */ NODEV,
|
||||
/* 65 */ NODEV,
|
||||
/* 66 */ NODEV,
|
||||
/* 67 */ NODEV,
|
||||
/* 68 */ NODEV,
|
||||
/* 69 */ NODEV,
|
||||
/* 70 */ NODEV,
|
||||
/* 71 */ NODEV,
|
||||
/* 72 */ NODEV,
|
||||
/* 73 */ NODEV,
|
||||
/* 74 */ NODEV,
|
||||
/* 75 */ NODEV,
|
||||
/* 76 */ NODEV,
|
||||
/* 77 */ NODEV,
|
||||
/* 78 */ NODEV,
|
||||
/* 79 */ NODEV,
|
||||
/* 80 */ NODEV,
|
||||
/* 81 */ NODEV,
|
||||
/* 82 */ NODEV,
|
||||
/* 83 */ NODEV,
|
||||
/* 84 */ NODEV,
|
||||
/* 85 */ NODEV,
|
||||
/* 86 */ NODEV,
|
||||
/* 87 */ NODEV,
|
||||
/* 88 */ NODEV,
|
||||
/* 89 */ NODEV,
|
||||
/* 90 */ NODEV,
|
||||
/* 91 */ NODEV,
|
||||
/* 92 */ NODEV,
|
||||
/* 93 */ NODEV,
|
||||
/* 94 */ NODEV,
|
||||
/* 95 */ NODEV,
|
||||
/* 96 */ NODEV,
|
||||
/* 97 */ NODEV,
|
||||
/* 98 */ NODEV,
|
||||
/* 99 */ NODEV,
|
||||
/*100 */ NODEV,
|
||||
/*101 */ NODEV,
|
||||
/*102 */ NODEV,
|
||||
/*103 */ NODEV,
|
||||
/*104 */ NODEV,
|
||||
/*105 */ NODEV,
|
||||
/*106 */ NODEV,
|
||||
/*107 */ NODEV,
|
||||
/*108 */ NODEV,
|
||||
/*109 */ NODEV,
|
||||
/*110 */ 8,
|
||||
/*111 */ NODEV,
|
||||
/*112 */ NODEV,
|
||||
/*113 */ NODEV,
|
||||
/*114 */ NODEV,
|
||||
/*115 */ NODEV,
|
||||
/*116 */ NODEV,
|
||||
/*117 */ NODEV,
|
||||
/*118 */ NODEV,
|
||||
};
|
||||
|
||||
/*
|
||||
* Routine to convert from character to block device number.
|
||||
*
|
||||
* A minimal stub routine can always return NODEV.
|
||||
*/
|
||||
chrtoblk(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int blkmaj;
|
||||
|
||||
if (major(dev) != 17)
|
||||
if (major(dev) >= nchrdev)
|
||||
return (NODEV);
|
||||
return (makedev(7, minor(dev)));
|
||||
blkmaj = chrtoblktbl[major(dev)];
|
||||
if (blkmaj == NODEV)
|
||||
return (NODEV);
|
||||
return (makedev(blkmaj, minor(dev)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user