xref: /netbsd-src/sys/dev/raidframe/rf_netbsd.h (revision 95d875fb90b1458e4f1de6950286ddcd6644bc61)
1 /*	$NetBSD: rf_netbsd.h,v 1.6 1999/05/13 21:46:17 ad 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; Jason R. Thorpe.
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 #ifndef _RF__RF_NETBSDSTUFF_H_
40 #define _RF__RF_NETBSDSTUFF_H_
41 
42 #ifdef _KERNEL
43 #include <sys/fcntl.h>
44 #include <sys/systm.h>
45 #include <sys/namei.h>
46 #include <sys/vnode.h>
47 #endif /* _KERNEL */
48 
49 /* The per-component label information that the user can set */
50 typedef struct RF_ComponentInfo_s {
51 	int row;              /* the row number of this component */
52 	int column;           /* the column number of this component */
53 	int serial_number;    /* a user-specified serial number for this
54 				 RAID set */
55 } RF_ComponentInfo_t;
56 
57 /* The per-component label information */
58 typedef struct RF_ComponentLabel_s {
59 	int version;          /* The version of this label. */
60 	int serial_number;    /* a user-specified serial number for this
61 				 RAID set */
62 	int mod_counter;      /* modification counter.  Changed (usually
63 				 by incrementing) every time the label
64 				 is changed */
65 	int row;              /* the row number of this component */
66 	int column;           /* the column number of this component */
67 	int num_rows;         /* number of rows in this RAID set */
68 	int num_columns;      /* number of columns in this RAID set */
69 	int clean;            /* 1 when clean, 0 when dirty */
70 	int status;           /* rf_ds_optimal, rf_ds_dist_spared, whatever. */
71 } RF_ComponentLabel_t;
72 
73 typedef struct RF_SingleComponent_s {
74 	int row;
75 	int column;
76 	char component_name[50]; /* name of the component */
77 } RF_SingleComponent_t;
78 
79 #ifdef _KERNEL
80 
81 /* XXX this is *not* the place for these... */
82 int rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr);
83 int rf_remove_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr);
84 
85 
86 struct raidcinfo {
87 	struct vnode *ci_vp;	/* component device's vnode */
88 	dev_t   ci_dev;		/* component device's dev_t */
89 	RF_ComponentLabel_t ci_label; /* components RAIDframe label */
90 #if 0
91 	size_t  ci_size;	/* size */
92 	char   *ci_path;	/* path to component */
93 	size_t  ci_pathlen;	/* length of component path */
94 #endif
95 };
96 
97 
98 #endif /* _KERNEL */
99 #endif /* _RF__RF_NETBSDSTUFF_H_ */
100