freebsd-skq/share/man/man9/g_wither_geom.9
pjd dbc7255199 Added first part of GEOM kernel API manuals pages.
Documented function and macros are:
	- DECLARE_GEOM_CLASS(),
	- g_attach(),
	- g_detach(),
	- g_new_bio(),
	- g_clone_bio(),
	- g_destroy_bio(),
	- g_new_consumer(),
	- g_destroy_consumer(),
	- g_read_data(),
	- g_write_data(),
	- g_post_event(),
	- g_waitfor_event(),
	- g_cancel_event(),
	- g_new_geomf(),
	- g_destroy_geom(),
	- g_new_providerf(),
	- g_destroy_provider(),
	- g_error_provider(),
	- g_provider_by_name(),
	- g_wither_geom().
and more to come.

I want to thanks following people for help with those documents:
	Slawek Zak <zaks@prioris.mini.pw.edu.pl>
	Simon L. Nielsen <simon@FreeBSD.org>
	Pieter de Boer <g.p.de.boer@st.hanze.nl>
and of course
	Poul-Henning Kamp <phk@FreeBSD.org>

Reviewed by:	phk, scottl
Approved by:	phk, scottl (mentor)
2004-02-11 10:06:18 +00:00

86 lines
2.9 KiB
Groff

.\"
.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 16, 2004
.Dt g_wither_geom 9
.Os
.Sh NAME
.Nm g_wither_geom
.Nd "destroy geom and releated providers and consumers when you get a chance"
.Sh SYNOPSIS
.In geom/geom.h
.Ft void
.Fn g_wither_geom "struct g_geom *gp" "int error"
.Sh DESCRIPTION
The
.Fn g_wither_geom
function tells GEOM that geom
.Fa gp
is to be destroyed.
GEOM sets an error for every provider related to the given geom (in
orphan process) and waits for a chance to destroy the geom.
If access count of any possessed consumer goes to 0, consumer will be
detached and destroyed automatically.
If last consumer attached to any possesed provider will be detached,
provider will be destroyed.
If there are no more providers nor consumers, the geom will be
destroyed.
.Pp
This is an automatic
.Dq garbage collect
to avoid duplicated code in all classes.
Before it is called, field
.Va softc
should be disposed off and set to
.Dv NULL .
Note that the
.Fn g_wither_geom
function gives no guarantee that geom will be immediately destroyed, mostly
because access counts of corresponding consumers and providers may not be 0.
That is why calling this function for every geom from given class is not enough
to be sure that class can be unloaded.
.Sh RESTRICTIONS/CONDITIONS
The argument
.Fa error
must be nonzero.
.Pp
The topology lock has to be held.
.Sh SEE ALSO
.Xr DECLARE_GEOM_CLASS 9 ,
.Xr geom 4 ,
.Xr g_attach 9 ,
.Xr g_bio 9 ,
.Xr g_consumer 9 ,
.Xr g_data 9 ,
.Xr g_event 9 ,
.Xr g_geom 9 ,
.Xr g_provider 9 ,
.Xr g_provider_by_name 9
.Sh AUTHORS
.An -nosplit
This manual page was written by
.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .