xref: /freebsd/share/man/man9/g_wither_geom.9 (revision 315ee00f)
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
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.
13.\"
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.
24.\"
25.Dd January 16, 2004
26.Dt G_WITHER_GEOM 9
27.Os
28.Sh NAME
29.Nm g_wither_geom
30.Nd "destroy geom and related providers and consumers when you get a chance"
31.Sh SYNOPSIS
32.In geom/geom.h
33.Ft void
34.Fn g_wither_geom "struct g_geom *gp" "int error"
35.Sh DESCRIPTION
36The
37.Fn g_wither_geom
38function tells GEOM that geom
39.Fa gp
40is to be destroyed.
41GEOM sets an error on each provider of the given geom (in the
42orphaning process) and waits for a chance to destroy the geom.
43If the access count of any possessed consumer goes to 0, the consumer will be
44detached and destroyed automatically.
45If the last consumer attached to any possessed provider will be detached,
46the provider will be destroyed.
47If there are no more providers nor consumers, the geom will be
48destroyed.
49.Pp
50This is an automatic
51.Dq garbage collect
52to avoid duplicated code in all classes.
53Before it is called, field
54.Va softc
55should be disposed of and set to
56.Dv NULL .
57Note that the
58.Fn g_wither_geom
59function gives no guarantee that the geom will be immediately destroyed, mostly
60because the access counts of the geom's consumers and providers may not be 0.
61That is why calling this function for every geom from a given class is not enough
62to be sure that the class can be unloaded.
63.Sh RESTRICTIONS/CONDITIONS
64The argument
65.Fa error
66must be nonzero.
67.Pp
68The topology lock has to be held.
69.Sh SEE ALSO
70.Xr geom 4 ,
71.Xr DECLARE_GEOM_CLASS 9 ,
72.Xr g_access 9 ,
73.Xr g_attach 9 ,
74.Xr g_bio 9 ,
75.Xr g_consumer 9 ,
76.Xr g_data 9 ,
77.Xr g_event 9 ,
78.Xr g_geom 9 ,
79.Xr g_provider 9 ,
80.Xr g_provider_by_name 9
81.Sh AUTHORS
82.An -nosplit
83This manual page was written by
84.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .
85