1112508Sphk/*-
2112508Sphk * Copyright (c) 2003 Poul-Henning Kamp
3112508Sphk * All rights reserved.
4112508Sphk *
5112508Sphk * Redistribution and use in source and binary forms, with or without
6112508Sphk * modification, are permitted provided that the following conditions
7112508Sphk * are met:
8112508Sphk * 1. Redistributions of source code must retain the above copyright
9112508Sphk *    notice, this list of conditions and the following disclaimer.
10112508Sphk * 2. Redistributions in binary form must reproduce the above copyright
11112508Sphk *    notice, this list of conditions and the following disclaimer in the
12112508Sphk *    documentation and/or other materials provided with the distribution.
13112508Sphk * 3. The names of the authors may not be used to endorse or promote
14112508Sphk *    products derived from this software without specific prior written
15112508Sphk *    permission.
16112508Sphk *
17112508Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18112508Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19112508Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20112508Sphk * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21112508Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22112508Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23112508Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24112508Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25112508Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26112508Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27112508Sphk * SUCH DAMAGE.
28112508Sphk *
29112508Sphk * $FreeBSD$
30112508Sphk */
31112508Sphk
32112508Sphk#ifndef _GEOM_GEOM_CTL_H_
33112508Sphk#define _GEOM_GEOM_CTL_H_
34112508Sphk
35115624Sphk#include <sys/ioccom.h>
36115624Sphk
37112508Sphk/*
38112508Sphk * Version number.  Used to check consistency between kernel and libgeom.
39112508Sphk */
40115624Sphk#define GCTL_VERSION	2
41112508Sphk
42115624Sphkstruct gctl_req_arg {
43115624Sphk	u_int				nlen;
44115624Sphk	char				*name;
45115624Sphk	off_t				offset;
46115624Sphk	int				flag;
47115624Sphk	int				len;
48115624Sphk	void				*value;
49115624Sphk	/* kernel only fields */
50115624Sphk	void				*kvalue;
51115624Sphk};
52113875Sphk
53115624Sphk#define GCTL_PARAM_RD		1	/* Must match VM_PROT_READ */
54115624Sphk#define GCTL_PARAM_WR		2	/* Must match VM_PROT_WRITE */
55115624Sphk#define GCTL_PARAM_RW		(GCTL_PARAM_RD | GCTL_PARAM_WR)
56115624Sphk#define GCTL_PARAM_ASCII	4
57113875Sphk
58115624Sphk/* These are used in the kernel only */
59115624Sphk#define GCTL_PARAM_NAMEKERNEL	8
60115624Sphk#define GCTL_PARAM_VALUEKERNEL	16
61115624Sphk#define GCTL_PARAM_CHANGED	32
62113875Sphk
63115624Sphkstruct gctl_req {
64115624Sphk	u_int				version;
65115624Sphk	u_int				serial;
66115624Sphk	u_int				narg;
67115624Sphk	struct gctl_req_arg		*arg;
68115624Sphk	u_int				lerror;
69115624Sphk	char				*error;
70115624Sphk	struct gctl_req_table		*reqt;
71113875Sphk
72115624Sphk	/* kernel only fields */
73115624Sphk	int				nerror;
74115624Sphk	struct sbuf			*serror;
75112508Sphk};
76112508Sphk
77115624Sphk#define GEOM_CTL	_IOW('G', GCTL_VERSION, struct gctl_req)
78112508Sphk
79115624Sphk#define PATH_GEOM_CTL	"geom.ctl"
80112508Sphk
81112508Sphk
82112508Sphk#endif /* _GEOM_GEOM_CTL_H_ */
83