xref: /freebsd/lib/libgeom/libgeom.3 (revision fbda685d38d09604986d0dfc33e9c7f3b802c2b6)
1e13db587SPoul-Henning Kamp.\" Copyright (c) 2003 Poul-Henning Kamp
2fbda685dSPawel Jakub Dawidek.\" Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3e13db587SPoul-Henning Kamp.\" All rights reserved.
4e13db587SPoul-Henning Kamp.\"
5e13db587SPoul-Henning Kamp.\" Redistribution and use in source and binary forms, with or without
6e13db587SPoul-Henning Kamp.\" modification, are permitted provided that the following conditions
7e13db587SPoul-Henning Kamp.\" are met:
8e13db587SPoul-Henning Kamp.\" 1. Redistributions of source code must retain the above copyright
9e13db587SPoul-Henning Kamp.\"    notice, this list of conditions and the following disclaimer.
10e13db587SPoul-Henning Kamp.\" 2. Redistributions in binary form must reproduce the above copyright
11e13db587SPoul-Henning Kamp.\"    notice, this list of conditions and the following disclaimer in the
12e13db587SPoul-Henning Kamp.\"    documentation and/or other materials provided with the distribution.
13e13db587SPoul-Henning Kamp.\" 3. The names of the authors may not be used to endorse or promote
14e13db587SPoul-Henning Kamp.\"    products derived from this software without specific prior written
15e13db587SPoul-Henning Kamp.\"    permission.
16e13db587SPoul-Henning Kamp.\"
17e13db587SPoul-Henning Kamp.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18e13db587SPoul-Henning Kamp.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19e13db587SPoul-Henning Kamp.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20e13db587SPoul-Henning Kamp.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21e13db587SPoul-Henning Kamp.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22e13db587SPoul-Henning Kamp.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23e13db587SPoul-Henning Kamp.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24e13db587SPoul-Henning Kamp.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25e13db587SPoul-Henning Kamp.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26e13db587SPoul-Henning Kamp.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27e13db587SPoul-Henning Kamp.\" SUCH DAMAGE.
28e13db587SPoul-Henning Kamp.\"
29e13db587SPoul-Henning Kamp.\" $FreeBSD$
30e13db587SPoul-Henning Kamp.\"
31fbda685dSPawel Jakub Dawidek.Dd May 6, 2007
32e13db587SPoul-Henning Kamp.Dt LIBGEOM 3
33e13db587SPoul-Henning Kamp.Os
34e13db587SPoul-Henning Kamp.Sh NAME
35e13db587SPoul-Henning Kamp.Nm geom_stats_open ,
36e13db587SPoul-Henning Kamp.Nm geom_stats_close ,
37e13db587SPoul-Henning Kamp.Nm geom_stats_resync ,
38e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_get ,
39e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_free ,
40e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_timestamp ,
41e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_reset ,
425e5bfe77SPoul-Henning Kamp.Nm geom_stats_snapshot_next ,
435e5bfe77SPoul-Henning Kamp.Nm gctl_get_handle ,
445e5bfe77SPoul-Henning Kamp.Nm gctl_ro_param ,
455e5bfe77SPoul-Henning Kamp.Nm gctl_rw_param ,
465e5bfe77SPoul-Henning Kamp.Nm gctl_issue ,
475e5bfe77SPoul-Henning Kamp.Nm gctl_free ,
48fbda685dSPawel Jakub Dawidek.Nm gctl_dump ,
49fbda685dSPawel Jakub Dawidek.Nm g_open ,
50fbda685dSPawel Jakub Dawidek.Nm g_close ,
51fbda685dSPawel Jakub Dawidek.Nm g_mediasize ,
52fbda685dSPawel Jakub Dawidek.Nm g_sectorsize ,
53fbda685dSPawel Jakub Dawidek.Nm g_flush ,
54fbda685dSPawel Jakub Dawidek.Nm g_delete ,
55fbda685dSPawel Jakub Dawidek.Nm g_get_ident ,
56fbda685dSPawel Jakub Dawidek.Nm g_get_name ,
57fbda685dSPawel Jakub Dawidek.Nm g_open_by_ident
583fe5cc64SAlexey Zelkin.Nd userland API library for kernel GEOM subsystem
59e13db587SPoul-Henning Kamp.Sh LIBRARY
603fe5cc64SAlexey Zelkin.Lb libgeom
61e13db587SPoul-Henning Kamp.Sh SYNOPSIS
62e13db587SPoul-Henning Kamp.In libgeom.h
63ace5be68SRuslan Ermilov.Ss "Statistics Functions"
64e13db587SPoul-Henning Kamp.Ft void
65e13db587SPoul-Henning Kamp.Fn geom_stats_close void
66e13db587SPoul-Henning Kamp.Ft int
67e13db587SPoul-Henning Kamp.Fn geom_stats_open void
68e13db587SPoul-Henning Kamp.Ft void
69e13db587SPoul-Henning Kamp.Fn geom_stats_resync void
70ace5be68SRuslan Ermilov.Ft "void *"
71e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_get void
72e13db587SPoul-Henning Kamp.Ft void
73e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_free "void *arg"
74e13db587SPoul-Henning Kamp.Ft void
75e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_timestamp "void *arg" "struct timespec *tp"
76e13db587SPoul-Henning Kamp.Ft void
77e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_reset "void *arg"
7870b07749SRuslan Ermilov.Ft "struct devstat *"
79e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_next "void *arg"
805e5bfe77SPoul-Henning Kamp.Ss "Control Functions"
815e5bfe77SPoul-Henning Kamp.Ft "struct gctl_req *"
825e5bfe77SPoul-Henning Kamp.Fn gctl_get_handle "void"
835e5bfe77SPoul-Henning Kamp.Ft void
845e5bfe77SPoul-Henning Kamp.Fn gctl_ro_param "struct gctl_req *req" "const char *name" "int len" "const void *value"
855e5bfe77SPoul-Henning Kamp.Ft void
865e5bfe77SPoul-Henning Kamp.Fn gctl_rw_param "struct gctl_req *req" "const char *name" "int len" "void *value"
875e5bfe77SPoul-Henning Kamp.Ft "const char *"
885e5bfe77SPoul-Henning Kamp.Fn gctl_issue "struct gctl_req *req"
895e5bfe77SPoul-Henning Kamp.Ft void
905e5bfe77SPoul-Henning Kamp.Fn gctl_free "struct gctl_req *req"
915e5bfe77SPoul-Henning Kamp.Ft void
925e5bfe77SPoul-Henning Kamp.Fn gctl_dump "struct gctl_req *req" "FILE *f"
93fbda685dSPawel Jakub Dawidek.Ss "Utility Functions"
94fbda685dSPawel Jakub Dawidek.Ft int
95fbda685dSPawel Jakub Dawidek.Fn g_open "const char *name" "int write"
96fbda685dSPawel Jakub Dawidek.Ft int
97fbda685dSPawel Jakub Dawidek.Fn g_close "int fd"
98fbda685dSPawel Jakub Dawidek.Ft off_t
99fbda685dSPawel Jakub Dawidek.Fn g_mediasize "int fd"
100fbda685dSPawel Jakub Dawidek.Ft ssize_t
101fbda685dSPawel Jakub Dawidek.Fn g_sectorsize "int fd"
102fbda685dSPawel Jakub Dawidek.Ft int
103fbda685dSPawel Jakub Dawidek.Fn g_flush "int fd"
104fbda685dSPawel Jakub Dawidek.Ft int
105fbda685dSPawel Jakub Dawidek.Fn g_delete "int fd" "off_t offset" "off_t length"
106fbda685dSPawel Jakub Dawidek.Ft int
107fbda685dSPawel Jakub Dawidek.Fn g_get_ident "int fd" "char *ident" "size_t size"
108fbda685dSPawel Jakub Dawidek.Ft int
109fbda685dSPawel Jakub Dawidek.Fn g_get_name "const char *ident" "char *name" "size_t size"
110fbda685dSPawel Jakub Dawidek.Ft int
111fbda685dSPawel Jakub Dawidek.Fn g_open_by_ident "const char *ident" "int write" "char *name" "size_t size"
112e13db587SPoul-Henning Kamp.Sh DESCRIPTION
113ace5be68SRuslan ErmilovThe
114ace5be68SRuslan Ermilov.Nm geom
115ace5be68SRuslan Ermilovlibrary contains the official and publicized API for
116e13db587SPoul-Henning Kampinteracting with the GEOM subsystem in the kernel.
117ace5be68SRuslan Ermilov.Ss "Statistics Functions"
118e13db587SPoul-Henning KampGEOM collects statistics data for all consumers and providers, but does
119e13db587SPoul-Henning Kampnot perform any normalization or presentation on the raw data, this is
120e13db587SPoul-Henning Kampleft as an excercize for user-land presentation utilities.
121e13db587SPoul-Henning Kamp.Pp
122e13db587SPoul-Henning KampThe
1233fe5cc64SAlexey Zelkin.Fn geom_stats_open
124e13db587SPoul-Henning Kampand
1253fe5cc64SAlexey Zelkin.Fn geom_stats_close
126ace5be68SRuslan Ermilovfunctions open and close the necessary pathways to access the raw
127ace5be68SRuslan Ermilovstatistics information in the kernel.
128ace5be68SRuslan ErmilovThese functions are likely to
129e13db587SPoul-Henning Kampopen one or more files and cache the file descriptors locally.
130b160a51eSPhilippe CharnierThe
1313fe5cc64SAlexey Zelkin.Fn geom_stats_open
132b160a51eSPhilippe Charnierfunction returns zero on success, and sets
133ace5be68SRuslan Ermilov.Va errno
134ace5be68SRuslan Ermilovif not.
135e13db587SPoul-Henning Kamp.Pp
136e13db587SPoul-Henning KampThe
1373fe5cc64SAlexey Zelkin.Fn geom_stats_resync
138e13db587SPoul-Henning Kampfunction will check if more statistics collection points have been
139e13db587SPoul-Henning Kampadded in the kernel since
1403fe5cc64SAlexey Zelkin.Fn geom_stats_open
141e13db587SPoul-Henning Kampor the previous call to
1423fe5cc64SAlexey Zelkin.Fn geom_stats_resync .
143e13db587SPoul-Henning Kamp.Pp
144ace5be68SRuslan ErmilovThe
1453fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_get
146ace5be68SRuslan Ermilovfunction
147ace5be68SRuslan Ermilovwill acquire a snapshot of the raw data from the kernel, and while a
148e13db587SPoul-Henning Kampreasonable effort is made to make this snapshot as atomic and consistent
149e13db587SPoul-Henning Kampas possible, no guarantee is given that it will actually be so.
150e13db587SPoul-Henning KampThe snapshot must be freed again using the
1513fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_free
152e13db587SPoul-Henning Kampfunction.
153b160a51eSPhilippe CharnierThe
1543fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_get
155b160a51eSPhilippe Charnierfunction returns
156ace5be68SRuslan Ermilov.Dv NULL
157ace5be68SRuslan Ermilovon failure.
158e13db587SPoul-Henning Kamp.Pp
159ace5be68SRuslan ErmilovThe
1603fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_timestamp
161ace5be68SRuslan Ermilovfunction
162ace5be68SRuslan Ermilovprovides access to the timestamp acquired in the snapshot.
163e13db587SPoul-Henning Kamp.Pp
164ace5be68SRuslan ErmilovThe
1653fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_reset
166e13db587SPoul-Henning Kampand
1673fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_next
168ace5be68SRuslan Ermilovfunctions
169ace5be68SRuslan Ermilovprovide an iterator over the statistics slots in the snapshot.
170ace5be68SRuslan ErmilovThe
1713fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_reset
172ace5be68SRuslan Ermilovfunction
173e13db587SPoul-Henning Kampforces the internal pointer in the snapshot back to before the first item.
174ace5be68SRuslan ErmilovThe
1753fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_next
176ace5be68SRuslan Ermilovfunction
177ace5be68SRuslan Ermilovreturns the next item, and
178ace5be68SRuslan Ermilov.Dv NULL
179ace5be68SRuslan Ermilovif there are no more items in the snapshot.
1805e5bfe77SPoul-Henning Kamp.Ss "Control Functions"
1815e5bfe77SPoul-Henning KampThe
1825e5bfe77SPoul-Henning Kamp.Fn gctl_*
183862b46f6SRuslan Ermilovfunctions are used to send requests to GEOM classes.
184862b46f6SRuslan ErmilovIn order for a GEOM
1855e5bfe77SPoul-Henning Kampclass to actually be able to receive these requests, it must have defined a
1865e5bfe77SPoul-Henning Kamp"ctlreq" method.
1875e5bfe77SPoul-Henning Kamp.Pp
1885e5bfe77SPoul-Henning KampA
189862b46f6SRuslan Ermilov.Vt "struct gctl_req *" ,
1905e5bfe77SPoul-Henning Kampobtained with
1915e5bfe77SPoul-Henning Kamp.Fn gctl_get_handle ,
1925e5bfe77SPoul-Henning Kampcan hold any number of parameters, which must be added to it with
1935e5bfe77SPoul-Henning Kamp.Fn gctl_ro_param
1945e5bfe77SPoul-Henning Kamp(for read-only parameters) or
1955e5bfe77SPoul-Henning Kamp.Fn gctl_rw_param
1965e5bfe77SPoul-Henning Kamp(for read/write parameters).
1975e5bfe77SPoul-Henning Kamp.Pp
1985e5bfe77SPoul-Henning KampBoth
1995e5bfe77SPoul-Henning Kamp.Fn gctl_ro_param
2005e5bfe77SPoul-Henning Kampand
2015e5bfe77SPoul-Henning Kamp.Fn gctl_rw_param
2025e5bfe77SPoul-Henning Kamptake a string
203862b46f6SRuslan Ermilov.Fa name ,
2045e5bfe77SPoul-Henning Kampwhich is used to identify the parameter, and a
205862b46f6SRuslan Ermilov.Fa value ,
206862b46f6SRuslan Ermilovwhich contains, in the read-only case, the data to be passed to the
207862b46f6SRuslan ErmilovGEOM class, or, in the read/write case, a pointer to preallocated memory
208862b46f6SRuslan Ermilovthat the GEOM class should fill with the desired data.
209862b46f6SRuslan ErmilovIf
210862b46f6SRuslan Ermilov.Fa len
2115e5bfe77SPoul-Henning Kampis negative, it is assumed that
212862b46f6SRuslan Ermilov.Fa value
213862b46f6SRuslan Ermilovis an
214862b46f6SRuslan Ermilov.Tn ASCII
215862b46f6SRuslan Ermilovstring and the actual length is taken from the string length of
216862b46f6SRuslan Ermilov.Fa value ;
2175e5bfe77SPoul-Henning Kampotherwise it must hold the size of
218862b46f6SRuslan Ermilov.Fa value .
2195e5bfe77SPoul-Henning Kamp.Pp
2205e5bfe77SPoul-Henning KampA parameter with a
221862b46f6SRuslan Ermilov.Fa name
222862b46f6SRuslan Ermilovcontaining the string
223862b46f6SRuslan Ermilov.Qq Li class
224862b46f6SRuslan Ermilovis mandatory for each request, and the
2255e5bfe77SPoul-Henning Kampcorresponding
226862b46f6SRuslan Ermilov.Fa value
2275e5bfe77SPoul-Henning Kampmust hold the name of the GEOM class where the request should be sent to.
2285e5bfe77SPoul-Henning Kamp.Pp
2295e5bfe77SPoul-Henning KampAlso mandatory for each request is a parameter with a
230862b46f6SRuslan Ermilov.Fa name
231862b46f6SRuslan Ermilovcalled
232862b46f6SRuslan Ermilov.Qq Li verb ,
233862b46f6SRuslan Ermilovand the corresponding
234862b46f6SRuslan Ermilov.Fa value
2355e5bfe77SPoul-Henning Kampneeds to hold the command string that the GEOM class should react upon.
2365e5bfe77SPoul-Henning Kamp.Pp
2375e5bfe77SPoul-Henning KampOnce all desired parameters are filled in, the request must be sent to
2385e5bfe77SPoul-Henning Kampthe GEOM subsystem with
2395e5bfe77SPoul-Henning Kamp.Fn gctl_issue ,
240862b46f6SRuslan Ermilovwhich returns
241862b46f6SRuslan Ermilov.Dv NULL
242862b46f6SRuslan Ermilovon success, or a string containing the error message
2435e5bfe77SPoul-Henning Kampon failure.
2445e5bfe77SPoul-Henning Kamp.Pp
2455e5bfe77SPoul-Henning KampAfter the request is finished, the allocated memory should be released with
2465e5bfe77SPoul-Henning Kamp.Fn gctl_free .
2475e5bfe77SPoul-Henning Kamp.Pp
248862b46f6SRuslan ErmilovThe
2495e5bfe77SPoul-Henning Kamp.Fn gctl_dump
250862b46f6SRuslan Ermilovfunction
2515e5bfe77SPoul-Henning Kampcan be used to format the contents of
252862b46f6SRuslan Ermilov.Fa req
2535e5bfe77SPoul-Henning Kampto the open file handle pointed to by
254862b46f6SRuslan Ermilov.Fa f ,
2555e5bfe77SPoul-Henning Kampfor debugging purposes.
2565e5bfe77SPoul-Henning Kamp.Pp
2575e5bfe77SPoul-Henning KampError handling for the control functions is postponed until the call
2585e5bfe77SPoul-Henning Kampto
259862b46f6SRuslan Ermilov.Fn gctl_issue ,
260862b46f6SRuslan Ermilovwhich returns
261862b46f6SRuslan Ermilov.Dv NULL
262862b46f6SRuslan Ermilovon success, or an error message corresponding to the
2635e5bfe77SPoul-Henning Kampfirst error which happened.
264fbda685dSPawel Jakub Dawidek.Ss "Utility Functions"
265fbda685dSPawel Jakub DawidekThe
266fbda685dSPawel Jakub Dawidek.Fn g_*
267fbda685dSPawel Jakub Dawidekfunctions are used to communicate with GEOM providers.
268fbda685dSPawel Jakub Dawidek.Pp
269fbda685dSPawel Jakub DawidekThe
270fbda685dSPawel Jakub Dawidek.Fn g_open
271fbda685dSPawel Jakub Dawidekfunction opens the given provider and returns file descriptor number, which can
272fbda685dSPawel Jakub Dawidekbe used with other functions.
273fbda685dSPawel Jakub DawidekThe
274fbda685dSPawel Jakub Dawidek.Fa write
275fbda685dSPawel Jakub Dawidekargument indicates if operations that modify the provider (like
276fbda685dSPawel Jakub Dawidek.Fn g_flush
277fbda685dSPawel Jakub Dawidekor
278fbda685dSPawel Jakub Dawidek.Fn g_delete )
279fbda685dSPawel Jakub Dawidekare going to be called.
280fbda685dSPawel Jakub Dawidek.Pp
281fbda685dSPawel Jakub DawidekThe
282fbda685dSPawel Jakub Dawidek.Fn g_close
283fbda685dSPawel Jakub Dawidekfunction closes the provider.
284fbda685dSPawel Jakub Dawidek.Pp
285fbda685dSPawel Jakub DawidekThe
286fbda685dSPawel Jakub Dawidek.Fn g_mediasize
287fbda685dSPawel Jakub Dawidekfunction returns size of the given provider.
288fbda685dSPawel Jakub Dawidek.Pp
289fbda685dSPawel Jakub DawidekThe
290fbda685dSPawel Jakub Dawidek.Fn g_sectorsize
291fbda685dSPawel Jakub Dawidekfunction returns sector size of the given provider.
292fbda685dSPawel Jakub Dawidek.Pp
293fbda685dSPawel Jakub DawidekThe
294fbda685dSPawel Jakub Dawidek.Fn g_flush
295fbda685dSPawel Jakub Dawidekfunction sends
296fbda685dSPawel Jakub Dawidek.Dv BIO_FLUSH
297fbda685dSPawel Jakub Dawidekrequest to flush write cache of the provider.
298fbda685dSPawel Jakub Dawidek.Pp
299fbda685dSPawel Jakub DawidekThe
300fbda685dSPawel Jakub Dawidek.Fn g_delete
301fbda685dSPawel Jakub Dawidekfunction tells the provider that the given data range is no longer used.
302fbda685dSPawel Jakub Dawidek.Pp
303fbda685dSPawel Jakub DawidekThe
304fbda685dSPawel Jakub Dawidek.Fn g_get_ident
305fbda685dSPawel Jakub Dawidekfunction returns provider's fixed and unique identifier.
306fbda685dSPawel Jakub DawidekThe
307fbda685dSPawel Jakub Dawidek.Fa ident
308fbda685dSPawel Jakub Dawidekargument should be at least
309fbda685dSPawel Jakub Dawidek.Dv DISK_IDENT_SIZE
310fbda685dSPawel Jakub Dawidekbig.
311fbda685dSPawel Jakub Dawidek.Pp
312fbda685dSPawel Jakub DawidekThe
313fbda685dSPawel Jakub Dawidek.Fn g_get_name
314fbda685dSPawel Jakub Dawidekfunction returns name of the provider, which identifier is equal to the
315fbda685dSPawel Jakub Dawidek.Fa ident
316fbda685dSPawel Jakub Dawidekstring.
317fbda685dSPawel Jakub Dawidek.Pp
318fbda685dSPawel Jakub DawidekThe
319fbda685dSPawel Jakub Dawidek.Fn g_open_by_ident
320fbda685dSPawel Jakub Dawidekfunction opens provider using its ident, unlike
321fbda685dSPawel Jakub Dawidek.Fn g_open
322fbda685dSPawel Jakub Dawidekwhich uses provider's name.
323fbda685dSPawel Jakub DawidekIf the
324fbda685dSPawel Jakub Dawidek.Fa name
325fbda685dSPawel Jakub Dawidekargument is not
326fbda685dSPawel Jakub Dawidek.Dv NULL ,
327fbda685dSPawel Jakub Dawidekthe function will store provider's name there.
328fbda685dSPawel Jakub Dawidek.Pp
329fbda685dSPawel Jakub DawidekAll functions return value greater than or equal to
330fbda685dSPawel Jakub Dawidek.Va 0
331fbda685dSPawel Jakub Dawidekon success or
332fbda685dSPawel Jakub Dawidek.Va -1
333fbda685dSPawel Jakub Dawidekon failure.
3345e5bfe77SPoul-Henning Kamp.Sh EXAMPLES
335862b46f6SRuslan ErmilovCreate a request that is to be sent to the CCD class, and tell
3365e5bfe77SPoul-Henning Kampit to destroy a specific geom:
3375e5bfe77SPoul-Henning Kamp.Bd -literal -offset indent
3385e5bfe77SPoul-Henning KampH = gctl_get_handle();
3395e5bfe77SPoul-Henning Kampgctl_ro_param(H, "verb", -1, "destroy geom");
3405e5bfe77SPoul-Henning Kampgctl_ro_param(H, "class", -1, "CCD");
3415e5bfe77SPoul-Henning Kampsprintf(buf, "ccd%d", ccd);
3425e5bfe77SPoul-Henning Kampgctl_ro_param(H, "geom", -1, buf);
3435e5bfe77SPoul-Henning Kamperrstr = gctl_issue(H);
3445e5bfe77SPoul-Henning Kampif (errstr != NULL)
345862b46f6SRuslan Ermilov    err(1, "could not destroy ccd: %s", errstr);
3465e5bfe77SPoul-Henning Kampgctl_free(H);
3475e5bfe77SPoul-Henning Kamp.Ed
3485e5bfe77SPoul-Henning Kamp.Sh SEE ALSO
349862b46f6SRuslan Ermilov.Pa http://ezine.daemonnews.org/200308/blueprints.html
350e13db587SPoul-Henning Kamp.Sh HISTORY
351ace5be68SRuslan ErmilovThe
352e13db587SPoul-Henning Kamp.Nm geom
353ace5be68SRuslan Ermilovlibrary appeared in
354e13db587SPoul-Henning Kamp.Fx 5.1 .
3555e5bfe77SPoul-Henning Kamp.Sh AUTHORS
3565e5bfe77SPoul-Henning Kamp.An Poul-Henning Kamp Aq phk@FreeBSD.org
3575e5bfe77SPoul-Henning Kamp.An Lukas Ertl Aq le@FreeBSD.org
358fbda685dSPawel Jakub Dawidek.An Pawel Jakub Dawidek pjd@FreeBSD.org
359