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