The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: listitem/para
Context English State
If data retrieval speed is very important, see <citerefentry><refentrytitle>tree</refentrytitle><manvolnum>3</manvolnum></citerefentry> and <citerefentry><refentrytitle>hashinit</refentrytitle><manvolnum>9</manvolnum></citerefentry>.
Structure <varname remap="structname">bio</varname> is used for any and all Input/Output operations concerning GEOM. It basically contains information about what device ('provider') should satisfy the request, request type, offset, length, pointer to a buffer, and a bunch of <quote>user-specific</quote> flags and fields that can help implement various hacks.
The important thing here is that <varname remap="structname">bio</varname>s are handled asynchronously. That means that, in most parts of the code, there is no analogue to userland's <citerefentry><refentrytitle>read</refentrytitle><manvolnum>2</manvolnum></citerefentry> and <citerefentry><refentrytitle>write</refentrytitle><manvolnum>2</manvolnum></citerefentry> calls that do not return until a request is done. Rather, a developer-supplied function is called as a notification when the request gets completed (or results in error).
The asynchronous programming model (also called <quote>event-driven</quote>) is somewhat harder than the much more used imperative one used in userland (at least it takes a while to get used to it). In some cases the helper routines <function>g_write_data</function>() and <function>g_read_data</function>() can be used, but <emphasis>not always</emphasis>. In particular, they cannot be used when a mutex is held; for example, the GEOM topology mutex or the internal mutex held during the <function>.start</function>() and <function>.stop</function>() functions.
On GEOM Programming
If maximum performance is not needed, a much simpler way of making a data transformation is to implement it in userland via the ggate (GEOM gate) facility. Unfortunately, there is no easy way to convert between, or even share code between the two approaches.
GEOM Class
GEOM classes are transformations on the data. These transformations can be combined in a tree-like fashion. Instances of GEOM classes are called <emphasis>geoms</emphasis>.
Each GEOM class has several <quote>class methods</quote> that get called when there is no geom instance available (or they are simply not bound to a single instance):
<function>.init</function> is called when GEOM becomes aware of a GEOM class (when the kernel module gets loaded.)
<function>.fini</function> gets called when GEOM abandons the class (when the module gets unloaded)
<function>.taste</function> is called next, once for each provider the system has available. If applicable, this function will usually create and start a geom instance.
<function>.destroy_geom</function> is called when the geom should be disbanded
<function>.ctlconf</function> is called when user requests reconfiguration of existing geom
Also defined are the GEOM event functions, which will get copied to the geom instance.
Field <function>.geom</function> in the <varname remap="structname">g_class</varname> structure is a LIST of geoms instantiated from the class.
These functions are called from the g_event kernel thread.
The name <quote>softc</quote> is a legacy term for <quote>driver private data</quote>. The name most probably comes from the archaic term <quote>software control block</quote>. In GEOM, it is a structure (more precise: pointer to a structure) that can be attached to a geom instance to hold whatever data is private to the geom instance. Most GEOM classes have the following members:
<varname>struct g_provider *provider</varname> : The <quote>provider</quote> this geom instantiates
<varname>uint16_t n_disks</varname> : Number of consumer this geom consumes
<varname>struct g_consumer **disks</varname> : Array of <varname>struct g_consumer*</varname>. (It is not possible to use just single indirection because struct g_consumer* are created on our behalf by GEOM).
The <varname remap="structname">softc</varname> structure contains all the state of geom instance. Every geom instance has its own softc.
Format of metadata is more-or-less class-dependent, but MUST start with:
16 byte buffer for null-terminated signature (usually the class name)
uint32 version ID
It is assumed that geom classes know how to handle metadata with version ID's lower than theirs.
Metadata is located in the last sector of the provider (and thus must fit in it).


No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: listitem/para
Source string location
String age
a year ago
Source string age
a year ago
Translation file
articles/geom-class.pot, string 77