]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/vinum/vinumio.h
This commit was generated by cvs2svn to compensate for changes in r104990,
[FreeBSD/FreeBSD.git] / sys / dev / vinum / vinumio.h
1 /*-
2  * Copyright (c) 1997, 1998
3  *      Nan Yang Computer Services Limited.  All rights reserved.
4  *
5  *  This software is distributed under the so-called ``Berkeley
6  *  License'':
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed by Nan Yang Computer
19  *      Services Limited.
20  * 4. Neither the name of the Company nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * This software is provided ``as is'', and any express or implied
25  * warranties, including, but not limited to, the implied warranties of
26  * merchantability and fitness for a particular purpose are disclaimed.
27  * In no event shall the company or contributors be liable for any
28  * direct, indirect, incidental, special, exemplary, or consequential
29  * damages (including, but not limited to, procurement of substitute
30  * goods or services; loss of use, data, or profits; or business
31  * interruption) however caused and on any theory of liability, whether
32  * in contract, strict liability, or tort (including negligence or
33  * otherwise) arising in any way out of the use of this software, even if
34  * advised of the possibility of such damage.
35  *
36  * $Id: vinumio.h,v 1.21 2001/05/22 07:29:23 grog Exp grog $
37  * $FreeBSD$
38  */
39
40 #define L 'F'                                               /* ID letter of our ioctls */
41
42 #define MAX_IOCTL_REPLY 1024
43
44 #ifdef VINUMDEBUG
45 struct debuginfo {
46     int changeit;
47     int param;
48 };
49
50 #endif
51
52 enum objecttype {
53     drive_object,
54     sd_object,
55     plex_object,
56     volume_object,
57     invalid_object
58 };
59
60 /*
61  * The state to set with VINUM_SETSTATE.  Since each object has a
62  * different set of states, we need to translate later.
63  */
64 enum objectstate {
65     object_down,
66     object_initializing,
67     object_initialized,
68     object_up
69 };
70
71 /*
72  * This structure is used for modifying objects
73  * (VINUM_SETSTATE, VINUM_REMOVE, VINUM_RESETSTATS, VINUM_ATTACH,
74  * VINUM_DETACH, VINUM_REPLACE
75  */
76 struct vinum_ioctl_msg {
77     int index;
78     enum objecttype type;
79     enum objectstate state;                                 /* state to set (VINUM_SETSTATE) */
80     enum parityop op;                                       /* for parity ops */
81     int force;                                              /* do it even if it doesn't make sense */
82     int recurse;                                            /* recurse (VINUM_REMOVE) */
83     int verify;                                             /* verify (initsd, rebuildparity) */
84     int otherobject;                                        /* superordinate object (attach),
85                                                             * replacement object (replace) */
86     int rename;                                             /* rename object (attach) */
87     int64_t offset;                                         /* offset of subdisk (for attach) */
88     int blocksize;                                          /* size of block to revive (bytes) */
89 };
90
91 /* VINUM_CREATE returns a buffer of this kind */
92 struct _ioctl_reply {
93     int error;
94     char msg[MAX_IOCTL_REPLY];
95 };
96
97 struct vinum_rename_msg {
98     int index;
99     int recurse;                                            /* rename subordinate objects too */
100     enum objecttype type;
101     char newname[MAXNAME];                                  /* new name to give to object */
102 };
103
104 /* ioctl requests */
105 #define BUFSIZE 1024                                        /* size of buffer, including continuations */
106 #define VINUM_CREATE            _IOC(IOC_IN | IOC_OUT, L, 64, BUFSIZE) /* configure vinum */
107 #define VINUM_GETCONFIG         _IOR(L, 65, struct __vinum_conf) /* get global config */
108 #define VINUM_DRIVECONFIG       _IOWR(L, 66, struct _drive) /* get drive config */
109 #define VINUM_SDCONFIG          _IOWR(L, 67, struct _sd)    /* get subdisk config */
110 #define VINUM_PLEXCONFIG        _IOWR(L, 68, struct _plex)  /* get plex config */
111 #define VINUM_VOLCONFIG         _IOWR(L, 69, struct _volume) /* get volume config */
112 #define VINUM_PLEXSDCONFIG      _IOWR(L, 70, struct _sd)    /* get sd config for plex (plex, sdno) */
113 #define VINUM_GETFREELIST       _IOWR(L, 71, struct drive_freelist) /* get freelist element (drive, fe) */
114 #define VINUM_SAVECONFIG        _IOW(L, 72, int)            /* write config to disk */
115 #define VINUM_RESETCONFIG       _IOC(0, L, 73, 0)           /* trash config on disk */
116 #define VINUM_INIT              _IOC(0, L, 74, 0)           /* read config from disk */
117 #ifdef VINUMDEBUG
118 #define VINUM_DEBUG             _IOWR(L, 75, struct debuginfo) /* call the debugger from ioctl () */
119 #endif
120
121 /*
122  * Start an object.  Pass two integers:
123  * msg [0] index in vinum_conf.<object>
124  * msg [1] type of object (see below)
125  *
126  * Return ioctl_reply
127  */
128 #define VINUM_SETSTATE          _IOC(IOC_IN | IOC_OUT, L, 76, MAX_IOCTL_REPLY) /* start an object */
129 #define VINUM_RELEASECONFIG     _IOC(0, L, 77, 0)           /* release locks and write config to disk */
130 #define VINUM_STARTCONFIG       _IOW(L, 78, int)            /* start a configuration operation */
131 #define VINUM_MEMINFO           _IOR(L, 79, struct meminfo) /* get memory usage summary */
132 #define VINUM_MALLOCINFO        _IOWR(L, 80, struct mc)     /* get specific malloc information [i] */
133 #define VINUM_LABEL             _IOC(IOC_IN | IOC_OUT, L, 81, MAX_IOCTL_REPLY) /* label a volume */
134 #define VINUM_INITSD            _IOW(L, 82, int)            /* initialize a subdisk */
135 #define VINUM_REMOVE            _IOWR(L, 83, struct _ioctl_reply) /* remove an object */
136 #define VINUM_READPOL           _IOWR(L, 84, struct _ioctl_reply) /* set read policy */
137 #define VINUM_SETSTATE_FORCE    _IOC(IOC_IN | IOC_OUT, L, 85, MAX_IOCTL_REPLY) /* diddle object state */
138 #define VINUM_RESETSTATS        _IOWR(L, 86, struct _ioctl_reply) /* reset object stats */
139 #define VINUM_ATTACH            _IOWR(L, 87, struct _ioctl_reply) /* attach an object */
140 #define VINUM_DETACH            _IOWR(L, 88, struct _ioctl_reply) /* remove an object */
141
142 #define VINUM_RENAME            _IOWR(L, 89, struct _ioctl_reply) /* rename an object */
143 #define VINUM_REPLACE           _IOWR(L, 90, struct _ioctl_reply) /* replace an object */
144
145 #ifdef VINUMDEBUG
146 #define VINUM_RQINFO            _IOWR(L, 91, struct rqinfo) /* get request info [i] from trace buffer */
147 #endif
148
149 #define VINUM_DAEMON            _IOC(0, L, 92, 0)           /* perform the kernel part of Vinum daemon */
150 #define VINUM_FINDDAEMON        _IOC(0, L, 93, 0)           /* check for presence of Vinum daemon */
151 #define VINUM_SETDAEMON         _IOW(L, 94, int)            /* set daemon flags */
152 #define VINUM_GETDAEMON         _IOR(L, 95, int)            /* get daemon flags */
153 #define VINUM_PARITYOP          _IOWR(L, 96, struct _ioctl_reply) /* check/rebuild RAID-4/5 parity */
154 #define VINUM_MOVE              _IOWR(L, 98, struct _ioctl_reply) /* move an object */