geom_int.h revision 110523
1228177Skib/*-
2228177Skib * Copyright (c) 2002 Poul-Henning Kamp
3228177Skib * Copyright (c) 2002 Networks Associates Technology, Inc.
4228177Skib * All rights reserved.
5228177Skib *
6228177Skib * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7228177Skib * and NAI Labs, the Security Research Division of Network Associates, Inc.
8228177Skib * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
9228177Skib * DARPA CHATS research program.
10228177Skib *
11228177Skib * Redistribution and use in source and binary forms, with or without
12228177Skib * modification, are permitted provided that the following conditions
13228177Skib * are met:
14228177Skib * 1. Redistributions of source code must retain the above copyright
15228177Skib *    notice, this list of conditions and the following disclaimer.
16228177Skib * 2. Redistributions in binary form must reproduce the above copyright
17228177Skib *    notice, this list of conditions and the following disclaimer in the
18228177Skib *    documentation and/or other materials provided with the distribution.
19228177Skib * 3. The names of the authors may not be used to endorse or promote
20228177Skib *    products derived from this software without specific prior written
21228177Skib *    permission.
22228177Skib *
23228177Skib * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24228177Skib * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25228177Skib * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26228177Skib * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27228177Skib * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28228177Skib * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29228177Skib * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30228177Skib * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31228177Skib * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32228177Skib * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33228177Skib * SUCH DAMAGE.
34228177Skib *
35228177Skib * $FreeBSD: head/sys/geom/geom_int.h 110523 2003-02-07 23:08:24Z phk $
36228177Skib */
37228177Skib
38228177SkibLIST_HEAD(class_list_head, g_class);
39228177SkibTAILQ_HEAD(g_tailq_head, g_geom);
40228177SkibTAILQ_HEAD(event_tailq_head, g_event);
41228177Skib
42228177Skibextern struct event_tailq_head events;
43228177Skibextern int g_collectstats;
44228177Skibextern int g_debugflags;
45228177Skib/* 1	G_T_TOPOLOGY		*/
46228177Skib/* 2	G_T_BIO			*/
47228177Skib/* 4	G_T_ACCESS		*/
48228177Skib/* 8	enable sanity checks	*/
49228177Skib
50228177Skib/*
51228177Skib * Various internal actions are tracked by tagging g_event[s] onto
52228177Skib * an internal eventqueue.
53228177Skib */
54228177Skibenum g_events {
55228177Skib	EV_NEW_CLASS,		/* class */
56228177Skib	EV_NEW_PROVIDER,	/* provider */
57228177Skib	EV_SPOILED,		/* provider, consumer */
58228177Skib	EV_CALL_ME,		/* func, arg */
59228177Skib	EV_LAST
60228177Skib};
61228177Skib
62228177Skibstruct g_event {
63228177Skib	enum g_events 		event;
64228177Skib	TAILQ_ENTRY(g_event)	events;
65228177Skib	struct g_class		*class;
66228177Skib	struct g_geom		*geom;
67	struct g_provider	*provider;
68	struct g_consumer	*consumer;
69	void			*arg;
70	g_call_me_t		*func;
71};
72
73/* geom_dump.c */
74void g_confxml(void *);
75void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);
76void g_confdot(void *);
77void g_conftxt(void *);
78
79
80/* geom_event.c */
81void g_event_init(void);
82void g_post_event(enum g_events ev, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);
83void g_run_events(void);
84
85/* geom_subr.c */
86extern struct class_list_head g_classes;
87extern char *g_wait_event, *g_wait_sim, *g_wait_up, *g_wait_down;
88
89/* geom_io.c */
90void g_io_init(void);
91void g_io_schedule_down(struct thread *tp);
92void g_io_schedule_up(struct thread *tp);
93
94/* geom_kern.c / geom_kernsim.c */
95void g_init(void);
96