geom.h revision 155175
1153838Sdfr/*-
2153838Sdfr * Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3153838Sdfr * All rights reserved.
4153838Sdfr *
5153838Sdfr * Redistribution and use in source and binary forms, with or without
6153838Sdfr * modification, are permitted provided that the following conditions
7153838Sdfr * are met:
8153838Sdfr * 1. Redistributions of source code must retain the above copyright
9153838Sdfr *    notice, this list of conditions and the following disclaimer.
10153838Sdfr * 2. Redistributions in binary form must reproduce the above copyright
11153838Sdfr *    notice, this list of conditions and the following disclaimer in the
12153838Sdfr *    documentation and/or other materials provided with the distribution.
13153838Sdfr *
14153838Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15153838Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16153838Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17153838Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18153838Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19153838Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20153838Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21153838Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22153838Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23153838Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24153838Sdfr * SUCH DAMAGE.
25153838Sdfr *
26153838Sdfr * $FreeBSD: head/sbin/geom/core/geom.h 155175 2006-02-01 12:11:37Z pjd $
27153838Sdfr */
28153838Sdfr
29153838Sdfr#ifndef _GEOM_H_
30153838Sdfr#define	_GEOM_H_
31153838Sdfr#define	G_LIB_VERSION	1
32153838Sdfr
33153838Sdfr#define	G_FLAG_NONE	0x0000
34153838Sdfr#define	G_FLAG_VERBOSE	0x0001
35153838Sdfr#define	G_FLAG_LOADKLD	0x0002
36153838Sdfr
37153838Sdfr#define	G_TYPE_NONE	0
38153838Sdfr#define	G_TYPE_STRING	1
39153838Sdfr#define	G_TYPE_NUMBER	2
40153838Sdfr
41153838Sdfr#define	G_OPT_MAX	16
42153838Sdfr#define	G_OPT_DONE(opt)		(opt)->go_char = '\0'
43153838Sdfr#define	G_OPT_ISDONE(opt)	((opt)->go_char == '\0')
44153838Sdfr
45153838Sdfr#define G_OPT_SENTINEL	{ '\0', NULL, NULL, G_TYPE_NONE }
46153838Sdfr#define G_NULL_OPTS	{ G_OPT_SENTINEL }
47153838Sdfr#define	G_CMD_SENTINEL	{ NULL, 0, NULL, G_NULL_OPTS, NULL }
48153838Sdfr
49153838Sdfrstruct g_option {
50153838Sdfr	char		 go_char;
51153838Sdfr	const char	*go_name;
52153838Sdfr	void		*go_val;
53153838Sdfr	unsigned	 go_type;
54153838Sdfr};
55153838Sdfr
56153838Sdfrstruct g_command {
57153838Sdfr	const char	*gc_name;
58153838Sdfr	unsigned	 gc_flags;
59153838Sdfr	void		(*gc_func)(struct gctl_req *, unsigned);
60153838Sdfr	struct g_option	gc_options[G_OPT_MAX];
61	const char	*gc_usage;
62};
63#endif	/* !_GEOM_H_ */
64