Deleted Added
sdiff udiff text old ( 115468 ) new ( 115473 )
full compact
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 115468 2003-05-31 16:59:27Z phk $
36 */
37
38#ifndef _GEOM_GEOM_H_
39#define _GEOM_GEOM_H_
40
41#include <sys/lock.h>
42#include <sys/mutex.h>
43#include <sys/sx.h>
44#include <sys/queue.h>
45#include <sys/ioccom.h>
46#include <sys/sbuf.h>
47
48struct g_class;
49struct g_geom;
50struct g_consumer;
51struct g_provider;
52struct g_stat;
53struct thread;
54struct bio;
55struct sbuf;
56struct gctl_req;
57struct g_configargs;
58
59typedef int g_config_t (struct g_configargs *ca);
60typedef int g_ctl_create_geom_t (struct gctl_req *, struct g_class *cp, struct g_provider *pp);
61typedef int g_ctl_destroy_geom_t (struct gctl_req *, struct g_class *cp, struct g_geom *gp);
62typedef int g_ctl_config_geom_t (struct gctl_req *, struct g_geom *gp, const char *verb);
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
68typedef int g_access_t (struct g_provider *, int, int, int);
69/* XXX: not sure about the thread arg */
70typedef void g_orphan_t (struct g_consumer *);

--- 9 unchanged lines hidden (view full) ---

80 * one common g_class and so on.
81 * Certain operations are instantiated on the class, most notably the
82 * taste and config_geom functions.
83 */
84struct g_class {
85 const char *name;
86 g_taste_t *taste;
87 g_config_t *config;
88 g_ctl_create_geom_t *create_geom;
89 g_ctl_destroy_geom_t *destroy_geom;
90 g_ctl_config_geom_t *config_geom;
91 /*
92 * The remaining elements are private
93 */
94 LIST_ENTRY(g_class) class;
95 LIST_HEAD(,g_geom) geom;

--- 92 unchanged lines hidden (view full) ---

188int g_waitfor_event(g_event_t *func, void *arg, int flag, ...);
189void g_cancel_event(void *ref);
190void g_orphan_provider(struct g_provider *pp, int error);
191void g_waitidle(void);
192
193/* geom_subr.c */
194int g_access_abs(struct g_consumer *cp, int nread, int nwrite, int nexcl);
195int g_access_rel(struct g_consumer *cp, int nread, int nwrite, int nexcl);
196void g_add_class(struct g_class *mp);
197int g_attach(struct g_consumer *cp, struct g_provider *pp);
198void g_destroy_consumer(struct g_consumer *cp);
199void g_destroy_geom(struct g_geom *pp);
200void g_destroy_provider(struct g_provider *pp);
201void g_detach(struct g_consumer *cp);
202void g_error_provider(struct g_provider *pp, int error);
203int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len);
204#define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v))

--- 5 unchanged lines hidden (view full) ---

210struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...);
211void g_sanity(void *ptr);
212void g_spoil(struct g_provider *pp, struct g_consumer *cp);
213int g_std_access(struct g_provider *pp, int dr, int dw, int de);
214void g_std_done(struct bio *bp);
215void g_std_spoiled(struct g_consumer *cp);
216void g_wither_geom(struct g_geom *gp, int error);
217
218/* geom_io.c */
219struct bio * g_clone_bio(struct bio *);
220void g_destroy_bio(struct bio *);
221void g_io_deliver(struct bio *bp, int error);
222int g_io_getattr(const char *attr, struct g_consumer *cp, int *len, void *ptr);
223void g_io_request(struct bio *bp, struct g_consumer *cp);
224struct bio *g_new_bio(void);
225void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error);

--- 58 unchanged lines hidden (view full) ---

284 } while (0)
285
286#define g_topology_assert() \
287 do { \
288 g_sanity(NULL); \
289 sx_assert(&topology_lock, SX_XLOCKED); \
290 } while (0)
291
292#define DECLARE_GEOM_CLASS_INIT(class, name, init) \
293 SYSINIT(name, SI_SUB_DRIVERS, SI_ORDER_FIRST, init, NULL);
294
295#define DECLARE_GEOM_CLASS(class, name) \
296 static void \
297 name##init(void) \
298 { \
299 mtx_unlock(&Giant); \
300 g_add_class(&class); \
301 mtx_lock(&Giant); \
302 } \
303 DECLARE_GEOM_CLASS_INIT(class, name, name##init);
304
305#endif /* _KERNEL */
306
307/* geom_ctl.c */
308int gctl_set_param(struct gctl_req *req, const char *param, void *ptr, int len);
309void *gctl_get_param(struct gctl_req *req, const char *param, int *len);
310void *gctl_get_paraml(struct gctl_req *req, const char *param, int len);
311int gctl_error(struct gctl_req *req, const char *fmt, ...);
312
313#endif /* _GEOM_GEOM_H_ */