g_provider.9 (127374) | g_provider.9 (129381) |
---|---|
1.\" 2.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 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. 24.\" | 1.\" 2.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 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. 24.\" |
25.\" $FreeBSD: head/share/man/man9/g_provider.9 127374 2004-03-24 15:12:17Z pjd $ | 25.\" $FreeBSD: head/share/man/man9/g_provider.9 129381 2004-05-18 11:33:37Z le $ |
26.\" 27.Dd January 16, 2004 28.Dt g_provider 9 29.Os 30.Sh NAME 31.Nm g_new_providerf , 32.Nm g_destroy_provider , 33.Nm g_error_provider 34.Nd "GEOM providers management" 35.Sh SYNOPSIS 36.In geom/geom.h 37.Ft "struct g_provider *" 38.Fn g_new_providerf "struct g_geom *gp" "const char *fmt" ... 39.Ft void 40.Fn g_destroy_provider "struct g_provider *pp" 41.Ft void 42.Fn g_error_provider "struct g_provider *pp" "int error" 43.Sh DESCRIPTION | 26.\" 27.Dd January 16, 2004 28.Dt g_provider 9 29.Os 30.Sh NAME 31.Nm g_new_providerf , 32.Nm g_destroy_provider , 33.Nm g_error_provider 34.Nd "GEOM providers management" 35.Sh SYNOPSIS 36.In geom/geom.h 37.Ft "struct g_provider *" 38.Fn g_new_providerf "struct g_geom *gp" "const char *fmt" ... 39.Ft void 40.Fn g_destroy_provider "struct g_provider *pp" 41.Ft void 42.Fn g_error_provider "struct g_provider *pp" "int error" 43.Sh DESCRIPTION |
44The GEOM provider is the front gate at which a geom offers service. | 44A GEOM provider is the front gate at which a geom offers service. |
45A provider is 46.Dq a disk\-like thing which appears in Pa /dev 47\- a logical disk in other words. 48All providers have three main properties: name, sectorsize and size. 49.Pp 50The 51.Fn g_new_providerf | 45A provider is 46.Dq a disk\-like thing which appears in Pa /dev 47\- a logical disk in other words. 48All providers have three main properties: name, sectorsize and size. 49.Pp 50The 51.Fn g_new_providerf |
52function creates a new provider and attaches it to geom | 52function creates a new provider on given geom |
53.Fa gp . | 53.Fa gp . |
54The provider name is created in a printf\-like way from the rest of | 54The name of the provider, which will appear as device in devfs, is created 55in a printf\-like way from the rest of |
55the arguments. | 56the arguments. |
56After creation, the provider is unusable, because 57.Fn g_new_providerf 58sets its error to 59.Er ENXIO . 60The function 61.Fn g_error_provider 62should be used to reset this error, but before it is called, two 63fields should be set in the provider structure: | 57After creation, the caller has to set the provider's |
64.Va mediasize 65and | 58.Va mediasize 59and |
66.Va sectorsize 67as well as other initialization things should be done first. | 60.Va sectorsize , 61as well as other desired initializations, and then call 62.Fn g_error_provider 63to reset the provider's error, which is initially set to 64.Er ENXIO . |
68.Pp 69The 70.Fn g_destroy_provider 71function destroys the given provider, cancels all related pending events and | 65.Pp 66The 67.Fn g_destroy_provider 68function destroys the given provider, cancels all related pending events and |
72removes corresponding devfs entry. | 69removes the corresponding devfs entry. |
73.Pp 74The 75.Fn g_error_provider | 70.Pp 71The 72.Fn g_error_provider |
76function is used to set a provider error value. 77If it set to a nonzero value, all I/O requests will be denied, 78increasing its access count will not be possible (error | 73function is used to set the provider's error value. 74If set to a nonzero, all I/O requests will be denied, 75as well as increasing its access count will not be possible (error |
79.Fa error 80will be returned). 81.Sh RESTRICTIONS/CONDITIONS 82.Fn g_new_provider : 83.Bl -item -offset indent 84.It 85The provider name should be unique, but this is not enforced by GEOM. 86If the name is not unique, one will end up with two (or more) files | 76.Fa error 77will be returned). 78.Sh RESTRICTIONS/CONDITIONS 79.Fn g_new_provider : 80.Bl -item -offset indent 81.It 82The provider name should be unique, but this is not enforced by GEOM. 83If the name is not unique, one will end up with two (or more) files |
87with the same name, which is programmer error. | 84with the same name, which is a programmer error. |
88.It | 85.It |
89The geom related to the created provider must have | 86The geom 87.Fa gp 88has to have a |
90.Fa start | 89.Fa start |
91field defined. | 90method defined. |
92.It 93The topology lock has to be held. 94.El 95.Pp 96.Fn g_destroy_provider : 97.Bl -item -offset indent 98.It | 91.It 92The topology lock has to be held. 93.El 94.Pp 95.Fn g_destroy_provider : 96.Bl -item -offset indent 97.It |
99No consumers have to be attached. | 98The provider must not have consumers attached. |
100.It 101The access count has to be 0. 102.It 103The topology lock has to be held. 104.El 105.Sh RETURN VALUES | 99.It 100The access count has to be 0. 101.It 102The topology lock has to be held. 103.El 104.Sh RETURN VALUES |
105The |
|
106.Fn g_new_providerf | 106.Fn g_new_providerf |
107returns a pointer to the newly created provider. | 107function returns a pointer to the newly created provider. |
108.Sh EXAMPLES 109Create an example provider, set its parameters and make it usable. 110.Bd -literal -offset indent 111struct g_provider * 112create_example_provider(struct g_geom *gp) 113{ 114 struct g_provider *pp; 115 --- 26 unchanged lines hidden --- | 108.Sh EXAMPLES 109Create an example provider, set its parameters and make it usable. 110.Bd -literal -offset indent 111struct g_provider * 112create_example_provider(struct g_geom *gp) 113{ 114 struct g_provider *pp; 115 --- 26 unchanged lines hidden --- |