rf_netbsd.h revision 1.6.2.1 1 1.6.2.1 bouyer /* $NetBSD: rf_netbsd.h,v 1.6.2.1 2000/11/20 11:42:55 bouyer Exp $ */
2 1.1 oster
3 1.1 oster /*-
4 1.1 oster * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
5 1.1 oster * All rights reserved.
6 1.1 oster *
7 1.1 oster * This code is derived from software contributed to The NetBSD Foundation
8 1.6 ad * by Greg Oster; Jason R. Thorpe.
9 1.1 oster *
10 1.1 oster * Redistribution and use in source and binary forms, with or without
11 1.1 oster * modification, are permitted provided that the following conditions
12 1.1 oster * are met:
13 1.1 oster * 1. Redistributions of source code must retain the above copyright
14 1.1 oster * notice, this list of conditions and the following disclaimer.
15 1.1 oster * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 oster * notice, this list of conditions and the following disclaimer in the
17 1.1 oster * documentation and/or other materials provided with the distribution.
18 1.1 oster * 3. All advertising materials mentioning features or use of this software
19 1.1 oster * must display the following acknowledgement:
20 1.1 oster * This product includes software developed by the NetBSD
21 1.1 oster * Foundation, Inc. and its contributors.
22 1.1 oster * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 oster * contributors may be used to endorse or promote products derived
24 1.1 oster * from this software without specific prior written permission.
25 1.1 oster *
26 1.1 oster * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 oster * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 oster * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 oster * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 oster * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 oster * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 oster * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 oster * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 oster * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 oster * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 oster * POSSIBILITY OF SUCH DAMAGE.
37 1.1 oster */
38 1.1 oster
39 1.1 oster #ifndef _RF__RF_NETBSDSTUFF_H_
40 1.1 oster #define _RF__RF_NETBSDSTUFF_H_
41 1.1 oster
42 1.2 oster #ifdef _KERNEL
43 1.1 oster #include <sys/fcntl.h>
44 1.1 oster #include <sys/systm.h>
45 1.1 oster #include <sys/namei.h>
46 1.1 oster #include <sys/vnode.h>
47 1.4 oster #endif /* _KERNEL */
48 1.1 oster
49 1.4 oster /* The per-component label information that the user can set */
50 1.4 oster typedef struct RF_ComponentInfo_s {
51 1.4 oster int row; /* the row number of this component */
52 1.4 oster int column; /* the column number of this component */
53 1.4 oster int serial_number; /* a user-specified serial number for this
54 1.4 oster RAID set */
55 1.4 oster } RF_ComponentInfo_t;
56 1.4 oster
57 1.4 oster /* The per-component label information */
58 1.4 oster typedef struct RF_ComponentLabel_s {
59 1.4 oster int version; /* The version of this label. */
60 1.4 oster int serial_number; /* a user-specified serial number for this
61 1.4 oster RAID set */
62 1.4 oster int mod_counter; /* modification counter. Changed (usually
63 1.4 oster by incrementing) every time the label
64 1.4 oster is changed */
65 1.4 oster int row; /* the row number of this component */
66 1.4 oster int column; /* the column number of this component */
67 1.4 oster int num_rows; /* number of rows in this RAID set */
68 1.4 oster int num_columns; /* number of columns in this RAID set */
69 1.4 oster int clean; /* 1 when clean, 0 when dirty */
70 1.4 oster int status; /* rf_ds_optimal, rf_ds_dist_spared, whatever. */
71 1.6.2.1 bouyer /* stuff that will be in version 2 of the label */
72 1.6.2.1 bouyer int sectPerSU; /* Sectors per Stripe Unit */
73 1.6.2.1 bouyer int SUsPerPU; /* Stripe Units per Parity Units */
74 1.6.2.1 bouyer int SUsPerRU; /* Stripe Units per Reconstruction Units */
75 1.6.2.1 bouyer int parityConfig; /* '0' == RAID0, '1' == RAID1, etc. */
76 1.6.2.1 bouyer int maxOutstanding; /* maxOutstanding disk requests */
77 1.6.2.1 bouyer int blockSize; /* size of component block.
78 1.6.2.1 bouyer (disklabel->d_secsize) */
79 1.6.2.1 bouyer int numBlocks; /* number of blocks on this component. May
80 1.6.2.1 bouyer be smaller than the partition size. */
81 1.6.2.1 bouyer int partitionSize; /* number of blocks on this *partition*.
82 1.6.2.1 bouyer Must exactly match the partition size
83 1.6.2.1 bouyer from the disklabel. */
84 1.6.2.1 bouyer int future_use[33]; /* Future expansion */
85 1.6.2.1 bouyer int autoconfigure; /* automatically configure this RAID set.
86 1.6.2.1 bouyer 0 == no, 1 == yes */
87 1.6.2.1 bouyer int root_partition; /* Use this set as /
88 1.6.2.1 bouyer 0 == no, 1 == yes*/
89 1.6.2.1 bouyer int last_unit; /* last unit number (e.g. 0 for /dev/raid0)
90 1.6.2.1 bouyer of this component. Used for autoconfigure
91 1.6.2.1 bouyer only. */
92 1.6.2.1 bouyer int config_order; /* 0 .. n. The order in which the component
93 1.6.2.1 bouyer should be auto-configured. E.g. 0 is will
94 1.6.2.1 bouyer done first, (and would become raid0).
95 1.6.2.1 bouyer This may be in conflict with last_unit!!?! */
96 1.6.2.1 bouyer /* Not currently used. */
97 1.6.2.1 bouyer int future_use2[44]; /* More future expansion */
98 1.4 oster } RF_ComponentLabel_t;
99 1.4 oster
100 1.5 oster typedef struct RF_SingleComponent_s {
101 1.5 oster int row;
102 1.5 oster int column;
103 1.5 oster char component_name[50]; /* name of the component */
104 1.5 oster } RF_SingleComponent_t;
105 1.4 oster
106 1.4 oster #ifdef _KERNEL
107 1.4 oster
108 1.1 oster struct raidcinfo {
109 1.4 oster struct vnode *ci_vp; /* component device's vnode */
110 1.4 oster dev_t ci_dev; /* component device's dev_t */
111 1.4 oster RF_ComponentLabel_t ci_label; /* components RAIDframe label */
112 1.1 oster #if 0
113 1.3 oster size_t ci_size; /* size */
114 1.3 oster char *ci_path; /* path to component */
115 1.3 oster size_t ci_pathlen; /* length of component path */
116 1.1 oster #endif
117 1.1 oster };
118 1.4 oster
119 1.6.2.1 bouyer
120 1.6.2.1 bouyer
121 1.6.2.1 bouyer /* XXX probably belongs in a different .h file. */
122 1.6.2.1 bouyer typedef struct RF_AutoConfig_s {
123 1.6.2.1 bouyer char devname[56]; /* the name of this component */
124 1.6.2.1 bouyer int flag; /* a general-purpose flag */
125 1.6.2.1 bouyer dev_t dev; /* the device for this component */
126 1.6.2.1 bouyer struct vnode *vp; /* Mr. Vnode Pointer */
127 1.6.2.1 bouyer RF_ComponentLabel_t *clabel; /* the label */
128 1.6.2.1 bouyer struct RF_AutoConfig_s *next; /* the next autoconfig structure
129 1.6.2.1 bouyer in this set. */
130 1.6.2.1 bouyer } RF_AutoConfig_t;
131 1.6.2.1 bouyer
132 1.6.2.1 bouyer typedef struct RF_ConfigSet_s {
133 1.6.2.1 bouyer struct RF_AutoConfig_s *ac; /* all of the autoconfig structures for
134 1.6.2.1 bouyer this config set. */
135 1.6.2.1 bouyer int rootable; /* Set to 1 if this set can be root */
136 1.6.2.1 bouyer struct RF_ConfigSet_s *next;
137 1.6.2.1 bouyer } RF_ConfigSet_t;
138 1.4 oster
139 1.4 oster #endif /* _KERNEL */
140 1.4 oster #endif /* _RF__RF_NETBSDSTUFF_H_ */
141