xref: /freebsd/lib/libgeom/libgeom.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\"
293f7047aeSRomain Tartière.Dd October 16, 2017
30e13db587SPoul-Henning Kamp.Dt LIBGEOM 3
31e13db587SPoul-Henning Kamp.Os
32e13db587SPoul-Henning Kamp.Sh NAME
33e13db587SPoul-Henning Kamp.Nm geom_stats_open ,
34e13db587SPoul-Henning Kamp.Nm geom_stats_close ,
35e13db587SPoul-Henning Kamp.Nm geom_stats_resync ,
36e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_get ,
37e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_free ,
38e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_timestamp ,
39e13db587SPoul-Henning Kamp.Nm geom_stats_snapshot_reset ,
405e5bfe77SPoul-Henning Kamp.Nm geom_stats_snapshot_next ,
415e5bfe77SPoul-Henning Kamp.Nm gctl_get_handle ,
425e5bfe77SPoul-Henning Kamp.Nm gctl_ro_param ,
435e5bfe77SPoul-Henning Kamp.Nm gctl_rw_param ,
445e5bfe77SPoul-Henning Kamp.Nm gctl_issue ,
455e5bfe77SPoul-Henning Kamp.Nm gctl_free ,
46fbda685dSPawel Jakub Dawidek.Nm gctl_dump ,
473f7047aeSRomain Tartière.Nm geom_getxml ,
483f7047aeSRomain Tartière.Nm geom_xml2tree ,
493f7047aeSRomain Tartière.Nm geom_gettree ,
503f7047aeSRomain Tartière.Nm geom_deletetree ,
51fbda685dSPawel Jakub Dawidek.Nm g_open ,
52fbda685dSPawel Jakub Dawidek.Nm g_close ,
53fbda685dSPawel Jakub Dawidek.Nm g_mediasize ,
54fbda685dSPawel Jakub Dawidek.Nm g_sectorsize ,
5535daa28fSXin LI.Nm g_stripeoffset ,
5635daa28fSXin LI.Nm g_stripesize ,
57fbda685dSPawel Jakub Dawidek.Nm g_flush ,
58fbda685dSPawel Jakub Dawidek.Nm g_delete ,
5931dff47fSUlf Lilleengen.Nm g_device_path ,
60fbda685dSPawel Jakub Dawidek.Nm g_get_ident ,
61fbda685dSPawel Jakub Dawidek.Nm g_get_name ,
6231dff47fSUlf Lilleengen.Nm g_open_by_ident ,
6331dff47fSUlf Lilleengen.Nm g_providername
643fe5cc64SAlexey Zelkin.Nd userland API library for kernel GEOM subsystem
65e13db587SPoul-Henning Kamp.Sh LIBRARY
663fe5cc64SAlexey Zelkin.Lb libgeom
67e13db587SPoul-Henning Kamp.Sh SYNOPSIS
68e9765022SEnji Cooper.Bd -literal
69e9765022SEnji Cooper/* stdio.h is only required for `gctl_dump` */
70e9765022SEnji Cooper.Ed
71e9765022SEnji Cooper.In stdio.h
72e13db587SPoul-Henning Kamp.In libgeom.h
73ace5be68SRuslan Ermilov.Ss "Statistics Functions"
74e13db587SPoul-Henning Kamp.Ft void
75e13db587SPoul-Henning Kamp.Fn geom_stats_close void
76e13db587SPoul-Henning Kamp.Ft int
77e13db587SPoul-Henning Kamp.Fn geom_stats_open void
78e13db587SPoul-Henning Kamp.Ft void
79e13db587SPoul-Henning Kamp.Fn geom_stats_resync void
80ace5be68SRuslan Ermilov.Ft "void *"
81e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_get void
82e13db587SPoul-Henning Kamp.Ft void
83e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_free "void *arg"
84e13db587SPoul-Henning Kamp.Ft void
85e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_timestamp "void *arg" "struct timespec *tp"
86e13db587SPoul-Henning Kamp.Ft void
87e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_reset "void *arg"
8870b07749SRuslan Ermilov.Ft "struct devstat *"
89e13db587SPoul-Henning Kamp.Fn geom_stats_snapshot_next "void *arg"
905e5bfe77SPoul-Henning Kamp.Ss "Control Functions"
915e5bfe77SPoul-Henning Kamp.Ft "struct gctl_req *"
925e5bfe77SPoul-Henning Kamp.Fn gctl_get_handle "void"
935e5bfe77SPoul-Henning Kamp.Ft void
945e5bfe77SPoul-Henning Kamp.Fn gctl_ro_param "struct gctl_req *req" "const char *name" "int len" "const void *value"
955e5bfe77SPoul-Henning Kamp.Ft void
965e5bfe77SPoul-Henning Kamp.Fn gctl_rw_param "struct gctl_req *req" "const char *name" "int len" "void *value"
975e5bfe77SPoul-Henning Kamp.Ft "const char *"
985e5bfe77SPoul-Henning Kamp.Fn gctl_issue "struct gctl_req *req"
995e5bfe77SPoul-Henning Kamp.Ft void
1005e5bfe77SPoul-Henning Kamp.Fn gctl_free "struct gctl_req *req"
1015e5bfe77SPoul-Henning Kamp.Ft void
1025e5bfe77SPoul-Henning Kamp.Fn gctl_dump "struct gctl_req *req" "FILE *f"
103fbda685dSPawel Jakub Dawidek.Ss "Utility Functions"
1043f7047aeSRomain Tartière.Ft "char *"
1053f7047aeSRomain Tartière.Fn geom_getxml void
1063f7047aeSRomain Tartière.Ft int
1073f7047aeSRomain Tartière.Fn geom_xml2tree "struct gmesh *gmp" "char *p"
1083f7047aeSRomain Tartière.Ft int
1093f7047aeSRomain Tartière.Fn geom_gettree "struct gmesh *gmp"
1103f7047aeSRomain Tartière.Ft void
1113f7047aeSRomain Tartière.Fn geom_deletetree "struct gmesh *gmp"
112fbda685dSPawel Jakub Dawidek.Ft int
1139ac6b8aeSPawel Jakub Dawidek.Fn g_open "const char *name" "int dowrite"
114fbda685dSPawel Jakub Dawidek.Ft int
115fbda685dSPawel Jakub Dawidek.Fn g_close "int fd"
116fbda685dSPawel Jakub Dawidek.Ft off_t
117fbda685dSPawel Jakub Dawidek.Fn g_mediasize "int fd"
118fbda685dSPawel Jakub Dawidek.Ft ssize_t
119fbda685dSPawel Jakub Dawidek.Fn g_sectorsize "int fd"
12035daa28fSXin LI.Ft ssize_t
12135daa28fSXin LI.Fn g_stripeoffset "int fd"
12235daa28fSXin LI.Ft ssize_t
12335daa28fSXin LI.Fn g_stripesize "int fd"
124fbda685dSPawel Jakub Dawidek.Ft int
125fbda685dSPawel Jakub Dawidek.Fn g_flush "int fd"
126fbda685dSPawel Jakub Dawidek.Ft int
127fbda685dSPawel Jakub Dawidek.Fn g_delete "int fd" "off_t offset" "off_t length"
12831dff47fSUlf Lilleengen.Ft "char *"
12931dff47fSUlf Lilleengen.Fn g_device_path "const char *devpath"
130fbda685dSPawel Jakub Dawidek.Ft int
131fbda685dSPawel Jakub Dawidek.Fn g_get_ident "int fd" "char *ident" "size_t size"
132fbda685dSPawel Jakub Dawidek.Ft int
133fbda685dSPawel Jakub Dawidek.Fn g_get_name "const char *ident" "char *name" "size_t size"
134fbda685dSPawel Jakub Dawidek.Ft int
1359ac6b8aeSPawel Jakub Dawidek.Fn g_open_by_ident "const char *ident" "int dowrite" "char *name" "size_t size"
13631dff47fSUlf Lilleengen.Ft "char *"
13731dff47fSUlf Lilleengen.Fn g_providername "int fd"
138e13db587SPoul-Henning Kamp.Sh DESCRIPTION
139ace5be68SRuslan ErmilovThe
140ace5be68SRuslan Ermilov.Nm geom
141ace5be68SRuslan Ermilovlibrary contains the official and publicized API for
142e13db587SPoul-Henning Kampinteracting with the GEOM subsystem in the kernel.
143ace5be68SRuslan Ermilov.Ss "Statistics Functions"
144e13db587SPoul-Henning KampGEOM collects statistics data for all consumers and providers, but does
145e13db587SPoul-Henning Kampnot perform any normalization or presentation on the raw data, this is
146cbb0775dSAndrew Thompsonleft as an exercise for user-land presentation utilities.
147e13db587SPoul-Henning Kamp.Pp
148e13db587SPoul-Henning KampThe
1493fe5cc64SAlexey Zelkin.Fn geom_stats_open
150e13db587SPoul-Henning Kampand
1513fe5cc64SAlexey Zelkin.Fn geom_stats_close
152ace5be68SRuslan Ermilovfunctions open and close the necessary pathways to access the raw
153ace5be68SRuslan Ermilovstatistics information in the kernel.
154ace5be68SRuslan ErmilovThese functions are likely to
155e13db587SPoul-Henning Kampopen one or more files and cache the file descriptors locally.
156b160a51eSPhilippe CharnierThe
1573fe5cc64SAlexey Zelkin.Fn geom_stats_open
158b160a51eSPhilippe Charnierfunction returns zero on success, and sets
159ace5be68SRuslan Ermilov.Va errno
160ace5be68SRuslan Ermilovif not.
161e13db587SPoul-Henning Kamp.Pp
162e13db587SPoul-Henning KampThe
1633fe5cc64SAlexey Zelkin.Fn geom_stats_resync
164e13db587SPoul-Henning Kampfunction will check if more statistics collection points have been
165e13db587SPoul-Henning Kampadded in the kernel since
1663fe5cc64SAlexey Zelkin.Fn geom_stats_open
167e13db587SPoul-Henning Kampor the previous call to
1683fe5cc64SAlexey Zelkin.Fn geom_stats_resync .
169e13db587SPoul-Henning Kamp.Pp
170ace5be68SRuslan ErmilovThe
1713fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_get
172ace5be68SRuslan Ermilovfunction
173ace5be68SRuslan Ermilovwill acquire a snapshot of the raw data from the kernel, and while a
174e13db587SPoul-Henning Kampreasonable effort is made to make this snapshot as atomic and consistent
175e13db587SPoul-Henning Kampas possible, no guarantee is given that it will actually be so.
176e13db587SPoul-Henning KampThe snapshot must be freed again using the
1773fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_free
178e13db587SPoul-Henning Kampfunction.
179b160a51eSPhilippe CharnierThe
1803fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_get
181b160a51eSPhilippe Charnierfunction returns
182ace5be68SRuslan Ermilov.Dv NULL
183ace5be68SRuslan Ermilovon failure.
184e13db587SPoul-Henning Kamp.Pp
185ace5be68SRuslan ErmilovThe
1863fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_timestamp
187ace5be68SRuslan Ermilovfunction
188ace5be68SRuslan Ermilovprovides access to the timestamp acquired in the snapshot.
189e13db587SPoul-Henning Kamp.Pp
190ace5be68SRuslan ErmilovThe
1913fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_reset
192e13db587SPoul-Henning Kampand
1933fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_next
194ace5be68SRuslan Ermilovfunctions
195ace5be68SRuslan Ermilovprovide an iterator over the statistics slots in the snapshot.
196ace5be68SRuslan ErmilovThe
1973fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_reset
198ace5be68SRuslan Ermilovfunction
199e13db587SPoul-Henning Kampforces the internal pointer in the snapshot back to before the first item.
200ace5be68SRuslan ErmilovThe
2013fe5cc64SAlexey Zelkin.Fn geom_stats_snapshot_next
202ace5be68SRuslan Ermilovfunction
203ace5be68SRuslan Ermilovreturns the next item, and
204ace5be68SRuslan Ermilov.Dv NULL
205ace5be68SRuslan Ermilovif there are no more items in the snapshot.
2065e5bfe77SPoul-Henning Kamp.Ss "Control Functions"
2075e5bfe77SPoul-Henning KampThe
2085e5bfe77SPoul-Henning Kamp.Fn gctl_*
209862b46f6SRuslan Ermilovfunctions are used to send requests to GEOM classes.
210862b46f6SRuslan ErmilovIn order for a GEOM
2115e5bfe77SPoul-Henning Kampclass to actually be able to receive these requests, it must have defined a
2125e5bfe77SPoul-Henning Kamp"ctlreq" method.
2135e5bfe77SPoul-Henning Kamp.Pp
2145e5bfe77SPoul-Henning KampA
215862b46f6SRuslan Ermilov.Vt "struct gctl_req *" ,
2165e5bfe77SPoul-Henning Kampobtained with
2175e5bfe77SPoul-Henning Kamp.Fn gctl_get_handle ,
2185e5bfe77SPoul-Henning Kampcan hold any number of parameters, which must be added to it with
2195e5bfe77SPoul-Henning Kamp.Fn gctl_ro_param
2205e5bfe77SPoul-Henning Kamp(for read-only parameters) or
2215e5bfe77SPoul-Henning Kamp.Fn gctl_rw_param
2225e5bfe77SPoul-Henning Kamp(for read/write parameters).
2235e5bfe77SPoul-Henning Kamp.Pp
2245e5bfe77SPoul-Henning KampBoth
2255e5bfe77SPoul-Henning Kamp.Fn gctl_ro_param
2265e5bfe77SPoul-Henning Kampand
2275e5bfe77SPoul-Henning Kamp.Fn gctl_rw_param
2285e5bfe77SPoul-Henning Kamptake a string
229862b46f6SRuslan Ermilov.Fa name ,
2305e5bfe77SPoul-Henning Kampwhich is used to identify the parameter, and a
231862b46f6SRuslan Ermilov.Fa value ,
232862b46f6SRuslan Ermilovwhich contains, in the read-only case, the data to be passed to the
233862b46f6SRuslan ErmilovGEOM class, or, in the read/write case, a pointer to preallocated memory
234862b46f6SRuslan Ermilovthat the GEOM class should fill with the desired data.
235862b46f6SRuslan ErmilovIf
236862b46f6SRuslan Ermilov.Fa len
2375e5bfe77SPoul-Henning Kampis negative, it is assumed that
238862b46f6SRuslan Ermilov.Fa value
239862b46f6SRuslan Ermilovis an
240862b46f6SRuslan Ermilov.Tn ASCII
241862b46f6SRuslan Ermilovstring and the actual length is taken from the string length of
242862b46f6SRuslan Ermilov.Fa value ;
2435e5bfe77SPoul-Henning Kampotherwise it must hold the size of
244862b46f6SRuslan Ermilov.Fa value .
2455e5bfe77SPoul-Henning Kamp.Pp
2465e5bfe77SPoul-Henning KampA parameter with a
247862b46f6SRuslan Ermilov.Fa name
248862b46f6SRuslan Ermilovcontaining the string
249862b46f6SRuslan Ermilov.Qq Li class
250862b46f6SRuslan Ermilovis mandatory for each request, and the
2515e5bfe77SPoul-Henning Kampcorresponding
252862b46f6SRuslan Ermilov.Fa value
2535e5bfe77SPoul-Henning Kampmust hold the name of the GEOM class where the request should be sent to.
2545e5bfe77SPoul-Henning Kamp.Pp
2555e5bfe77SPoul-Henning KampAlso mandatory for each request is a parameter with a
256862b46f6SRuslan Ermilov.Fa name
257862b46f6SRuslan Ermilovcalled
258862b46f6SRuslan Ermilov.Qq Li verb ,
259862b46f6SRuslan Ermilovand the corresponding
260862b46f6SRuslan Ermilov.Fa value
2615e5bfe77SPoul-Henning Kampneeds to hold the command string that the GEOM class should react upon.
2625e5bfe77SPoul-Henning Kamp.Pp
2635e5bfe77SPoul-Henning KampOnce all desired parameters are filled in, the request must be sent to
2645e5bfe77SPoul-Henning Kampthe GEOM subsystem with
2655e5bfe77SPoul-Henning Kamp.Fn gctl_issue ,
266862b46f6SRuslan Ermilovwhich returns
267862b46f6SRuslan Ermilov.Dv NULL
268862b46f6SRuslan Ermilovon success, or a string containing the error message
2695e5bfe77SPoul-Henning Kampon failure.
2705e5bfe77SPoul-Henning Kamp.Pp
2715e5bfe77SPoul-Henning KampAfter the request is finished, the allocated memory should be released with
2725e5bfe77SPoul-Henning Kamp.Fn gctl_free .
2735e5bfe77SPoul-Henning Kamp.Pp
274862b46f6SRuslan ErmilovThe
2755e5bfe77SPoul-Henning Kamp.Fn gctl_dump
276862b46f6SRuslan Ermilovfunction
2775e5bfe77SPoul-Henning Kampcan be used to format the contents of
278862b46f6SRuslan Ermilov.Fa req
2795e5bfe77SPoul-Henning Kampto the open file handle pointed to by
280862b46f6SRuslan Ermilov.Fa f ,
2815e5bfe77SPoul-Henning Kampfor debugging purposes.
2825e5bfe77SPoul-Henning Kamp.Pp
2835e5bfe77SPoul-Henning KampError handling for the control functions is postponed until the call
2845e5bfe77SPoul-Henning Kampto
285862b46f6SRuslan Ermilov.Fn gctl_issue ,
286862b46f6SRuslan Ermilovwhich returns
287862b46f6SRuslan Ermilov.Dv NULL
288862b46f6SRuslan Ermilovon success, or an error message corresponding to the
2895e5bfe77SPoul-Henning Kampfirst error which happened.
290fbda685dSPawel Jakub Dawidek.Ss "Utility Functions"
291fbda685dSPawel Jakub DawidekThe
2923f7047aeSRomain Tartière.Fn geom_getxml
2933f7047aeSRomain Tartièrefunction is a wrapper around
2943f7047aeSRomain Tartière.Xr sysctl 3
2953f7047aeSRomain Tartièrethat fetches the
2963f7047aeSRomain Tartière.Ar kern.geom.confxml
2973f7047aeSRomain TartièreOID, and returns it's value.
2983f7047aeSRomain TartièreThe allocated memory should be released with
299*25c54b84SJens Schweikhardt.Xr free 3
3003f7047aeSRomain Tartièreafter use.
3013f7047aeSRomain Tartière.Pp
3023f7047aeSRomain TartièreThe
3033f7047aeSRomain Tartière.Fn geom_xml2tree
3043f7047aeSRomain Tartièrefunction parses the XML representation of a GEOM topology passed as
3053f7047aeSRomain Tartière.Ar p ,
3063f7047aeSRomain Tartièreallocates the needed data structures to access this information and fills in
3073f7047aeSRomain Tartièrethe passed
3083f7047aeSRomain Tartière.Ar gmp
3093f7047aeSRomain Tartièredata structure.
3103f7047aeSRomain TartièreMemory allocated during this transformation should be released
3113f7047aeSRomain Tartièreusing
3123f7047aeSRomain Tartière.Fn geom_deletetree
3133f7047aeSRomain Tartièreafter use.
3143f7047aeSRomain Tartière.Pp
3153f7047aeSRomain TartièreThe
3163f7047aeSRomain Tartière.Fn geom_gettree
3173f7047aeSRomain Tartièrefunction is a wrapper around the
3183f7047aeSRomain Tartière.Fn geom_getxml
3193f7047aeSRomain Tartièreand
3203f7047aeSRomain Tartière.Fn geom_xml2tree
3213f7047aeSRomain Tartièrefunctions.
3223f7047aeSRomain TartièreMemory allocated during this operation should be released using
3233f7047aeSRomain Tartière.Fn geom_deletetree
3243f7047aeSRomain Tartièreafter use.
3253f7047aeSRomain Tartière.Pp
3263f7047aeSRomain TartièreThe
3273f7047aeSRomain Tartière.Fn geom_deletetree
3283f7047aeSRomain Tartièrefunction releases memory allocated for storing the data-structures referenced by
3293f7047aeSRomain Tartière.Ar gmp .
3303f7047aeSRomain Tartière.Pp
3313f7047aeSRomain TartièreThe
332fbda685dSPawel Jakub Dawidek.Fn g_*
333fbda685dSPawel Jakub Dawidekfunctions are used to communicate with GEOM providers.
334fbda685dSPawel Jakub Dawidek.Pp
335fbda685dSPawel Jakub DawidekThe
336fbda685dSPawel Jakub Dawidek.Fn g_open
337fbda685dSPawel Jakub Dawidekfunction opens the given provider and returns file descriptor number, which can
338fbda685dSPawel Jakub Dawidekbe used with other functions.
339fbda685dSPawel Jakub DawidekThe
3409ac6b8aeSPawel Jakub Dawidek.Fa dowrite
341fbda685dSPawel Jakub Dawidekargument indicates if operations that modify the provider (like
342fbda685dSPawel Jakub Dawidek.Fn g_flush
343fbda685dSPawel Jakub Dawidekor
344fbda685dSPawel Jakub Dawidek.Fn g_delete )
345fbda685dSPawel Jakub Dawidekare going to be called.
346fbda685dSPawel Jakub Dawidek.Pp
347fbda685dSPawel Jakub DawidekThe
348fbda685dSPawel Jakub Dawidek.Fn g_close
349fbda685dSPawel Jakub Dawidekfunction closes the provider.
350fbda685dSPawel Jakub Dawidek.Pp
351fbda685dSPawel Jakub DawidekThe
352fbda685dSPawel Jakub Dawidek.Fn g_mediasize
353fbda685dSPawel Jakub Dawidekfunction returns size of the given provider.
354fbda685dSPawel Jakub Dawidek.Pp
355fbda685dSPawel Jakub DawidekThe
356fbda685dSPawel Jakub Dawidek.Fn g_sectorsize
357fbda685dSPawel Jakub Dawidekfunction returns sector size of the given provider.
358fbda685dSPawel Jakub Dawidek.Pp
359fbda685dSPawel Jakub DawidekThe
36035daa28fSXin LI.Fn g_stripeoffset
3611750e4f8SXin LIfunction returns stripe offset of the given provider.
36235daa28fSXin LI.Pp
36335daa28fSXin LIThe
36435daa28fSXin LI.Fn g_stripesize
36535daa28fSXin LIfunction returns stripe size of the given provider.
36635daa28fSXin LI.Pp
36735daa28fSXin LIThe
368fbda685dSPawel Jakub Dawidek.Fn g_flush
369fbda685dSPawel Jakub Dawidekfunction sends
370fbda685dSPawel Jakub Dawidek.Dv BIO_FLUSH
371fbda685dSPawel Jakub Dawidekrequest to flush write cache of the provider.
372fbda685dSPawel Jakub Dawidek.Pp
373fbda685dSPawel Jakub DawidekThe
374fbda685dSPawel Jakub Dawidek.Fn g_delete
375fbda685dSPawel Jakub Dawidekfunction tells the provider that the given data range is no longer used.
376fbda685dSPawel Jakub Dawidek.Pp
377fbda685dSPawel Jakub DawidekThe
37831dff47fSUlf Lilleengen.Fn g_device_path
37931dff47fSUlf Lilleengenfunction returns the full path to a provider given a partial or full path to the
38031dff47fSUlf Lilleengendevice node.
381ef8f85c6SEnji Cooper.Dv NULL
382ef8f85c6SEnji Cooperis returned if the device cannot be found or is not a valid geom provider.
38331dff47fSUlf Lilleengen.Pp
38431dff47fSUlf LilleengenThe
385fbda685dSPawel Jakub Dawidek.Fn g_get_ident
386fbda685dSPawel Jakub Dawidekfunction returns provider's fixed and unique identifier.
387fbda685dSPawel Jakub DawidekThe
388fbda685dSPawel Jakub Dawidek.Fa ident
389fbda685dSPawel Jakub Dawidekargument should be at least
390fbda685dSPawel Jakub Dawidek.Dv DISK_IDENT_SIZE
391fbda685dSPawel Jakub Dawidekbig.
392fbda685dSPawel Jakub Dawidek.Pp
393fbda685dSPawel Jakub DawidekThe
394fbda685dSPawel Jakub Dawidek.Fn g_get_name
395fbda685dSPawel Jakub Dawidekfunction returns name of the provider, which identifier is equal to the
396fbda685dSPawel Jakub Dawidek.Fa ident
397fbda685dSPawel Jakub Dawidekstring.
398fbda685dSPawel Jakub Dawidek.Pp
399fbda685dSPawel Jakub DawidekThe
400fbda685dSPawel Jakub Dawidek.Fn g_open_by_ident
401ef8f85c6SEnji Cooperfunction opens provider using its identification, unlike
402fbda685dSPawel Jakub Dawidek.Fn g_open
403ef8f85c6SEnji Cooperwhich uses the provider's name.
404ef8f85c6SEnji CooperThe function will store the provider's name in the
405fbda685dSPawel Jakub Dawidek.Fa name
406ef8f85c6SEnji Cooperparameter if it is not
407ef8f85c6SEnji Cooper.Dv NULL .
408fbda685dSPawel Jakub Dawidek.Pp
40931dff47fSUlf LilleengenThe
41031dff47fSUlf Lilleengen.Fn g_providername
41131dff47fSUlf Lilleengenfunction returns the provider name of an open file descriptor.
412ef8f85c6SEnji Cooper.Dv NULL
413ef8f85c6SEnji Cooperis returned the file descriptor does not point to a valid geom provider.
41431dff47fSUlf Lilleengen.Pp
41531dff47fSUlf LilleengenAll functions except
41631dff47fSUlf Lilleengen.Fn g_providername
41731dff47fSUlf Lilleengenand
41831dff47fSUlf Lilleengen.Fn g_device_path
41931dff47fSUlf Lilleengenreturn a value greater than or equal to
420fbda685dSPawel Jakub Dawidek.Va 0
421fbda685dSPawel Jakub Dawidekon success or
422fbda685dSPawel Jakub Dawidek.Va -1
423fbda685dSPawel Jakub Dawidekon failure.
4245e5bfe77SPoul-Henning Kamp.Sh EXAMPLES
425862b46f6SRuslan ErmilovCreate a request that is to be sent to the CCD class, and tell
4265e5bfe77SPoul-Henning Kampit to destroy a specific geom:
4275e5bfe77SPoul-Henning Kamp.Bd -literal -offset indent
4285e5bfe77SPoul-Henning KampH = gctl_get_handle();
4295e5bfe77SPoul-Henning Kampgctl_ro_param(H, "verb", -1, "destroy geom");
4305e5bfe77SPoul-Henning Kampgctl_ro_param(H, "class", -1, "CCD");
4315e5bfe77SPoul-Henning Kampsprintf(buf, "ccd%d", ccd);
4325e5bfe77SPoul-Henning Kampgctl_ro_param(H, "geom", -1, buf);
4335e5bfe77SPoul-Henning Kamperrstr = gctl_issue(H);
4345e5bfe77SPoul-Henning Kampif (errstr != NULL)
435862b46f6SRuslan Ermilov    err(1, "could not destroy ccd: %s", errstr);
4365e5bfe77SPoul-Henning Kampgctl_free(H);
4375e5bfe77SPoul-Henning Kamp.Ed
438e13db587SPoul-Henning Kamp.Sh HISTORY
439ace5be68SRuslan ErmilovThe
440e13db587SPoul-Henning Kamp.Nm geom
441ace5be68SRuslan Ermilovlibrary appeared in
442e13db587SPoul-Henning Kamp.Fx 5.1 .
4435e5bfe77SPoul-Henning Kamp.Sh AUTHORS
4442b7af31cSBaptiste Daroussin.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org
4452b7af31cSBaptiste Daroussin.An Lukas Ertl Aq Mt le@FreeBSD.org
4462b7af31cSBaptiste Daroussin.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org
447