1 /* $NetBSD: rf_disks.h,v 1.8 2000/03/27 03:25:17 oster Exp $ */ 2 /* 3 * Copyright (c) 1995 Carnegie-Mellon University. 4 * All rights reserved. 5 * 6 * Author: Mark Holland 7 * 8 * Permission to use, copy, modify and distribute this software and 9 * its documentation is hereby granted, provided that both the copyright 10 * notice and this permission notice appear in all copies of the 11 * software, derivative works or modified versions, and any portions 12 * thereof, and that both notices appear in supporting documentation. 13 * 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 16 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 * 18 * Carnegie Mellon requests users of this software to return to 19 * 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * School of Computer Science 22 * Carnegie Mellon University 23 * Pittsburgh PA 15213-3890 24 * 25 * any improvements or extensions that they make and grant Carnegie the 26 * rights to redistribute these changes. 27 */ 28 29 /* 30 * rf_disks.h -- header file for code related to physical disks 31 */ 32 33 #ifndef _RF__RF_DISKS_H_ 34 #define _RF__RF_DISKS_H_ 35 36 #include <sys/types.h> 37 38 #include "rf_archs.h" 39 #include "rf_types.h" 40 #include "rf_netbsd.h" 41 42 /* 43 * A physical disk can be in one of several states: 44 * IF YOU ADD A STATE, CHECK TO SEE IF YOU NEED TO MODIFY RF_DEAD_DISK() BELOW. 45 */ 46 enum RF_DiskStatus_e { 47 rf_ds_optimal, /* no problems */ 48 rf_ds_failed, /* reconstruction ongoing */ 49 rf_ds_reconstructing, /* reconstruction complete to spare, dead disk 50 * not yet replaced */ 51 rf_ds_dist_spared, /* reconstruction complete to distributed 52 * spare space, dead disk not yet replaced */ 53 rf_ds_spared, /* reconstruction complete to distributed 54 * spare space, dead disk not yet replaced */ 55 rf_ds_spare, /* an available spare disk */ 56 rf_ds_used_spare /* a spare which has been used, and hence is 57 * not available */ 58 }; 59 typedef enum RF_DiskStatus_e RF_DiskStatus_t; 60 61 struct RF_RaidDisk_s { 62 char devname[56]; /* name of device file */ 63 RF_DiskStatus_t status; /* whether it is up or down */ 64 RF_RowCol_t spareRow; /* if in status "spared", this identifies the 65 * spare disk */ 66 RF_RowCol_t spareCol; /* if in status "spared", this identifies the 67 * spare disk */ 68 RF_SectorCount_t numBlocks; /* number of blocks, obtained via READ 69 * CAPACITY */ 70 int blockSize; 71 RF_SectorCount_t partitionSize; /* The *actual* and *full* size of 72 the partition, from the disklabel */ 73 int auto_configured;/* 1 if this component was autoconfigured. 74 0 otherwise. */ 75 dev_t dev; 76 }; 77 /* 78 * An RF_DiskOp_t ptr is really a pointer to a UAGT_CCB, but I want 79 * to isolate the cam layer from all other layers, so I typecast to/from 80 * RF_DiskOp_t * (i.e. void *) at the interfaces. 81 */ 82 typedef void RF_DiskOp_t; 83 84 /* if a disk is in any of these states, it is inaccessible */ 85 #define RF_DEAD_DISK(_dstat_) (((_dstat_) == rf_ds_spared) || \ 86 ((_dstat_) == rf_ds_reconstructing) || ((_dstat_) == rf_ds_failed) || \ 87 ((_dstat_) == rf_ds_dist_spared)) 88 89 #ifdef _KERNEL 90 #include "rf_netbsd.h" 91 92 int rf_ConfigureDisks(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, 93 RF_Config_t * cfgPtr); 94 int rf_ConfigureSpareDisks(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, 95 RF_Config_t * cfgPtr); 96 int rf_ConfigureDisk(RF_Raid_t * raidPtr, char *buf, RF_RaidDisk_t * diskPtr, 97 RF_RowCol_t row, RF_RowCol_t col); 98 int rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, 99 RF_AutoConfig_t *auto_config); 100 int rf_CheckLabels( RF_Raid_t *, RF_Config_t *); 101 int rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr); 102 int rf_remove_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr); 103 int rf_delete_component(RF_Raid_t *raidPtr, RF_SingleComponent_t *component); 104 int rf_incorporate_hot_spare(RF_Raid_t *raidPtr, 105 RF_SingleComponent_t *component); 106 #endif /* _KERNEL */ 107 #endif /* !_RF__RF_DISKS_H_ */ 108