Update for conf.h.

This commit is contained in:
mycroft 1995-04-10 09:22:28 +00:00
parent bdd61fbe66
commit 4d2499eb58

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.24 1995/03/02 03:33:02 chopps Exp $ */
/* $NetBSD: conf.c,v 1.25 1995/04/10 09:22:28 mycroft Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@ -53,289 +53,73 @@ 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 *))
/* bdevsw-specific types */
#define dev_type_dump(n) int n ()
#define dev_type_size(n) int n __P((dev_t))
#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)
#include "vnd.h"
#include "sd.h"
#include "cd.h"
bdev_decl(vnd);
bdev_decl(sd);
bdev_decl(cd);
#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 \
}
#include "st.h"
bdev_decl(st);
#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 \
}
#include "ch.h"
bdev_decl(ch); /* XXX not used yet */
#define bdev_ch_init(c) { \
dev_init(c,ch,open), \
dev_init(c,ch,close), \
(dev_type_strategy((*))) xxx, \
dev_init(c,ch,ioctl), \
(dev_type_dump((*))) enxio, \
(dev_type_size((*))) xxx, \
0 \
}
#include "fd.h"
bdev_decl(fd);
dev_decl(Fd,open);
dev_decl(Fd,close);
#define bdev_floppy_init(c) { \
dev_init(c,Fd,open), \
dev_init(c,Fd,close), \
dev_init(c,fd,strategy), \
dev_init(c,fd,ioctl), \
(dev_type_dump((*))) enxio, \
dev_size_init(c,fd), \
0 \
}
#define bdev_swap_init() { \
(dev_type_open((*))) enodev, \
(dev_type_close((*))) enodev, \
swstrategy, \
(dev_type_ioctl((*))) enodev, \
(dev_type_dump((*))) enodev, \
0, \
0 \
}
#define bdev_notdef() bdev_tape_init(0,no)
bdev_decl(no); /* dummy declarations */
#ifdef LKM
int lkmenodev();
#ifndef LKM
#define lkmenodev enodev
#else
#define lkmenodev enodev
int lkmenodev();
#endif
#define LKM_BDEV() { \
(dev_type_open((*))) lkmenodev, (dev_type_close((*))) lkmenodev, \
(dev_type_strategy((*))) lkmenodev, (dev_type_ioctl((*))) lkmenodev, \
(dev_type_dump((*))) lkmenodev, 0, 0 }
#include "vnd.h"
bdev_decl(vnd);
#include "sd.h"
bdev_decl(sd);
#include "cd.h"
bdev_decl(cd);
#include "st.h"
bdev_decl(st);
#include "fd.h"
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
bdev_decl(fd);
#undef fdopen
struct bdevsw bdevsw[] =
{
bdev_notdef(), /* 0: */
bdev_notdef(), /* 1: */
bdev_floppy_init(NFD), /* 2: floppy */
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
bdev_disk_init(NFD,fd), /* 2: floppy disk */
#undef fdopen
bdev_swap_init(), /* 3: swap pseudo-device */
bdev_disk_init(NSD,sd), /* 4: scsi disk */
bdev_tape_init(NST,st), /* 5: exabyte tape */
bdev_disk_init(NSD,sd), /* 4: SCSI disk */
bdev_tape_init(NST,st), /* 5: SCSI tape */
bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */
bdev_disk_init(NCD,cd), /* 7: scsi cd.*/
bdev_notdef(), /* 8: */
LKM_BDEV(), /* 9: Empty slot for LKM */
LKM_BDEV(), /* 10: Empty slot for LKM */
LKM_BDEV(), /* 11: Empty slot for LKM */
LKM_BDEV(), /* 12: Empty slot for LKM */
LKM_BDEV(), /* 13: Empty slot for LKM */
LKM_BDEV(), /* 14: Empty slot for LKM */
bdev_disk_init(NCD,cd), /* 7: SCSI CD-ROM */
bdev_notdef(), /* 8 */
bdev_lkm_dummy(), /* 9 */
bdev_lkm_dummy(), /* 10 */
bdev_lkm_dummy(), /* 11 */
bdev_lkm_dummy(), /* 12 */
bdev_lkm_dummy(), /* 13 */
bdev_lkm_dummy(), /* 14 */
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
/* open, close, ioctl, select, mmap -- XXX should be a map device */
#define cdev_grf_init(c) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, (dev_type_reset((*))) nullop, 0, \
dev_init(c,n,select), dev_init(c,n,mmap), 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_stop(n) int n __P((struct tty *, int))
#define dev_type_reset(n) int n __P((int))
#define dev_type_select(n) int n __P((dev_t, int, struct proc *))
#define dev_type_map(n) int n __P(())
/* open, close, ioctl, select, mmap -- XXX should be a map device */
#define cdev_view_init(c) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, (dev_type_reset((*))) nullop, 0, \
dev_init(c,n,select), dev_init(c,n,mmap), 0 }
#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,reset); 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) : 0)
/* open, close, read, write, ioctl, stop, 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), \
(dev_type_reset((*))) nullop, \
dev_tty_init(c,n), \
ttselect, \
(dev_type_map((*))) enodev, \
0 \
}
cdev_decl(no); /* dummy declarations */
#define cdev_notdef() { \
(dev_type_open((*))) enodev, \
(dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
(dev_type_select((*))) seltrue, \
(dev_type_map((*))) enodev, \
0 \
}
/* disks */
cdev_decl(vnd);
cdev_decl(sd);
#define cdev_disk_init(c,n) { \
dev_init(c,n,open), \
dev_init(c,n,close), \
rawread, \
rawwrite, \
dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
(dev_type_select((*))) seltrue, \
(dev_type_map((*))) enodev, \
dev_init(c,n,strategy) \
}
/* scsi tape */
cdev_decl(st);
#define cdev_st_init(c) { \
dev_init(c,st,open), \
dev_init(c,st,close), \
(dev_type_read((*))) rawread, \
(dev_type_write((*))) rawwrite, \
dev_init(c,st,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
(dev_type_select((*))) seltrue, \
(dev_type_map((*))) enodev, \
dev_init(c,st,strategy) \
}
/* floppy disk */
cdev_decl(fd);
dev_type_open(Fdopen);
dev_type_close(Fdclose);
#define cdev_floppy_init(c) { \
dev_init(c,Fd,open), \
dev_init(c,Fd,close), \
dev_init(c,fd,read), \
dev_init(c,fd,write), \
dev_init(c,fd,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
seltrue, \
(dev_type_map((*))) enodev, \
dev_init(c,fd,strategy) \
}
/* open, close, read, write, ioctl -- XXX should be a generic device */
#define cdev_par_init(c) { \
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_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, 0, (dev_type_select((*))) enodev, \
(dev_type_mmap((*))) enodev, 0 }
cdev_decl(cn);
/* console */
#define cdev_cn_init(c) { \
dev_init(c,cn,open), \
dev_init(c,cn,close), \
dev_init(c,cn,read), \
dev_init(c,cn,write), \
dev_init(c,cn,ioctl), \
(dev_type_stop((*))) nullop, \
(dev_type_reset((*))) nullop, \
0, \
dev_init(c,cn,select), \
(dev_type_map((*))) enodev, \
0 \
}
cdev_decl(ctty);
/* open, read, write, ioctl, select -- XXX should be a tty */
#define cdev_ctty_init(c) { \
dev_init(c,ctty,open), \
(dev_type_close((*))) nullop, \
dev_init(c,ctty,read), \
dev_init(c,ctty,write), \
dev_init(c,ctty,ioctl), \
(dev_type_stop((*))) nullop, \
(dev_type_reset((*))) nullop, \
0, \
dev_init(c,ctty,select), \
(dev_type_map((*))) enodev, \
0 \
}
dev_type_read(mmrw);
/* read/write */
#define cdev_mm_init(c) { \
(dev_type_open((*))) nullop, \
(dev_type_close((*))) nullop, \
mmrw, \
mmrw, \
(dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) nullop, \
(dev_type_reset((*))) nullop, \
0, \
(dev_type_select((*)))seltrue, \
(dev_type_map((*))) enodev, \
0 \
}
/* read, write, strategy */
#define cdev_swap_init(c) { \
(dev_type_open((*))) nullop, \
(dev_type_close((*))) nullop, \
rawread, \
rawwrite, \
(dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
(dev_type_select((*))) enodev, \
(dev_type_map((*))) enodev, \
dev_init(c,sw,strategy) \
}
#define mmread mmrw
#define mmwrite mmrw
cdev_decl(mm);
#include "pty.h"
#define pts_tty pt_tty
#define ptsioctl ptyioctl
@ -343,258 +127,77 @@ 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) { \
dev_init(c,ptc,open), \
dev_init(c,ptc,close), \
dev_init(c,ptc,read), \
dev_init(c,ptc,write), \
dev_init(c,ptc,ioctl), \
(dev_type_stop((*))) nullop, \
(dev_type_reset((*))) nullop, \
dev_tty_init(c,ptc), \
dev_init(c,ptc,select), \
(dev_type_map((*))) enodev, \
0 \
}
cdev_decl(log);
/* open, close, read, ioctl, select -- XXX should be a generic device */
#define cdev_log_init(c) { \
dev_init(c,log,open), \
dev_init(c,log,close), \
dev_init(c,log,read), \
(dev_type_write((*))) enodev, \
dev_init(c,log,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
dev_init(c,log,select), \
(dev_type_map((*))) enodev, \
0 \
}
cdev_decl(sd);
cdev_decl(cd);
#include "grf.h"
cdev_decl(grf);
/* open, close, ioctl, select, map -- XXX should be a map device */
#define cdev_grf_init(c) { \
dev_init(c,grf,open), \
dev_init(c,grf,close), \
(dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, \
dev_init(c,grf,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
dev_init(c,grf,select), \
dev_init(c,grf,map), \
0 \
}
#include "view.h"
cdev_decl(view);
/* open, close, ioctl, select, map -- XXX should be a map device */
#define cdev_view_init(c) { \
dev_init(c,view,open), \
dev_init(c,view,close), \
(dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, \
dev_init(c,view,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
dev_init(c,view,select), \
dev_init(c,view,map), \
0 \
}
#include "par.h"
cdev_decl(par);
/* open, close, read, write, ioctl -- XXX should be a generic device */
#define cdev_par_init(c) { \
dev_init(c,par,open), \
dev_init(c,par,close), \
dev_init(c,par,read), \
dev_init(c,par,write), \
dev_init(c,par,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
0, \
(dev_type_select((*))) enodev, \
(dev_type_map((*))) enodev, \
0 \
}
#include "ser.h"
cdev_decl(ser);
#include "ite.h"
cdev_decl(ite);
/* open, close, read, write, ioctl, tty -- XXX should be a tty! */
#define cdev_ite_init(c) { \
dev_init(c,ite,open), \
dev_init(c,ite,close), \
dev_init(c,ite,read), \
dev_init(c,ite,write), \
dev_init(c,ite,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
dev_tty_init(c,ite), \
ttselect, \
(dev_type_map((*))) enodev, \
0 \
}
#include "kbd.h"
cdev_decl(kbd);
/* open, close, read, write, ioctl, select */
#define cdev_kbd_init(c) { \
dev_init(c,kbd,open), \
dev_init(c,kbd,close), \
dev_init(c,kbd,read), \
dev_init(c,kbd,write), \
dev_init(c,kbd,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
(struct tty **) NULL, \
dev_init(c,kbd,select), \
(dev_type_map((*))) enodev, \
(dev_type_strategy((*))) 0 \
}
#include "mouse.h"
cdev_decl(ms);
/* open, close, read, write, ioctl, select */
#define cdev_mouse_init(c) { \
dev_init(c,ms,open), \
dev_init(c,ms,close), \
dev_init(c,ms,read), \
dev_init(c,ms,write), \
dev_init(c,ms,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) nullop, \
(struct tty **) NULL, \
dev_init(c,ms,select), \
(dev_type_map((*))) enodev, \
(dev_type_strategy((*))) NULL \
}
dev_type_open(fdopen);
/* open */
#define cdev_fd_init(c) { \
dev_init(c,fd,open), \
(dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) enodev, \
(struct tty **) NULL, \
(dev_type_select((*))) enodev, \
(dev_type_map((*))) enodev, \
(dev_type_strategy((*))) NULL \
}
#include "view.h"
cdev_decl(view);
#include "mfcs.h"
cdev_decl(mfcs);
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
cdev_decl(fd);
#undef fdopen
cdev_decl(vnd);
cdev_decl(st);
dev_decl(fd,open);
#include "bpfilter.h"
#include "tun.h"
cdev_decl(bpf);
#include "tun.h"
cdev_decl(tun);
/* open, close, read, write, ioctl, select -- XXX should be generic device */
#define cdev_bpftun_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_type_stop((*))) enodev, \
(dev_type_reset((*))) enodev, \
(struct tty **) NULL, \
dev_init(c,n,select), \
(dev_type_map((*))) enodev, \
(dev_type_strategy((*))) NULL \
}
#ifdef LKM
#define NLKM 1
#else
#define NLKM 0
#endif
dev_type_open(lkmopen);
dev_type_close(lkmclose);
dev_type_ioctl(lkmioctl);
#define cdev_lkm_init(c) { \
dev_init(c,lkm,open), \
dev_init(c,lkm,close), \
(dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, \
dev_init(c,lkm,ioctl), \
(dev_type_stop((*))) enodev, \
(dev_type_reset((*))) enodev, \
(struct tty **) NULL, \
(dev_type_select((*))) enodev,\
(dev_type_map((*))) enodev, \
(dev_type_strategy((*))) NULL \
}
#define LKM_CDEV() { \
(dev_type_open((*))) lkmenodev, \
(dev_type_close((*))) lkmenodev, \
(dev_type_read((*))) lkmenodev, \
(dev_type_write((*))) lkmenodev, \
(dev_type_ioctl((*))) lkmenodev, \
(dev_type_stop((*))) lkmenodev, \
(dev_type_reset((*))) nullop, \
(struct tty **) NULL, \
(dev_type_select((*))) seltrue, \
(dev_type_map((*))) lkmenodev, \
(dev_type_strategy((*))) NULL \
}
#include "ser.h"
cdev_decl(ser);
#include "mfcs.h"
cdev_decl(mfcs);
cdev_decl(lkm);
struct cdevsw cdevsw[] =
{
cdev_cn_init(1), /* 0: virtual console */
cdev_ctty_init(1), /* 1: controlling terminal */
cdev_mm_init(1), /* 2: /dev/{null,mem,kmem,...} */
cdev_swap_init(1), /* 3: /dev/drum (swap pseudo-device) */
cdev_cn_init(1,cn), /* 0: virtual console */
cdev_ctty_init(1,ctty), /* 1: controlling terminal */
cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
cdev_swap_init(1,sw), /* 3: /dev/drum (swap pseudo-device) */
cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
cdev_ptc_init(NPTY), /* 5: pseudo-tty master */
cdev_log_init(1), /* 6: /dev/klog */
cdev_notdef(), /* 7: */
cdev_disk_init(NSD,sd), /* 8: scsi disk */
cdev_disk_init(NCD,cd), /* 9: scsi cdrom */
cdev_grf_init(NGRF), /* 10: frame buffer */
cdev_par_init(NPAR), /* 11: parallel interface */
cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
cdev_log_init(1,log), /* 6: /dev/klog */
cdev_notdef(), /* 7 */
cdev_disk_init(NSD,sd), /* 8: SCSI disk */
cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
cdev_grf_init(NGRF,grf), /* 10: frame buffer */
cdev_par_init(NPAR,par), /* 11: parallel interface */
cdev_tty_init(NSER,ser), /* 12: built-in single-port serial */
cdev_ite_init(NITE), /* 13: console terminal emulator */
cdev_kbd_init(NKBD), /* 14: /dev/kbd */
cdev_mouse_init(NMOUSE), /* 15: /dev/mouse0 /dev/mouse1 */
cdev_view_init(NVIEW), /* 16: /dev/view00 /dev/view01 ... */
cdev_tty_init(NITE,ite), /* 13: console terminal emulator */
cdev_mouse_init(NKBD,kbd), /* 14: /dev/kbd */
cdev_mouse_init(NMOUSE,ms), /* 15: /dev/mouse0 /dev/mouse1 */
cdev_view_init(NVIEW,view), /* 16: /dev/view00 /dev/view01 ... */
cdev_tty_init(NMFCS,mfcs), /* 17: MultiFaceCard III serial */
cdev_floppy_init(NFD), /* 18: floppy */
cdev_disk_init(NVND,vnd), /* 19: vnode disk */
cdev_st_init(NST), /* 20: scsi tape */
cdev_fd_init(1), /* 21: file descriptor pseudo-dev */
cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */
cdev_bpftun_init(NTUN,tun), /* 23: berkeley packet filter */
cdev_lkm_init(NLKM), /* 24: loadable kernel modules pdev */
LKM_CDEV(), /* 25: Empty slot for LKM */
LKM_CDEV(), /* 26: Empty slot for LKM */
LKM_CDEV(), /* 27: Empty slot for LKM */
LKM_CDEV(), /* 28: Empty slot for LKM */
LKM_CDEV(), /* 29: Empty slot for LKM */
LKM_CDEV(), /* 30: Empty slot for LKM */
cdev_disk_init(NFD,fd), /* 18: floppy disk */
cdev_disk_init(NVND,vnd), /* 19: vnode disk driver */
cdev_st_init(NST,st), /* 20: SCSI tape */
cdev_fd_init(1,fd), /* 21: file descriptor pseudo-dev */
cdev_bpftun_init(NBPFILTER,bpf),/* 22: Berkeley packet filter */
cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */
cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
cdev_lkm_dummy(), /* 25 */
cdev_lkm_dummy(), /* 26 */
cdev_lkm_dummy(), /* 27 */
cdev_lkm_dummy(), /* 28 */
cdev_lkm_dummy(), /* 29 */
cdev_lkm_dummy(), /* 30 */
};
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
#ifdef BANKEDDEVPAGER
extern int grfbanked_get __P((int, int, int));
@ -631,78 +234,64 @@ int mem_no = 2; /* major device number of memory special file */
dev_t swapdev = makedev(3, 0);
/*
* return true if memory device (kmem or mem)
* Returns true if dev is /dev/mem or /dev/kmem.
*/
int
iskmemdev(dev)
dev_t dev;
{
if (major(dev) == mem_no && minor(dev) < 2)
return(1);
return(0);
return (major(dev) == mem_no && minor(dev) < 2);
}
/*
* return true if /dev/zero
* Returns true if dev is /dev/zero.
*/
int
iszerodev(dev)
dev_t dev;
{
if (major(dev) == mem_no && minor(dev) == 12)
return(1);
return(0);
}
/*
* return true if a disk
*/
int
isdisk(dev, type)
dev_t dev;
int type;
{
switch (major(dev)) {
case 2: /* fd: floppy */
case 4: /* sd: scsi disk */
case 7: /* cd: scsi cd-rom */
if (type == VBLK)
return(1);
break;
case 8: /* sd: scsi disk */
case 9: /* cd: scsi cdrom */
case 18: /* fd: floppy */
if (type == VCHR)
return(1);
break;
}
return(0);
return (major(dev) == mem_no && minor(dev) == 12);
}
static int chrtoblktab[] = {
/* CHR*/ /* BLK*/ /* CHR*/ /* BLK*/
/* 0 */ NODEV, /* 1 */ NODEV,
/* 2 */ NODEV, /* 3 */ 3,
/* 4 */ NODEV, /* 5 */ NODEV,
/* 6 */ NODEV, /* 7 */ NODEV,
/* 8 */ 4, /* 9 */ 7,
/* 10 */ NODEV, /* 11 */ NODEV,
/* 12 */ NODEV, /* 13 */ NODEV,
/* 14 */ NODEV, /* 15 */ NODEV,
/* 16 */ NODEV, /* 17 */ NODEV,
/* 18 */ 2, /* 19 */ 6,
/* 20 */ 5, /* 21 */ NODEV,
/* 22 */ NODEV, /* 23 */ NODEV,
/* 24 */ NODEV, /* 25 */ NODEV,
/* 26 */ NODEV, /* 27 */ NODEV,
/* 28 */ NODEV, /* 29 */ NODEV,
/*VCHR*/ /*VBLK*/
/* 0 */ NODEV,
/* 1 */ NODEV,
/* 2 */ NODEV,
/* 3 */ NODEV,
/* 4 */ NODEV,
/* 5 */ NODEV,
/* 6 */ NODEV,
/* 7 */ NODEV,
/* 8 */ 4,
/* 9 */ 7,
/* 10 */ NODEV,
/* 11 */ NODEV,
/* 12 */ NODEV,
/* 13 */ NODEV,
/* 14 */ NODEV,
/* 15 */ NODEV,
/* 16 */ NODEV,
/* 17 */ NODEV,
/* 18 */ 2,
/* 19 */ 6,
/* 20 */ 5,
/* 21 */ NODEV,
/* 22 */ NODEV,
/* 23 */ NODEV,
/* 24 */ NODEV,
/* 25 */ NODEV,
/* 26 */ NODEV,
/* 27 */ NODEV,
/* 28 */ NODEV,
/* 29 */ NODEV,
/* 30 */ NODEV,
};
/*
* convert chr dev to blk dev
* Convert a character device number to a block device number.
*/
dev_t
chrtoblk(dev)
dev_t dev;
{
@ -713,24 +302,24 @@ chrtoblk(dev)
blkmaj = chrtoblktab[major(dev)];
if (blkmaj == NODEV)
return(NODEV);
return(makedev(blkmaj, minor(dev)));
return (makedev(blkmaj, minor(dev)));
}
/*
* console capable devices entry points.
* This entire table could be autoconfig()ed but that would mean that
* the kernel's idea of the console would be out of sync with that of
* the standalone boot. I think it best that they both use the same
* known algorithm unless we see a pressing need otherwise.
*/
int sercnprobe(), sercninit(), sercngetc(), sercnputc();
void sercnpollc();
int ite_cnprobe(), ite_cninit(), ite_cngetc(), ite_cnputc();
void ite_cnpollc();
cons_decl(ser);
cons_decl(ite);
struct consdev constab[] = {
#if NSER > 0
{ sercnprobe, sercninit, sercngetc, sercnputc, sercnpollc },
cons_init(ser),
#endif
#if NITE > 0
{ ite_cnprobe, ite_cninit, ite_cngetc, ite_cnputc, ite_cnpollc },
cons_init(ite),
#endif
{ 0 },
};