1 /* $OpenBSD: rf_raidframe.h,v 1.6 2002/12/16 07:01:05 tdeval Exp $ */ 2 /* $NetBSD: rf_raidframe.h,v 1.11 2000/05/28 00:48:31 oster Exp $ */ 3 4 /* 5 * Copyright (c) 1995 Carnegie-Mellon University. 6 * All rights reserved. 7 * 8 * Author: Mark Holland 9 * 10 * Permission to use, copy, modify and distribute this software and 11 * its documentation is hereby granted, provided that both the copyright 12 * notice and this permission notice appear in all copies of the 13 * software, derivative works or modified versions, and any portions 14 * thereof, and that both notices appear in supporting documentation. 15 * 16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 19 * 20 * Carnegie Mellon requests users of this software to return to 21 * 22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 23 * School of Computer Science 24 * Carnegie Mellon University 25 * Pittsburgh PA 15213-3890 26 * 27 * any improvements or extensions that they make and grant Carnegie the 28 * rights to redistribute these changes. 29 */ 30 31 /***************************************************** 32 * 33 * rf_raidframe.h 34 * 35 * Main header file for using RAIDframe in the kernel. 36 * 37 *****************************************************/ 38 39 40 #ifndef _RF__RF_RAIDFRAME_H_ 41 #define _RF__RF_RAIDFRAME_H_ 42 43 #include "rf_types.h" 44 #include "rf_configure.h" 45 #include "rf_disks.h" 46 #include "rf_raid.h" 47 48 typedef RF_uint32 RF_ReconReqFlags_t; 49 50 struct rf_recon_req { /* Used to tell the kernel to fail a disk. */ 51 RF_RowCol_t row, col; 52 RF_ReconReqFlags_t flags; 53 void *raidPtr; /* 54 * Used internally; need not be 55 * set at ioctl time. 56 */ 57 struct rf_recon_req *next; /* 58 * Used internally; need not be 59 * set at ioctl time. 60 */ 61 }; 62 63 struct RF_SparetWait_s { 64 int C, G, fcol; /* 65 * C = # disks in row, 66 * G = # units in stripe, 67 * fcol = which disk has failed 68 */ 69 70 RF_StripeCount_t SUsPerPU; /* 71 * This stuff is the info 72 * required to create a spare 73 * table. 74 */ 75 int TablesPerSpareRegion; 76 int BlocksPerTable; 77 RF_StripeCount_t TableDepthInPUs; 78 RF_StripeCount_t SpareSpaceDepthPerRegionInSUs; 79 80 RF_SparetWait_t *next; /* 81 * Used internally; need not be 82 * set at ioctl time. 83 */ 84 }; 85 86 typedef struct RF_DeviceConfig_s { 87 u_int rows; 88 u_int cols; 89 u_int maxqdepth; 90 int ndevs; 91 RF_RaidDisk_t devs[RF_MAX_DISKS]; 92 int nspares; 93 RF_RaidDisk_t spares[RF_MAX_DISKS]; 94 } RF_DeviceConfig_t; 95 96 97 typedef struct RF_ProgressInfo_s { 98 RF_uint64 remaining; 99 RF_uint64 completed; 100 RF_uint64 total; 101 } RF_ProgressInfo_t; 102 103 /* Flags that can be put in the rf_recon_req structure. */ 104 #define RF_FDFLAGS_NONE 0x0 /* Just fail the disk. */ 105 #define RF_FDFLAGS_RECON 0x1 /* Fail and initiate recon. */ 106 107 #define RF_SCSI_DISK_MAJOR 8 /* 108 * The device major number for disks 109 * in the system. 110 */ 111 112 /* Configure the driver. */ 113 #define RAIDFRAME_CONFIGURE _IOW ('r', 1, void *) 114 /* Shutdown the driver. */ 115 #define RAIDFRAME_SHUTDOWN _IO ('r', 2) 116 /* Debug only: test unit ready. */ 117 #define RAIDFRAME_TUR _IOW ('r', 3, dev_t) 118 /* Run a test access. */ 119 #define RAIDFRAME_TEST_ACC _IOWR('r', 4, struct rf_test_acc) 120 /* Fail a disk & optionally start recon. */ 121 #define RAIDFRAME_FAIL_DISK _IOW ('r', 5, struct rf_recon_req) 122 /* Get reconstruction % complete on indicated row. */ 123 #define RAIDFRAME_CHECK_RECON_STATUS _IOWR('r', 6, int) 124 /* Rewrite (initialize) all parity. */ 125 #define RAIDFRAME_REWRITEPARITY _IO ('r', 7) 126 /* Copy reconstructed data back to replaced disk. */ 127 #define RAIDFRAME_COPYBACK _IO ('r', 8) 128 /* Does not return until kernel needs a spare table. */ 129 #define RAIDFRAME_SPARET_WAIT _IOR ('r', 9, RF_SparetWait_t) 130 /* Used to send a spare table down into the kernel. */ 131 #define RAIDFRAME_SEND_SPARET _IOW ('r', 10, void *) 132 /* Used to wake up the sparemap daemon & tell it to exit. */ 133 #define RAIDFRAME_ABORT_SPARET_WAIT _IO ('r', 11) 134 /* Start tracing accesses. */ 135 #define RAIDFRAME_START_ATRAC _IO ('r', 12) 136 /* Stop tracing accesses. */ 137 #define RAIDFRAME_STOP_ATRACE _IO ('r', 13) 138 /* Get size (# sectors) in raid device. */ 139 #define RAIDFRAME_GET_SIZE _IOR ('r', 14, int) 140 /* Get configuration. */ 141 #define RAIDFRAME_GET_INFO _IOWR('r', 15, RF_DeviceConfig_t *) 142 /* Reset AccTotals for device. */ 143 #define RAIDFRAME_RESET_ACCTOTALS _IO ('r', 16) 144 /* Retrieve AccTotals for device. */ 145 #define RAIDFRAME_GET_ACCTOTALS _IOR ('r', 17, RF_AccTotals_t) 146 /* Turn AccTotals on or off for device. */ 147 #define RAIDFRAME_KEEP_ACCTOTALS _IOW ('r', 18, int) 148 149 #define RAIDFRAME_GET_COMPONENT_LABEL _IOWR ('r', 19, RF_ComponentLabel_t *) 150 #define RAIDFRAME_SET_COMPONENT_LABEL _IOW ('r', 20, RF_ComponentLabel_t) 151 152 #define RAIDFRAME_INIT_LABELS _IOW ('r', 21, RF_ComponentLabel_t) 153 #define RAIDFRAME_ADD_HOT_SPARE _IOW ('r', 22, RF_SingleComponent_t) 154 #define RAIDFRAME_REMOVE_HOT_SPARE _IOW ('r', 23, RF_SingleComponent_t) 155 #define RAIDFRAME_REBUILD_IN_PLACE _IOW ('r', 24, RF_SingleComponent_t) 156 #define RAIDFRAME_CHECK_PARITY _IOWR ('r', 25, int) 157 #define RAIDFRAME_CHECK_PARITYREWRITE_STATUS _IOWR ('r', 26, int) 158 #define RAIDFRAME_CHECK_COPYBACK_STATUS _IOWR ('r', 27, int) 159 #define RAIDFRAME_SET_AUTOCONFIG _IOWR ('r', 28, int) 160 #define RAIDFRAME_SET_ROOT _IOWR ('r', 29, int) 161 #define RAIDFRAME_DELETE_COMPONENT _IOW ('r', 30, RF_SingleComponent_t) 162 #define RAIDFRAME_INCORPORATE_HOT_SPARE _IOW ('r', 31, RF_SingleComponent_t) 163 164 /* 'Extended' status versions. */ 165 #define RAIDFRAME_CHECK_RECON_STATUS_EXT \ 166 _IOWR('r', 32, RF_ProgressInfo_t *) 167 #define RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT \ 168 _IOWR ('r', 33, RF_ProgressInfo_t *) 169 #define RAIDFRAME_CHECK_COPYBACK_STATUS_EXT \ 170 _IOWR ('r', 34, RF_ProgressInfo_t *) 171 172 #endif /* !_RF__RF_RAIDFRAME_H_ */ 173