rf_netbsd.h revision 1.35.6.1 1 /* $NetBSD: rf_netbsd.h,v 1.35.6.1 2021/08/01 22:42:31 thorpej 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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _RF__RF_NETBSDSTUFF_H_
33 #define _RF__RF_NETBSDSTUFF_H_
34
35 #include <sys/fcntl.h>
36 #include <sys/systm.h>
37 #include <sys/vnode.h>
38 #include <sys/pool.h>
39 #include <sys/disk.h>
40
41 #include <dev/dkvar.h>
42 #include <dev/raidframe/raidframevar.h>
43
44 struct raidcinfo {
45 struct vnode *ci_vp; /* component device's vnode */
46 dev_t ci_dev; /* component device's dev_t */
47 RF_ComponentLabel_t ci_label; /* components RAIDframe label */
48 #if 0
49 size_t ci_size; /* size */
50 char *ci_path; /* path to component */
51 size_t ci_pathlen; /* length of component path */
52 #endif
53 };
54
55
56 /* a little structure to serve as a container for all the various
57 per-device pools used in RAIDframe */
58
59 struct RF_Pools_s {
60 struct pool asm_hdr; /* Access Stripe Map Header */
61 struct pool asmap; /* Access Stripe Map */
62 struct pool asmhle; /* Access Stripe Map Header List Elements */
63 struct pool bufio; /* Buffer IO Pool */
64 struct pool callbackf; /* Callback function descriptors */
65 struct pool callbackv; /* Callback value descriptors */
66 struct pool dagh; /* DAG headers */
67 struct pool dagnode; /* DAG nodes */
68 struct pool daglist; /* DAG lists */
69 struct pool dagpcache; /* DAG pointer/param cache */
70 struct pool dqd; /* Disk Queue Data */
71 struct pool fss; /* Failed Stripe Structures */
72 struct pool funclist; /* Function Lists */
73 struct pool mcpair; /* Mutex/Cond Pairs */
74 struct pool pda; /* Physical Disk Access structures */
75 struct pool pss; /* Parity Stripe Status */
76 struct pool rad; /* Raid Access Descriptors */
77 struct pool reconbuffer; /* reconstruction buffer (header) pool */
78 struct pool revent; /* reconstruct events */
79 struct pool stripelock; /* StripeLock */
80 struct pool vfple; /* VoidFunctionPtr List Elements */
81 struct pool vple; /* VoidPointer List Elements */
82 };
83
84 #define RF_MAX_POOLNAMELEN 30
85 struct RF_PoolNames_s {
86 char asm_hdr[RF_MAX_POOLNAMELEN]; /* Access Stripe Map Header */
87 char asmap[RF_MAX_POOLNAMELEN]; /* Access Stripe Map */
88 char asmhle[RF_MAX_POOLNAMELEN]; /* Access Stripe Map Header List Elements */
89 char bufio[RF_MAX_POOLNAMELEN]; /* Buffer IO Pool */
90 char callbackf[RF_MAX_POOLNAMELEN]; /* Callback function descriptors */
91 char callbackv[RF_MAX_POOLNAMELEN]; /* Callback value descriptors */
92 char dagh[RF_MAX_POOLNAMELEN]; /* DAG headers */
93 char dagnode[RF_MAX_POOLNAMELEN]; /* DAG nodes */
94 char daglist[RF_MAX_POOLNAMELEN]; /* DAG lists */
95 char dagpcache[RF_MAX_POOLNAMELEN]; /* DAG pointer/param cache */
96 char dqd[RF_MAX_POOLNAMELEN]; /* Disk Queue Data */
97 char fss[RF_MAX_POOLNAMELEN]; /* Failed Stripe Structures */
98 char funclist[RF_MAX_POOLNAMELEN]; /* Function Lists */
99 char mcpair[RF_MAX_POOLNAMELEN]; /* Mutex/Cond Pairs */
100 char pda[RF_MAX_POOLNAMELEN]; /* Physical Disk Access structures */
101 char pss[RF_MAX_POOLNAMELEN]; /* Parity Stripe Status */
102 char rad[RF_MAX_POOLNAMELEN]; /* Raid Access Descriptors */
103 char reconbuffer[RF_MAX_POOLNAMELEN]; /* reconstruction buffer (header) pool */
104 char revent[RF_MAX_POOLNAMELEN]; /* reconstruct events */
105 char stripelock[RF_MAX_POOLNAMELEN]; /* StripeLock */
106 char vfple[RF_MAX_POOLNAMELEN]; /* VoidFunctionPtr List Elements */
107 char vple[RF_MAX_POOLNAMELEN]; /* VoidPointer List Elements */
108 };
109
110 extern struct pool rf_alloclist_pool; /* AllocList */
111 void rf_pool_init(RF_Raid_t *, char *, struct pool *, size_t, const char *, size_t, size_t);
112 int rf_buf_queue_check(RF_Raid_t *);
113
114 /* XXX probably belongs in a different .h file. */
115 typedef struct RF_AutoConfig_s {
116 char devname[56]; /* the name of this component */
117 int flag; /* a general-purpose flag */
118 dev_t dev; /* the device for this component */
119 struct vnode *vp; /* Mr. Vnode Pointer */
120 RF_ComponentLabel_t *clabel; /* the label */
121 struct RF_AutoConfig_s *next; /* the next autoconfig structure
122 in this set. */
123 } RF_AutoConfig_t;
124
125 typedef struct RF_ConfigSet_s {
126 struct RF_AutoConfig_s *ac; /* all of the autoconfig structures for
127 this config set. */
128 int rootable; /* Set to 1 if this set can be root */
129 struct RF_ConfigSet_s *next;
130 } RF_ConfigSet_t;
131
132 extern const int rf_b_pass;
133
134 #endif /* _RF__RF_NETBSDSTUFF_H_ */
135