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