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
|
|
|
.\"
|
|
|
|
.\" 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$
|
|
|
|
.\"
|
2007-09-20 10:52:08 +00:00
|
|
|
.Dd August 13, 2007
|
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
|
|
|
.Dt DECLARE_GEOM_CLASS 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm DECLARE_GEOM_CLASS
|
|
|
|
.Nd "GEOM class declaration macro"
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In geom/geom.h
|
|
|
|
.Fn DECLARE_GEOM_CLASS "class" "mod_name"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn DECLARE_GEOM_CLASS
|
|
|
|
macro registers a GEOM class in GEOM.
|
|
|
|
A GEOM class itself implements one particular kind of transformation.
|
2004-07-06 08:21:12 +00:00
|
|
|
Typical examples are: MBR disk partition,
|
|
|
|
.Bx
|
|
|
|
disklabel and RAID5 classes.
|
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
|
|
|
.Fn DECLARE_GEOM_CLASS
|
|
|
|
can be used both for compiled in and loaded as
|
|
|
|
.Xr kld 4
|
|
|
|
modules GEOM classes and it is the only official way for class registration.
|
|
|
|
.Pp
|
|
|
|
The arguments to
|
|
|
|
.Fn DECLARE_GEOM_CLASS
|
|
|
|
are:
|
2012-05-12 20:41:40 +00:00
|
|
|
.Bl -tag -offset indent -width Fa
|
2004-07-06 08:21:12 +00:00
|
|
|
.It Fa class
|
2005-01-06 17:14:21 +00:00
|
|
|
The
|
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
|
|
|
.Vt g_class
|
|
|
|
structure which describes a GEOM class.
|
2004-07-06 08:21:12 +00:00
|
|
|
.It Fa mod_name
|
2005-01-06 17:14:21 +00:00
|
|
|
A kernel module name (not a class name!).
|
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
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Structure
|
|
|
|
.Vt g_class
|
|
|
|
contains data describing the class.
|
|
|
|
They are:
|
2004-07-06 08:21:12 +00:00
|
|
|
.Bl -tag -offset indent -width indent
|
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
|
|
|
.It Vt "const char *" Va name
|
|
|
|
Class name.
|
|
|
|
.It Vt "g_taste_t *" Va taste
|
|
|
|
Pointer to function used for taste event handling.
|
|
|
|
If it is
|
2004-07-06 08:21:12 +00:00
|
|
|
.Pf non- Dv NULL
|
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
|
|
|
it is called in three situations:
|
2004-07-06 08:21:12 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -dash -compact
|
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
|
|
|
.It
|
|
|
|
On class activation, all existing providers are offered for tasting.
|
|
|
|
.It
|
|
|
|
When new provider is created it is offered for tasting.
|
|
|
|
.It
|
|
|
|
After last write access to a provider is closed it is offered for retasting
|
|
|
|
(on first write open event
|
|
|
|
.Dq spoil
|
|
|
|
was sent).
|
|
|
|
.El
|
|
|
|
.It Vt "g_config_t *" Va config
|
|
|
|
This field is not used anymore, its functionality was replaced by the
|
|
|
|
.Va ctlreq
|
|
|
|
field.
|
|
|
|
.It Vt "g_ctl_req_t *" Va ctlreq
|
|
|
|
Pointer to function used for handling events from userland applications.
|
|
|
|
.It Vt "g_init_t *" Va init
|
|
|
|
Pointer to function which is called right after class registration.
|
|
|
|
.It Vt "g_fini_t *" Va fini
|
|
|
|
Pointer to function which is called right before class deregistration.
|
|
|
|
.It Vt "g_ctl_destroy_geom_t *" Va destroy_geom
|
|
|
|
Pointer to a function which is called for every geom on class unload.
|
|
|
|
If this field is not set, the class can not be unloaded.
|
|
|
|
.El
|
|
|
|
.Pp
|
2005-01-06 17:14:21 +00:00
|
|
|
Only a
|
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
|
|
|
.Fa name
|
2005-01-06 17:14:21 +00:00
|
|
|
field is required; the rest are optional.
|
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
|
|
|
.Sh RESTRICTIONS/CONDITIONS
|
2005-01-06 17:14:21 +00:00
|
|
|
The fields of
|
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
|
|
|
.Vt g_class
|
2005-01-06 17:14:21 +00:00
|
|
|
should always be initialized using C99-style field naming
|
|
|
|
(see the initialization of
|
2005-01-13 09:33:06 +00:00
|
|
|
.Va example_class
|
2005-01-06 17:14:21 +00:00
|
|
|
below).
|
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
|
|
|
.Sh EXAMPLES
|
|
|
|
Example class declaration.
|
|
|
|
.Bd -literal -offset indent
|
2007-09-20 10:52:08 +00:00
|
|
|
static struct g_geom *
|
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
|
|
|
g_example_taste(struct g_class *mp, struct g_provider *pp,
|
|
|
|
int flags __unused)
|
|
|
|
{
|
|
|
|
g_topology_assert();
|
|
|
|
|
|
|
|
[...]
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_example_ctlreq(struct gctl_req *req, struct g_class *cp,
|
|
|
|
char const *verb)
|
|
|
|
{
|
|
|
|
|
|
|
|
[...]
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
g_example_destroy_geom(struct gctl_req *req, struct g_class *cp,
|
|
|
|
struct g_geom *gp)
|
|
|
|
{
|
|
|
|
|
|
|
|
g_topology_assert();
|
|
|
|
|
|
|
|
[...]
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_example_init(struct g_class *mp)
|
|
|
|
{
|
|
|
|
|
|
|
|
[...]
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_example_fini(struct g_class *mp)
|
|
|
|
{
|
|
|
|
|
|
|
|
[...]
|
|
|
|
}
|
|
|
|
|
|
|
|
struct g_class example_class = {
|
|
|
|
.name = "EXAMPLE",
|
|
|
|
.taste = g_example_taste,
|
|
|
|
.ctlreq = g_example_ctlreq,
|
|
|
|
.init = g_example_init,
|
|
|
|
.fini = g_example_fini,
|
|
|
|
.destroy_geom = g_example_destroy_geom
|
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_GEOM_CLASS(example_class, g_example);
|
|
|
|
.Ed
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.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 ,
|
|
|
|
.Xr g_wither_geom 9
|
|
|
|
.Sh AUTHORS
|
|
|
|
.An -nosplit
|
|
|
|
This manual page was written by
|
|
|
|
.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
|