md.h revision 1.1 1
2 /*
3 * RAM-disk ioctl functions:
4 */
5
6 #include <sys/ioccom.h>
7
8 struct rd_conf {
9 caddr_t rd_addr;
10 size_t rd_size;
11 int rd_type;
12 };
13
14 #define RD_GETCONF _IOR('r', 0, struct rd_conf) /* get unit config */
15 #define RD_SETCONF _IOW('r', 1, struct rd_conf) /* set unit config */
16
17 /*
18 * There are three configurations supported for each unit,
19 * reflected in the value of the rd_type field:
20 */
21 #define RD_UNCONFIGURED 0
22 /*
23 * Not yet configured. Open returns ENXIO.
24 */
25 #define RD_KMEM_FIXED 1
26 /*
27 * Disk image resident in kernel (patched in or loaded).
28 * Requires that the function: rd_set_kmem() is called to
29 * attach the (initialized) kernel memory to be used by the
30 * device. This can be called by an "open hook" if this
31 * driver is compiled with the RD_OPEN_HOOK option.
32 * No attempt will be made to free this memory.
33 */
34 #define RD_KMEM_ALLOCATED 2
35 /*
36 * Small, wired-down chunk of kernel memory obtained from
37 * kmem_alloc(). The allocation is performed by an ioctl
38 * call on the "control" unit (regular unit + 16)
39 */
40 #define RD_UMEM_SERVER 3
41 /*
42 * Indirect access to user-space of a user-level server.
43 * (Like the MFS hack, but better! 8^) Device operates
44 * only while the server has the control device open and
45 * continues to service I/O requests. The process that
46 * does this setconf will become the I/O server.
47 * Support for this configuration type is optional:
48 * option RAMDISK_SERVER
49 */
50
51 #ifdef _KERNEL
52 /*
53 * If the option RAMDISK_HOOKS is on, then these functions are
54 * called by the ramdisk driver to allow machine-dependent to
55 * configure and/or load each ramdisk unit.
56 */
57 extern void rd_attach_hook __P((int unit, struct rd_conf *));
58 extern void rd_open_hook __P((int unit, struct rd_conf *));
59 #endif
60