1 /* $NetBSD: rf_netbsd.h,v 1.29 2008/04/28 20:23:56 martin 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 callback; /* Callback descriptors */ 65 struct pool dagh; /* DAG headers */ 66 struct pool dagnode; /* DAG nodes */ 67 struct pool daglist; /* DAG lists */ 68 struct pool dagpcache; /* DAG pointer/param cache */ 69 struct pool dqd; /* Disk Queue Data */ 70 struct pool fss; /* Failed Stripe Structures */ 71 struct pool funclist; /* Function Lists */ 72 struct pool mcpair; /* Mutex/Cond Pairs */ 73 struct pool pda; /* Physical Disk Access structures */ 74 struct pool pss; /* Parity Stripe Status */ 75 struct pool pss_issued; /* Parity Stripe Status Issued */ 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 extern struct RF_Pools_s rf_pools; 85 void rf_pool_init(struct pool *, size_t, const char *, size_t, size_t); 86 int rf_buf_queue_check(int); 87 88 /* XXX probably belongs in a different .h file. */ 89 typedef struct RF_AutoConfig_s { 90 char devname[56]; /* the name of this component */ 91 int flag; /* a general-purpose flag */ 92 dev_t dev; /* the device for this component */ 93 struct vnode *vp; /* Mr. Vnode Pointer */ 94 RF_ComponentLabel_t *clabel; /* the label */ 95 struct RF_AutoConfig_s *next; /* the next autoconfig structure 96 in this set. */ 97 } RF_AutoConfig_t; 98 99 typedef struct RF_ConfigSet_s { 100 struct RF_AutoConfig_s *ac; /* all of the autoconfig structures for 101 this config set. */ 102 int rootable; /* Set to 1 if this set can be root */ 103 struct RF_ConfigSet_s *next; 104 } RF_ConfigSet_t; 105 106 #endif /* _RF__RF_NETBSDSTUFF_H_ */ 107