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.
32 .Nm g_destroy_provider ,
34 .Nd "GEOM providers management"
37 .Ft "struct g_provider *"
38 .Fn g_new_providerf "struct g_geom *gp" "const char *fmt" ...
40 .Fn g_destroy_provider "struct g_provider *pp"
42 .Fn g_error_provider "struct g_provider *pp" "int error"
44 A GEOM provider is the front gate at which a geom offers service.
46 .Dq a disk-like thing which appears in Pa /dev
47 \[en] a logical disk in other words.
48 All providers have three main properties: name, sectorsize and size.
52 function creates a new provider on given geom
54 The name of the provider, which will appear as device in
59 -like way from the rest of
61 After creation, the caller has to set the provider's
65 as well as other desired initializations, and then call
67 to reset the provider's error, which is initially set to
71 .Fn g_destroy_provider
72 function destroys the given provider, cancels all related pending events and
73 removes the corresponding devfs entry.
77 function is used to set the provider's error value.
78 If set to a nonzero, all I/O requests will be denied,
79 as well as increasing its access count will not be possible (error
82 .Sh RESTRICTIONS/CONDITIONS
84 .Bl -item -offset indent
86 The provider name should be unique, but this is not enforced by GEOM.
87 If the name is not unique, one will end up with two (or more) files
88 with the same name, which is a programmer error.
96 The topology lock has to be held.
99 .Fn g_destroy_provider :
100 .Bl -item -offset indent
102 The provider must not have consumers attached.
104 The access count has to be 0.
106 The topology lock has to be held.
111 function returns a pointer to the newly created provider.
113 Create an example provider, set its parameters and make it usable.
114 .Bd -literal -offset indent
116 create_example_provider(struct g_geom *gp)
118 struct g_provider *pp;
121 pp = g_new_providerf(gp, "example_provider");
123 pp->mediasize = 65536;
124 pp->sectorsize = 512;
125 g_error_provider(pp, 0);
132 .Xr DECLARE_GEOM_CLASS 9 ,
140 .Xr g_provider_by_name 9 ,
144 This manual page was written by
145 .An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .