#include <version.h>
#include <kdata.h>
#include <devrd.h>
-#include <devmem.h>
-#include <devzero.h>
-#include <devnull.h>
-#include <devproc.h>
+#include <devsys.h>
#include <devlpr.h>
#include <tty.h>
#include <devtty.h>
{
// minor open close read write ioctl
// -----------------------------------------------------------------
- /* Memory disk block devices */
- { 0, rd_open, no_close, rd_read, rd_write, no_ioctl }, // 0 /dev/rd0
-
- /* devices below here are not mountable (as per NDEVS) */
- { 0, lpr_open, lpr_close, no_rdwr, lpr_write, no_ioctl }, // 1 /dev/lp
- { 0, tty_open, tty_close, tty_read, tty_write, tty_ioctl }, // 2 /dev/tty
- { 1, tty_open, tty_close, tty_read, tty_write, tty_ioctl }, // 3 /dev/tty1
- { 2, tty_open, tty_close, tty_read, tty_write, tty_ioctl }, // 4 /dev/tty2
- { 0, no_open, no_close, null_read, null_write, no_ioctl }, // 5 /dev/null
- { 0, no_open, no_close, zero_read, no_rdwr, no_ioctl }, // 6 /dev/zero
- { 0, no_open, no_close, mem_read, mem_write, no_ioctl }, // 7 /dev/kmem
- { 0, no_open, no_close, proc_read, no_rdwr, proc_ioctl} // 8 /dev/proc
- /* Add more tty channels here if available, incrementing minor# */
+ /* 0: /dev/fd Floppy disc block devices */
+ { rd_open, no_close, rd_read, rd_write, no_ioctl },
+ /* 1: /dev/hd Hard disc block devices (absent) */
+ { nxio_open, no_close, no_rdwr, no_rdwr, no_ioctl },
+ /* 2: /dev/tty TTY devices */
+ { tty_open, tty_close, tty_read, tty_write, tty_ioctl },
+ /* 3: /dev/lpr Printer devices */
+ { lpr_open, lpr_close, no_rdwr, lpr_write, no_ioctl },
+ /* 4: /dev/mem etc System devices (one offs) */
+ { no_open, no_close, sys_read, sys_write, sys_ioctl },
+ /* Pack to 7 with nxio if adding private devices and start at 8 */
};
-bool validdev(uint8_t dev)
+bool validdev(uint16_t dev)
{
- if(dev >= (sizeof(dev_tab)/sizeof(struct devsw)))
- return false;
+ /* This is a bit uglier than needed but the right hand side is
+ a constant this way */
+ if(dev > ((sizeof(dev_tab)/sizeof(struct devsw)) << 8) + 255)
+ return false;
else
return true;
}