1 /* $NetBSD: rf_netbsd.h,v 1.35 2020/06/19 19:29:39 jdolecek 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 global pools used in RAIDframe */ 58 59 struct RF_Pools_s { 60 struct pool alloclist; /* AllocList */ 61 struct pool asm_hdr; /* Access Stripe Map Header */ 62 struct pool asmap; /* Access Stripe Map */ 63 struct pool asmhle; /* Access Stripe Map Header List Elements */ 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 pss_issued; /* Parity Stripe Status Issued */ 77 struct pool rad; /* Raid Access Descriptors */ 78 struct pool reconbuffer; /* reconstruction buffer (header) pool */ 79 struct pool revent; /* reconstruct events */ 80 struct pool stripelock; /* StripeLock */ 81 struct pool vfple; /* VoidFunctionPtr List Elements */ 82 struct pool vple; /* VoidPointer List Elements */ 83 }; 84 85 extern struct RF_Pools_s rf_pools; 86 void rf_pool_init(struct pool *, size_t, const char *, size_t, size_t); 87 int rf_buf_queue_check(RF_Raid_t *); 88 89 /* XXX probably belongs in a different .h file. */ 90 typedef struct RF_AutoConfig_s { 91 char devname[56]; /* the name of this component */ 92 int flag; /* a general-purpose flag */ 93 dev_t dev; /* the device for this component */ 94 struct vnode *vp; /* Mr. Vnode Pointer */ 95 RF_ComponentLabel_t *clabel; /* the label */ 96 struct RF_AutoConfig_s *next; /* the next autoconfig structure 97 in this set. */ 98 } RF_AutoConfig_t; 99 100 typedef struct RF_ConfigSet_s { 101 struct RF_AutoConfig_s *ac; /* all of the autoconfig structures for 102 this config set. */ 103 int rootable; /* Set to 1 if this set can be root */ 104 struct RF_ConfigSet_s *next; 105 } RF_ConfigSet_t; 106 107 extern const int rf_b_pass; 108 109 #endif /* _RF__RF_NETBSDSTUFF_H_ */ 110