G_PROVIDER(9)
π G_PROVIDER(9) β the kernel dev manual, but make it cute π
okay bestie, gather round β this is the page for the GEOM providers management trio: g_new_providerf, g_destroy_provider, and g_error_provider. Kernel devs only, no cap. π«Ά
β¨ NAME β¨
g_new_providerf, g_destroy_provider, g_error_provider β GEOM providers management π
πΈ SYNOPSIS πΈ
#include <geom/geom.h>
struct g_provider *
g_new_providerf(struct g_geom *gp, const char *fmt, ...);
void
g_destroy_provider(struct g_provider *pp);
void
g_error_provider(struct g_provider *pp, int error);
π¦ DESCRIPTION π¦
So like, a GEOM provider is the front gate at which a geom offers service. Think of it as "a disk-like thing which appears in /dev" β a logical disk, in other words. π Every single provider has three main properties: name, sectorsize, and size. Those are the big three, the holy trinity, the main characters. π
g_new_providerf() β this one creates a new provider on the given geom gp. π The name of the provider, which is gonna show up as a device in devfs(5), gets built in a printf(3)-like way from the rest of the arguments. Very "fill in the blanks" of it. β¨
β οΈ But listen β after creation, the caller has to set the provider'smediasizeandsectorsize, plus any other initializations it wants. Then it has to callg_error_provider()to reset the provider's error, which is initially set toENXIO. Don't skip that step, bestie, it's giving unfinished business. π
g_destroy_provider() β destroys the given provider, cancels all related pending events, and removes the corresponding devfs entry. π§Ή Cleanup era. Bye bye, provider. π
g_error_provider() β used to set the provider's error value. π¨ If you set it to a nonzero value, all I/O requests will be denied, and increasing its access count will not be possible either (the error you passed in will be returned). It's giving "we're closed, go home." π
π₯ RESTRICTIONS/CONDITIONS π₯
rules are rules, bestie, and these ones are non-negotiable fr fr
g_new_provider():
- The provider name should be unique, but this is not enforced by GEOM. π³ If the name isn't unique, you'll end up with two (or more) files with the same name β and that is a programmer error.
- The geom
gphas to have astartmethod defined. Periodt. - The topology lock has to be held. π
g_destroy_provider():
- The provider must not have consumers attached. π
- The access count has to be
0. - The topology lock has to be held. π
β RETURN VALUES β
The g_new_providerf() function returns a pointer to the newly created provider. That's it, that's the return value. π
π EXAMPLES π
Create an example provider, set its parameters, and make it usable. Iconic behavior, honestly.
struct g_provider *
create_example_provider(struct g_geom *gp)
{
struct g_provider *pp;
g_topology_lock();
pp = g_new_providerf(gp, "example_provider");
g_topology_unlock();
pp->mediasize = 65536;
pp->sectorsize = 512;
g_error_provider(pp, 0);
return (pp);
}
Look at her. Locked, created, unlocked, sized up, error reset, returned. π Ate and left no crumbs.
π 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_by_name(9), g_wither_geom(9)
iykyk β go read those next, the lore runs deep. π
π AUTHORS π
This manual page was written by Pawel Jakub Dawidek <pjd@FreeBSD.org>. π«Ά
okay that's the whole page, you're officially a GEOM provider girlie now π β¨ This little beauty comes to you from Debian, dated January 16, 2004 β yes, she's an elder but she still serves. ππ¦πΈ bye bestie, go hold that topology lock π
π¦ 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