Print this page
code review from Josh and Robert
*** 61,97 ****
A character string giving a name to the vmem
arena to be created.
.It Fa base
An address indicating the lowest possible value in the arena.
.It Fa size
! The size of the arena to create
.It Fa quantum
The arena's
.Dq quantum .
! The granularity of the arena. The amount allocated at minimum by each request.
.It Fa afunc
A function which is called to import new spans from
! .Fa source .
! Which may be
.Dv NULL
if this arena does not import from another.
.It Fa ffunc
A function which is called to return spans to
! .Fa source .
! Which may be
.Dv NULL
if this arena does not import from another.
.It Fa source
! An arena from which this arena will import.
! Which may be
.Dv NULL
if this arena does not import from another.
.It Fa qcache_max
Each arena offers caching of integer multiples of
.Fa quantum
up to
! .Fa qcache_max .
.It Fa vmflag
A bitmask of flags indicating the characteristics of this arena.
.Bl -tag -width Ds
.It Dv VMC_IDENTIFIER
The arena represents arbitrary integer identifiers, rather than virtual
--- 61,164 ----
A character string giving a name to the vmem
arena to be created.
.It Fa base
An address indicating the lowest possible value in the arena.
.It Fa size
! The size of the arena to create.
.It Fa quantum
The arena's
.Dq quantum .
! The granularity of the arena. The amount allocated at minimum by each
! request. Must be a power of 2.
.It Fa afunc
A function which is called to import new spans from
! .Fa source ,
! which may be
.Dv NULL
if this arena does not import from another.
+ When calling
+ .Fn vmem_create
+ .Fa afunc
+ is an
+ .Vt vmem_alloc_t
+ a function taking three parameters and returning a pointer to
+ .Vt void
+ (the imported space):
+ .Bl -tag -width Ds
+ .It Fa "vmem_t *"
+ The source arena from which we'll import. The
+ .Fa source
+ argument to
+ .Fn vmem_create .
+ .It Fa size_t
+ The size to import
+ .It Fa int
+ The
+ .Fa vmflag
+ argument used for the import.
+ .El
+ .Pp
+ When calling
+ .Fn vmem_xcreate
+ .Fa afunc
+ is an
+ .Vt vmem_ximport_t
+ a function taking four parameters and returning a pointer to
+ .Vt void
+ (the imported space):
+ .Bl -tag -width Ds
+ .It Fa "vmem_t *"
+ The source arena from which we'll import. The
+ .Fa source
+ argument to
+ .Fn vmem_xcreate .
+ .It Fa "size_t *"
+ The size of the import,
+ .Fa afunc
+ may
+ .Em increase
+ this size if that is desirable, but must never decrease it.
+ .It Fa size_t
+ The desired alignment of the imported space.
+ .It Fa int
+ the
+ .Fa vmflag
+ argument used for the import.
+ .El
.It Fa ffunc
A function which is called to return spans to
! .Fa source ,
! which may be
.Dv NULL
if this arena does not import from another.
+ This is a
+ .Vt vmem_free_t
+ a function taking three parametes and returning void:
+ .Bl -tag -width Ds
+ .It Fa "vmem_t"
+ The arena to which space is being returned. The
+ .Fa source
+ argument to
+ .Fn vmem_create
+ or
+ .Fn vmem_xcreate .
+ .It Fa "void *"
+ The span being returned to the source arena.
+ .It Fa "size_t"
+ The size of the span being returned to the source arena.
+ .El
.It Fa source
! An arena from which this arena will import,
! which may be
.Dv NULL
if this arena does not import from another.
.It Fa qcache_max
Each arena offers caching of integer multiples of
.Fa quantum
up to
! .Fa qcache_max ,
! which may be 0.
.It Fa vmflag
A bitmask of flags indicating the characteristics of this arena.
.Bl -tag -width Ds
.It Dv VMC_IDENTIFIER
The arena represents arbitrary integer identifiers, rather than virtual
*** 124,139 ****
.Fa afunc
to alter the size of the span imported from
.Fa source .
It is only legal to
.Em increase
! thise size.
.Sh CONTEXT
These functions can be called from user or kernel context.
.Sh RETURN VALUES
Upon successful completion the
! .Fn vmem_create and
.Fn vmem_xcreate
functions return a pointer to a vmem arena. Otherwise,
.Dv NULL
is returned to indicate the arena could not be created.
.Sh SEE ALSO
--- 191,207 ----
.Fa afunc
to alter the size of the span imported from
.Fa source .
It is only legal to
.Em increase
! this size.
.Sh CONTEXT
These functions can be called from user or kernel context.
.Sh RETURN VALUES
Upon successful completion the
! .Fn vmem_create
! and
.Fn vmem_xcreate
functions return a pointer to a vmem arena. Otherwise,
.Dv NULL
is returned to indicate the arena could not be created.
.Sh SEE ALSO