Print this page
code review from Josh and Robert
@@ -30,28 +30,64 @@
PARAMETERS
name A character string giving a name to the vmem arena to be created.
base An address indicating the lowest possible value in the arena.
- size The size of the arena to create
+ size The size of the arena to create.
quantum
The arena's ``quantum''. The granularity of the arena. The
- amount allocated at minimum by each request.
+ amount allocated at minimum by each request. Must be a power of
+ 2.
- afunc A function which is called to import new spans from source.
- Which may be NULL if this arena does not import from another.
+ afunc A function which is called to import new spans from source, which
+ may be NULL if this arena does not import from another. When
+ calling vmem_create() afunc is an vmem_alloc_t a function taking
+ three parameters and returning a pointer to void (the imported
+ space):
- ffunc A function which is called to return spans to source. Which may
- be NULL if this arena does not import from another.
+ vmem_t *
+ The source arena from which we'll import. The source
+ argument to vmem_create().
- source An arena from which this arena will import. Which may be NULL if
+ size_t The size to import
+
+ int The vmflag argument used for the import.
+
+ When calling vmem_xcreate() afunc is an vmem_ximport_t a function
+ taking four parameters and returning a pointer to void (the
+ imported space):
+
+ vmem_t *
+ The source arena from which we'll import. The source
+ argument to vmem_xcreate().
+
+ size_t *
+ The size of the import, afunc may increase this size if
+ that is desirable, but must never decrease it.
+
+ size_t The desired alignment of the imported space.
+
+ int the vmflag argument used for the import.
+
+ ffunc A function which is called to return spans to source, which may
+ be NULL if this arena does not import from another. This is a
+ vmem_free_t a function taking three parametes and returning void:
+
+ vmem_t The arena to which space is being returned. The source
+ argument to vmem_create() or vmem_xcreate().
+
+ void * The span being returned to the source arena.
+
+ size_t The size of the span being returned to the source arena.
+
+ source An arena from which this arena will import, which may be NULL if
this arena does not import from another.
qcache_max
Each arena offers caching of integer multiples of quantum up to
- qcache_max.
+ qcache_max, which may be 0.
vmflag A bitmask of flags indicating the characteristics of this arena.
VMC_IDENTIFIER
The arena represents arbitrary integer identifiers,
@@ -67,17 +103,17 @@
The afunc, ffunc, and source arguments combine to support a hierarchical
structure of arenas, each importing from a single parent (the source).
The vmem_create() and vmem_xcreate() functions differ in that the latter
provides an interface for afunc to alter the size of the span imported
- from source. It is only legal to increase thise size.
+ from source. It is only legal to increase this size.
CONTEXT
These functions can be called from user or kernel context.
RETURN VALUES
- Upon successful completion the vmem_create(and) vmem_xcreate() functions
+ Upon successful completion the vmem_create() and vmem_xcreate() functions
return a pointer to a vmem arena. Otherwise, NULL is returned to
indicate the arena could not be created.
SEE ALSO
vmem(9), vmem_add(9F), vmem_alloc(9F)