FreeBSD/Linux Kernel Cross Reference
sys/dev/md.h
1 /* $NetBSD: md.h,v 1.9 2008/05/02 13:02:31 ad Exp $ */
2
3 /*
4 * Copyright (c) 1995 Gordon W. Ross
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 * 4. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Gordon W. Ross
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 /*
34 * Memory-disk ioctl functions:
35 */
36
37 #include <sys/ioccom.h>
38
39 struct md_conf {
40 void *md_addr;
41 size_t md_size;
42 int md_type;
43 };
44
45 #define MD_GETCONF _IOR('r', 0, struct md_conf) /* get unit config */
46 #define MD_SETCONF _IOW('r', 1, struct md_conf) /* set unit config */
47
48 /*
49 * There are three configurations supported for each unit,
50 * reflected in the value of the md_type field:
51 */
52 #define MD_UNCONFIGURED 0
53 /*
54 * Not yet configured. Open returns ENXIO.
55 */
56 #define MD_KMEM_FIXED 1
57 /*
58 * Disk image resident in kernel (patched in or loaded).
59 * Requires that the function: md_set_kmem() is called to
60 * attach the (initialized) kernel memory to be used by the
61 * device. It can be initialized by an "open hook" if this
62 * driver is compiled with the MD_OPEN_HOOK option.
63 * No attempt will ever be made to free this memory.
64 */
65 #define MD_KMEM_ALLOCATED 2
66 /*
67 * Small, wired-down chunk of kernel memory obtained from
68 * kmem_alloc(). The allocation is performed by an ioctl
69 * call on the raw partition.
70 */
71 #define MD_UMEM_SERVER 3
72 /*
73 * Indirect access to user-space of a user-level server.
74 * (Like the MFS hack, but better! 8^) Device operates
75 * only while the server has the raw partition open and
76 * continues to service I/O requests. The process that
77 * does this setconf will become the I/O server. This
78 * configuration type can be disabled using:
79 * options MEMORY_DISK_SERVER=0
80 */
81
82 #ifdef _KERNEL
83 /*
84 * If the option MEMORY_DISK_HOOKS is on, then these functions are
85 * called by the ramdisk driver to allow machine-dependent to
86 * match/configure and/or load each ramdisk unit.
87 */
88 extern void md_attach_hook(int, struct md_conf *);
89 extern void md_open_hook(int, struct md_conf *);
90 extern void md_root_setconf(char *, size_t);
91
92 extern int md_is_root;
93 #endif /* _KERNEL */
Cache object: 0d167a99b228a2fe119a1c7a6466e4e4
|