Deleted Added
full compact
g_attach.9 (127371) g_attach.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_attach.9 127371 2004-03-24 14:25:46Z pjd $
25.\" $FreeBSD: head/share/man/man9/g_attach.9 129381 2004-05-18 11:33:37Z le $
26.\"
27.Dd January 16, 2004
28.Dt g_attach 9
29.Os
30.Sh NAME
31.Nm g_attach ,
32.Nm g_detach
26.\"
27.Dd January 16, 2004
28.Dt g_attach 9
29.Os
30.Sh NAME
31.Nm g_attach ,
32.Nm g_detach
33.Nd "attach/detach consumer to/from provider"
33.Nd "attach/detach GEOM consumers to/from providers"
34.Sh SYNOPSIS
35.In geom/geom.h
36.Ft int
37.Fn g_attach "struct g_consumer *cp" "struct g_provider *pp"
38.Ft void
39.Fn g_detach "struct g_consumer *cp"
40.Sh DESCRIPTION
41The
42.Fn g_attach
34.Sh SYNOPSIS
35.In geom/geom.h
36.Ft int
37.Fn g_attach "struct g_consumer *cp" "struct g_provider *pp"
38.Ft void
39.Fn g_detach "struct g_consumer *cp"
40.Sh DESCRIPTION
41The
42.Fn g_attach
43function attaches given consumer to given provider.
44For real provider access (ie. I/O operations), one still need to call the
45.Fn g_access
46function on consumer to gain access to attached provider.
43function attaches given consumer
44.Fa cp
45to given provider
46.Fa pp ,
47thus establishing a communication channel between the consumer and the
48provider that allows to change access counts or perform I/O operations.
47.Pp
48The
49.Fn g_detach
49.Pp
50The
51.Fn g_detach
50function detaches the given consumer from the corresponding provider.
51This function is used when we do not want to communicate with the
52provider anymore.
52function detaches given consumer
53.Fa cp
54from its corresponding provider, tearing down the communication channel
55between them.
53.Sh RESTRICTIONS/CONDITIONS
54.Fn g_attach :
55.Bl -item -offset indent
56.It
56.Sh RESTRICTIONS/CONDITIONS
57.Fn g_attach :
58.Bl -item -offset indent
59.It
57The consumer can not be attached already.
60The consumer must not be attached to a provider.
58.It
61.It
59The operation should not create a topology loop.
62The operation must not create a topology loop.
60.It
61The topology lock has to be held.
62.El
63.Pp
64.Fn g_detach :
65.Bl -item -offset indent
66.It
67The consumer has to be attached.
68.It
69The access count has to be 0.
70.It
71There must be no active requests.
72.It
73The topology lock has to be held.
74.El
75.Sh RETURN VALUES
63.It
64The topology lock has to be held.
65.El
66.Pp
67.Fn g_detach :
68.Bl -item -offset indent
69.It
70The consumer has to be attached.
71.It
72The access count has to be 0.
73.It
74There must be no active requests.
75.It
76The topology lock has to be held.
77.El
78.Sh RETURN VALUES
79The
76.Fn g_attach
80.Fn g_attach
77returns the value 0 if successful; otherwise an error code is returned.
81function returns 0 if successful; otherwise an error code is returned.
78.Sh ERRORS
79Possible errors:
80.Bl -tag -width Er
81.It Bq Er ELOOP
82The operation creates a topology loop.
83.El
84.Sh EXAMPLES
82.Sh ERRORS
83Possible errors:
84.Bl -tag -width Er
85.It Bq Er ELOOP
86The operation creates a topology loop.
87.El
88.Sh EXAMPLES
85Create consumer, attach it to given provider, gain read access and clean up.
89Create a consumer, attach it to a given provider, gain read access and clean up.
86.Bd -literal -offset indent
87void
88some_function(struct g_geom *mygeom, struct g_provider *pp)
89{
90 struct g_consumer *cp;
91
92 g_topology_assert();
93

--- 44 unchanged lines hidden ---
90.Bd -literal -offset indent
91void
92some_function(struct g_geom *mygeom, struct g_provider *pp)
93{
94 struct g_consumer *cp;
95
96 g_topology_assert();
97

--- 44 unchanged lines hidden ---