2 .\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 .Fn g_new_geomf "struct g_class *mp" "const char *fmt" ...
39 .Fn g_destroy_geom "struct g_geom *gp"
41 The geom (do not confuse
45 is an instance of a GEOM class.
46 For example: in a typical i386 FreeBSD system, there will be one geom
47 of class MBR for each disk.
48 The geom's name is not really important, it is only used in the XML
49 dump and for debugging purposes.
50 There can be many geoms with the same name.
54 function creates a new geom, which will be an instance of the class
56 The geom's name is created in a printf-like way from the rest of the arguments.
60 function destroys the given geom immediately and cancels all related pending
66 contains fields that should be set by the caller after geom creation, but before
67 creating any providers or consumers related to this geom (not all are required):
68 .Bl -inset -offset indent
69 .It Vt "g_start_t *" Va start
70 Pointer to a function used for I/O processing.
71 .It Vt "g_spoiled_t *" Va spoiled
72 Pointer to a function used for consumers spoiling.
73 .It Vt "g_dumpconf_t *" Va dumpconf
74 Pointer to a function used for configuration in XML format dumping.
75 .It Vt "g_access_t *" Va access
76 Pointer to a function used for access control.
77 .It Vt "g_orphan_t *" Va orphan
78 Pointer to a function used to inform about orphaned consumer.
79 .It Vt "g_ioctl_t *" Va ioctl
80 Pointer to a function used for handling ioctl requests.
81 .It Vt "void *" Va softc
82 Field for private use.
84 .Sh RESTRICTIONS/CONDITIONS
85 If you intend to use providers in this geom you must set field
89 If you are planning to use consumers in your geom you must set fields
96 .Bl -item -offset indent
100 must be valid (registered in GEOM).
102 The topology lock has to be held.
106 .Bl -item -offset indent
108 The geom can not posses any providers.
110 The geom can not posses any consumers.
112 The topology lock has to be held.
116 returns a pointer to the newly created geom.
118 Create an example geom.
119 .Bd -literal -offset indent
121 g_example_start(struct bio *bp)
128 g_example_orphan(struct g_consumer *cp)
137 g_example_spoiled(struct g_consumer *cp)
146 g_example_access(struct g_provider *pp, int dr, int dw, int de)
152 static struct g_geom *
153 create_example_geom(struct g_class *myclass)
158 gp = g_new_geomf(myclass, "example_geom");
160 gp->start = g_example_start;
161 gp->orphan = g_example_orphan;
162 gp->spoiled = g_example_spoiled;
163 gp->access = g_example_access;
170 destroy_example_geom(struct g_geom *gp)
174 if (!LIST_EMPTY(&gp->provider) ||
175 !LIST_EMPTY(&gp->consumer)) {
186 .Xr DECLARE_GEOM_CLASS 9 ,
195 .Xr g_provider_by_name 9 ,
199 This manual page was written by
200 .An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .