1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom.h 93776 2002-04-04 09:54:13Z phk $ |
36 */ 37 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/sx.h> 41#include <sys/queue.h> 42 43#ifndef _KERNEL --- 8 unchanged lines hidden (view full) --- 52struct g_geom; 53struct g_consumer; 54struct g_provider; 55struct g_event; 56struct thread; 57struct bio; 58struct sbuf; 59 |
60 61typedef struct g_geom * g_create_geom_t (struct g_class *mp, 62 struct g_provider *pp, char *name); 63typedef struct g_geom * g_taste_t (struct g_class *, struct g_provider *, 64 int flags); 65#define G_TF_NORMAL 0 66#define G_TF_INSIST 1 67#define G_TF_TRANSPARENT 2 --- 7 unchanged lines hidden (view full) --- 75 struct g_consumer *, struct g_provider *); 76 77/* 78 * The g_class structure describes a transformation class. In other words 79 * all BSD disklabel handlers share one g_class, all MBR handlers share 80 * one common g_class and so on. 81 * Certain operations are instantiated on the class, most notably the 82 * taste and create_geom functions. |
83 */ 84struct g_class { 85 char *name; 86 g_taste_t *taste; |
87 g_create_geom_t *create_geom; |
88 /* 89 * The remaning elements are private and classes should use 90 * the G_CLASS_INITSTUFF macro to initialize them. 91 */ |
92 LIST_ENTRY(g_class) class; 93 LIST_HEAD(,g_geom) geom; 94 struct g_event *event; 95}; 96 |
97#define G_CLASS_INITSTUFF { 0, 0 }, { 0 }, 0 98 |
99/* 100 * The g_geom is an instance of a g_class. 101 */ 102struct g_geom { 103 char *name; 104 struct g_class *class; 105 LIST_ENTRY(g_geom) geom; 106 LIST_HEAD(,g_consumer) consumer; 107 LIST_HEAD(,g_provider) provider; 108 TAILQ_ENTRY(g_geom) geoms; /* XXX: better name */ 109 int rank; 110 g_start_t *start; 111 g_spoiled_t *spoiled; 112 g_dumpconf_t *dumpconf; |
113 g_access_t *access; 114 g_orphan_t *orphan; |
115 void *softc; 116 struct g_event *event; 117 unsigned flags; 118#define G_GEOM_WITHER 1 119}; 120 121/* 122 * The g_bioq is a queue of struct bio's. --- 80 unchanged lines hidden (view full) --- 203int g_std_access(struct g_provider *pp, int dr, int dw, int de); 204void g_std_done(struct bio *bp); 205void g_std_spoiled(struct g_consumer *cp); 206 207/* geom_io.c */ 208struct bio * g_clone_bio(struct bio *); 209void g_destroy_bio(struct bio *); 210void g_io_deliver(struct bio *bp); |
211void g_io_fail(struct bio *bp, int error); |
212int g_io_getattr(char *attr, struct g_consumer *cp, int *len, void *ptr); 213void g_io_request(struct bio *bp, struct g_consumer *cp); 214int g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr); 215struct bio *g_new_bio(void); 216void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error); 217 218/* geom_kern.c / geom_kernsim.c */ 219 --- 47 unchanged lines hidden --- |