Driver mapping refactory.

VFS CHANGES:
- dmap table no longer statically initialized in VFS
- Dropped FSSIGNON svrctl call no longer used by INET

INET CHANGES:
- INET announces its presence to VFS just like any other driver

RS CHANGES:
- The boot image dev table contains all the data to initialize VFS' dmap table
- RS interface supports asynchronous up and update operations now
- RS interface extended to support driver style and flags
This commit is contained in:
Cristiano Giuffrida
2010-04-09 21:56:44 +00:00
parent c1bfcc9119
commit 65ef539739
34 changed files with 357 additions and 280 deletions

View File

@@ -175,6 +175,9 @@
#define CHECK_IRQ 0x40 /* check if IRQ can be used */
#define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
/* Bits for device driver flags managed by RS and VFS. */
#define DRV_FORCED 0x01 /* driver is mapped even if not alive yet */
/* Values for the "verbose" boot monitor variable */
#define VERBOSEBOOT_QUIET 0
#define VERBOSEBOOT_BASIC 1

View File

@@ -4,21 +4,39 @@
#include <minix/sys_config.h>
#include <minix/ipc.h>
enum dev_style { STYLE_DEV, STYLE_NDEV, STYLE_TTY, STYLE_CLONE };
enum dev_style { STYLE_NDEV, STYLE_DEV, STYLE_DEVA, STYLE_TTY, STYLE_CTTY,
STYLE_CLONE };
#define IS_DEV_STYLE(s) (s>=STYLE_NDEV && s<=STYLE_CLONE)
/*===========================================================================*
* Major and minor device numbers *
*===========================================================================*/
/* Total number of different devices. */
#define NR_DEVICES 32 /* number of (major) devices */
#define NR_DEVICES NR_SYS_PROCS /* number of (major) devices */
#define NONE_MAJOR 0 /* pseudo device for mounting file
* systems without a real block device
*/
/* Major device numbers. */
#define NONE_MAJOR 0 /* 0 = not used */
#define MEMORY_MAJOR 1 /* 1 = /dev/mem (memory devices) */
#define FLOPPY_MAJOR 2 /* 2 = /dev/fd0 (floppy disks) */
/* 3 = /dev/c0 */
#define TTY_MAJOR 4 /* 4 = /dev/tty00 (ttys) */
#define CTTY_MAJOR 5 /* 5 = /dev/tty */
#define PRINTER_MAJOR 6 /* 6 = /dev/lp (printer driver) */
#define INET_MAJOR 7 /* 7 = /dev/ip (inet) */
/* 8 = /dev/c1 */
/* 9 = not used */
/* 10 = /dev/c2 */
#define FILTER_MAJOR 11 /* 11 = /dev/filter (filter driver) */
/* 12 = /dev/c3 */
#define AUDIO_MAJOR 13 /* 13 = /dev/audio (audio driver) */
/* 14 = not used */
#define LOG_MAJOR 15 /* 15 = /dev/klog (log driver) */
#define RANDOM_MAJOR 16 /* 16 = /dev/random (random driver) */
#define HELLO_MAJOR 17 /* 17 = /dev/hello (hello driver) */
/* Major and minor device numbers for MEMORY driver. */
#define MEMORY_MAJOR 1 /* major device for memory devices */
/* Minor device numbers for memory driver. */
# define RAM_DEV_OLD 0 /* minor device for /dev/ram */
# define MEM_DEV 1 /* minor device for /dev/mem */
# define KMEM_DEV 2 /* minor device for /dev/kmem */
@@ -30,21 +48,12 @@ enum dev_style { STYLE_DEV, STYLE_NDEV, STYLE_TTY, STYLE_CLONE };
#define CTRLR(n) ((n)==0 ? 3 : (8 + 2*((n)-1))) /* magic formula */
/* Minor device numbers for log driver. */
# define IS_KLOG_DEV 0 /* minor device for /dev/klog */
/* Full device numbers that are special to the boot monitor and FS. */
# define DEV_RAM 0x0100 /* device number of /dev/ram */
# define DEV_IMGRD 0x0106 /* device number of /dev/imgrd */
#define FLOPPY_MAJOR 2 /* major device for floppy disks */
#define TTY_MAJOR 4 /* major device for ttys */
#define CTTY_MAJOR 5 /* major device for /dev/tty */
#define INET_MAJOR 7 /* major device for inet */
#define FILTER_MAJOR 11 /* major device for filter driver */
#define LOG_MAJOR 15 /* major device for log driver */
# define IS_KLOG_DEV 0 /* minor device for /dev/klog */
#define HELLO_MAJOR 17 /* major device for hello driver */
#endif /* _DMAP_H */

View File

@@ -20,6 +20,7 @@ Interface to the reincarnation server
*/
#define RSS_IPC_VALID 0x02 /* rss_ipc and rss_ipclen are valid */
#define RSS_REUSE 0x04 /* Try to reuse previously copied binary */
#define RSS_NOBLOCK 0x08 /* unblock caller immediately */
/* Common definitions. */
#define RS_NR_CONTROL 8
@@ -43,6 +44,7 @@ struct rs_start
uid_t rss_uid;
int rss_nice;
int rss_major;
int rss_dev_style;
long rss_period;
char *rss_script;
size_t rss_scriptlen;
@@ -79,10 +81,12 @@ struct rprocpub {
short in_use; /* set when the entry is in use */
unsigned sys_flags; /* sys flags */
endpoint_t endpoint; /* process endpoint number */
long period; /* heartbeat period (or zero) */
int dev_flags; /* device flags */
dev_t dev_nr; /* major device number */
int dev_style; /* device style */
long period; /* heartbeat period (or zero) */
int dev_style2; /* device style for next major dev number */
char label[RS_MAX_LABEL_LEN]; /* label of this service */
char proc_name[RS_MAX_LABEL_LEN]; /* process name of this service */

View File

@@ -18,16 +18,6 @@ Created: Feb 15, 1994 by Philip Homburg <philip@cs.vu.nl>
#define MMGETPARAM _IOW('M', 5, struct sysgetenv)
#define MMSETPARAM _IOR('M', 7, struct sysgetenv)
/* FS controls. */
#define FSSIGNON _IOW('F', 2, struct fssignon)
/* A proper system call must be created later. */
#include <minix/dmap.h>
struct fssignon {
dev_t dev; /* Device to manage. */
enum dev_style style; /* Management style. */
};
struct sysgetenv {
char *key; /* Name requested. */
size_t keylen; /* Length of name including \0. */

View File

@@ -191,7 +191,7 @@ _PROTOTYPE( int getnprocnr, (pid_t pid) );
_PROTOTYPE( int getpprocnr, (void) );
_PROTOTYPE( int _pm_findproc, (char *proc_name, int *proc_nr) );
_PROTOTYPE( int mapdriver, (char *label, int major, int style,
int force) );
int flags) );
_PROTOTYPE(int adddma, (endpoint_t proc_e,
phys_bytes start, phys_bytes size) );
_PROTOTYPE(int deldma, (endpoint_t proc_e,