g_consumer.9 (126861) | g_consumer.9 (127371) |
---|---|
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_consumer.9 126861 2004-03-11 19:53:22Z pjd $ | 25.\" $FreeBSD: head/share/man/man9/g_consumer.9 127371 2004-03-24 14:25:46Z pjd $ |
26.\" 27.Dd January 16, 2004 28.Dt g_consumer 9 29.Os 30.Sh NAME 31.Nm g_new_consumer , 32.Nm g_destroy_consumer 33.Nd "GEOM consumers management" --- 42 unchanged lines hidden (view full) --- 76The consumer can not be attached. 77.It 78The access count has to be 0. 79.It 80The topology lock has to be held. 81.El 82.Sh RETURN VALUES 83.Fn g_new_consumer | 26.\" 27.Dd January 16, 2004 28.Dt g_consumer 9 29.Os 30.Sh NAME 31.Nm g_new_consumer , 32.Nm g_destroy_consumer 33.Nd "GEOM consumers management" --- 42 unchanged lines hidden (view full) --- 76The consumer can not be attached. 77.It 78The access count has to be 0. 79.It 80The topology lock has to be held. 81.El 82.Sh RETURN VALUES 83.Fn g_new_consumer |
84returns a pointer to the newly created consumer or 85.Dv NULL 86if an error occured. | 84returns a pointer to the newly created consumer. |
87.Sh EXAMPLES 88Create consumer, attach it to given provider, gain read access and clean up. 89.Bd -literal -offset indent 90void 91some_function(struct g_geom *mygeom, struct g_provider *pp) 92{ 93 struct g_consumer *cp; 94 95 g_topology_assert(); 96 97 /* Create new consumer on 'mygeom' geom. */ 98 cp = g_new_consumer(mygeom); | 85.Sh EXAMPLES 86Create consumer, attach it to given provider, gain read access and clean up. 87.Bd -literal -offset indent 88void 89some_function(struct g_geom *mygeom, struct g_provider *pp) 90{ 91 struct g_consumer *cp; 92 93 g_topology_assert(); 94 95 /* Create new consumer on 'mygeom' geom. */ 96 cp = g_new_consumer(mygeom); |
99 if (cp == NULL) 100 return; | |
101 /* Attach newly created consumer to given provider. */ 102 if (g_attach(cp, pp) != 0) { 103 g_destroy_consumer(cp); 104 return; 105 } 106 /* Open provider for reading through our consumer. */ 107 if (g_access(cp, 1, 0, 0) != 0) { 108 g_detach(cp); --- 34 unchanged lines hidden --- | 97 /* Attach newly created consumer to given provider. */ 98 if (g_attach(cp, pp) != 0) { 99 g_destroy_consumer(cp); 100 return; 101 } 102 /* Open provider for reading through our consumer. */ 103 if (g_access(cp, 1, 0, 0) != 0) { 104 g_detach(cp); --- 34 unchanged lines hidden --- |