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