osd(9) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

osd(9)

The framework provides a mechanism to dynamically associate arbi‐
trary  data  at run-time with any kernel data structure which has
been suitably modified for use with The one-off modification  re‐
quired involves embedding a inside the kernel data structure.  An
additional  benefit  is that after the initial change to a struc‐
ture is made, all subsequent use of with the  structure  involves
no  changes to the structure's layout.  By extension, if the data
structure is part of the ABI, provides a  way  of  extending  the
structure in an ABI preserving manner.  The details of the embed‐
ded are not relevant to consumers of the framework and should not
be  manipulated  directly.   Data  associated with a structure is
referenced by the framework using a  type/slot  identifier  pair.
Types are statically defined in and provide a high-level grouping
for  slots  to be registered under.  Slot identifiers are dynami‐
cally assigned by the framework when a data  type  is  registered
using  and  remains valid until a corresponding call to The func‐
tion registers a type/slot identifier pair with the framework for
use with a new data type.  The function may sleep  and  therefore
cannot  be  called  from  a  non-sleepable context.  The argument
specifies which high-level type grouping from the slot identifier
should be allocated under.  The argument  specifies  an  optional
osd_destructor_t function pointer that will be called for objects
of  the  type  being  registered which are later destroyed by the
function.  NULL may be passed if no destructor is required.   The
argument  specifies  an  optional  array of osd_method_t function
pointers which can be later invoked by the function.  NULL may be
passed if no methods are required.   The  argument  is  currently
only  useful  with  the  OSD_JAIL  type identifier.  The function
deregisters a previously registered  type/slot  identifier  pair.
The function may sleep and therefore cannot be called from a non-
sleepable  context.  The argument specifies which high-level type
grouping from the slot identifier is allocated under.  The  argu‐
ment  specifies  the  slot identifier which is being deregistered
and should be the value that was returned by when the  data  type
was  registered.   The  function associates a data object pointer
with a kernel data structure's member.   The  argument  specifies
which  high-level type grouping from the slot identifier is allo‐
cated under.  The argument is a pointer to the kernel data struc‐
ture's which will have the pointer associated with it.  The argu‐
ment specifies the slot identifier to assign the pointer to.  The
argument points to a data object to associate with  The  function
does  the same as but with an extra argument that is internal-use
memory previously allocated via The  function  returns  the  data
pointer associated with a kernel data structure's member from the
specified  type/slot  identifier  pair.   The  argument specifies
which high-level type grouping from the slot identifier is  allo‐
cated under.  The argument is a pointer to the kernel data struc‐
ture's to retrieve the data pointer from.  The argument specifies
the slot identifier to retrieve the data pointer from.  The func‐
tion  removes  the  data  pointer  associated  with a kernel data
structure's member from the specified type/slot identifier  pair.
The  argument  specifies  which high-level type grouping from the
slot identifier is allocated under.  The argument is a pointer to
the kernel data structure's to remove the data pointer from.  The
argument specifies the slot identifier to remove the data pointer
from.  If an osd_destructor_t function pointer was  specified  at
registration  time,  the  destructor  function will be called and
passed the data pointer for the type/slot identifier  pair  which
is  being deleted.  The function calls the specified osd_method_t
function pointer for all currently registered slots  of  a  given
type  on  the specified and pointers.  The function may sleep and
therefore cannot be called from a non-sleepable context.  The ar‐
gument specifies which high-level type grouping from to call  the
method   for.    The   argument  specifies  the  index  into  the
osd_method_t array that was  passed  to  The  and  arguments  are
passed to the method function pointer of each slot.  The function
removes  all  data  object pointers from all currently registered
slots for a given type for the specified kernel data  structure's
member.   The  argument  specifies which high-level type grouping
from to remove data pointers from.  The argument is a pointer  to
the  kernel  data  structure's to remove all data object pointers
for all currently registered slots from.  uses a two  dimensional
matrix  (array of arrays) as the data structure to manage the ex‐
ternal data associated with a  kernel  data  structure's  member.
The  type  identifier  is used as the index into the outer array,
and the slot identifier is used as the index into the  inner  ar‐
ray.   To  set  or  retrieve a data pointer for a given type/slot
identifier pair, and perform the equivalent of array[type][slot],
which is both constant time and fast.  If is called on a for  the
first  time,  the  array for storing data pointers is dynamically
allocated using with M_NOWAIT to a size appropriate for the  slot
identifier  being set.  If a subsequent call to attempts to set a
slot identifier which is numerically larger than the slot used in
the previous call, is used to grow the array to  the  appropriate
size  such that the slot identifier can be used.  To maximise the
efficiency of any code which calls sequentially on  a  number  of
different slot identifiers (e.g., during an initialisation phase)
one  should loop through the slot identifiers in descending order
from highest to lowest.  This will result in only a  single  call
to  create  an  array of the largest slot size and all subsequent
calls to will proceed without any calls.  It is possible  for  to
fail to allocate this array.  To ensure that such allocation suc‐
ceeds,  may  be  called  (in a non-blocking context), and it will
pre-allocate the memory via with M_WAITOK.  Then  this  pre-allo‐
cated  memory is passed to which will use it if necessary or oth‐
erwise discard it.  The memory may also be  explicitly  discarded
by  calling As this method always allocates memory whether or not
it is ultimately needed, it should be used only rarely,  such  as
in the unlikely event that fails.  The API is geared towards slot
identifiers  storing  pointers to the same underlying data struc‐
ture type for a given type identifier.  This is  not  a  require‐
ment,  and  for example stores completely different data types in
slots under the OSD_KHELP type identifier.  internally uses a mix
of and locks to protect its internal data structures  and  state.
Responsibility  for  synchronising access to a kernel data struc‐
ture's member is left to the subsystem that uses the data  struc‐
ture and calls the API.  only acquires an in read mode, therefore
making it safe to use in the majority of contexts within the ker‐
nel  including  most fast paths.  returns the slot identifier for
the newly registered data type.  and return zero  on  success  or
ENOMEM  if  the  specified type/slot identifier pair triggered an
internal which failed will always succeed when is non-NULL).  re‐
turns the data pointer for  the  specified  type/slot  identifier
pair,  or NULL if the slot has not been initialised yet.  returns
a pointer suitable for passing to or returns zero if no method is
run or the method for each slot runs successfully.  If  a  method
for  a  slot returns non-zero, terminates prematurely and returns
the method's error to the caller.  The Object Specific Data (OSD)
facility first appeared in The facility was written by This  man‐
ual page was written by












맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3