summaryrefslogtreecommitdiffstats
path: root/share/man/man9/DECLARE_GEOM_CLASS.9
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-02-11 10:06:18 +0000
committerpjd <pjd@FreeBSD.org>2004-02-11 10:06:18 +0000
commitdbc7255199dc5592095e7b60e310c520a91641bb (patch)
tree343cd26c39251e0b38b336e71722a99c8b1510da /share/man/man9/DECLARE_GEOM_CLASS.9
parentd2298f1b5c0d5a034a5957fc6dd651a04fb8626f (diff)
downloadFreeBSD-src-dbc7255199dc5592095e7b60e310c520a91641bb.zip
FreeBSD-src-dbc7255199dc5592095e7b60e310c520a91641bb.tar.gz
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)
Diffstat (limited to 'share/man/man9/DECLARE_GEOM_CLASS.9')
-rw-r--r--share/man/man9/DECLARE_GEOM_CLASS.9175
1 files changed, 175 insertions, 0 deletions
diff --git a/share/man/man9/DECLARE_GEOM_CLASS.9 b/share/man/man9/DECLARE_GEOM_CLASS.9
new file mode 100644
index 0000000..4972caa
--- /dev/null
+++ b/share/man/man9/DECLARE_GEOM_CLASS.9
@@ -0,0 +1,175 @@
+.\"
+.\" 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 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.
+Typical examples are: MBR disk partition, BSD disklabel and RAID5 classes.
+.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:
+.Bl -inset -offset indent
+.It Em class
+is the
+.Vt g_class
+structure which describes a GEOM class.
+.It Em mod_name
+is a kernel module name (not a class name!).
+.El
+.Pp
+Structure
+.Vt g_class
+contains data describing the class.
+They are:
+.Bl -inset -offset indent
+.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
+.No non- Ns Dv NULL
+it is called in three situations:
+.Bl -dash -offset indent -compact
+.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
+Only field
+.Fa name
+is required, the rest is optional.
+.Pp
+.Sh RESTRICTIONS/CONDITIONS
+In the
+.Vt g_class
+initialization one must use C99 initialization (just like in the example below).
+.Pp
+.Sh EXAMPLES
+Example class declaration.
+.Bd -literal -offset indent
+static struct geom *
+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 .
OpenPOWER on IntegriCloud