G_WITHER_GEOM(9)
π G_WITHER_GEOM(9) π
ok so bestie, welcome to the Kernel Developer's Manual β this one's g_wither_geom, and it's giving "cleanup crew, but make it β¨automaticβ¨". it lives in section 9, iykyk π«Ά
β¨ NAME β¨
g_wither_geom β destroy geom and related providers and consumers when you get a chance π¦
like literally, whenever the universe says it's time. not now. eventually. no cap.
πΈ SYNOPSIS πΈ
#include <geom/geom.h>
void
g_wither_geom(struct g_geom *gp, int error);
π DESCRIPTION π
okay so. the g_wither_geom() function tells GEOM that geom gp is to be destroyed. that's the whole vibe. GEOM sets an error on each provider of the given geom (this happens in the orphaning process, periodt) and then it just⦠waits for a chance to destroy the geom. main character energy tbh, it does not rush.
here's the tea on what happens automatically:
- If the access count of any possessed consumer goes to
0, the consumer will be detached and destroyed automatically. π gone. bye. - If the last consumer attached to any possessed provider will be detached, the provider will be destroyed. β¨
- If there are no more providers nor consumers, the geom will be destroyed. π that's the moment.
this is an automatic βgarbage collectβ to avoid duplicated code in all classes. iconic, honestly. saves everyone from copy-pasting the same sad cleanup logic forty times.
before it is called, fieldsoftcshould be disposed of and set toNULL. π do NOT forget this one bestie, it's a whole thing.
also note that the g_wither_geom() function gives no guarantee that the geom will be immediately destroyed, mostly because the access counts of the geom's consumers and providers may not be 0. π yeah. that's why calling this function for every geom from a given class is not enough to be sure that the class can be unloaded. lowkey humbling but okay.
π RESTRICTIONS/CONDITIONS π
- The argument
errormust be nonzero. β - The topology lock has to be held. π
fr fr. hold that lock. don't be out here raw-dogging the topology. π
π SEE ALSO π
geom(4), DECLARE_GEOM_CLASS(9), g_access(9), g_attach(9), g_bio(9), g_consumer(9), g_data(9), g_event(9), g_geom(9), g_provider(9), g_provider_by_name(9)
πΈ AUTHORS πΈ
This manual page was written by Pawel Jakub Dawidek <pjd@FreeBSD.org>. π«Ά thank you for your service king
and that's the whole page bestie!! π this one came from the Debian crew, dated January 16, 2004 β so it's older than most of us and still serving looks. slay. πβ¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms