VMEM_CREATE(9F) |
Kernel Functions for Drivers |
VMEM_CREATE(9F) |
NAME
vmem_create, vmem_xcreate, vmem_destroy — create and destroy vmem arenas
SYNOPSIS
#include <sys/vmem.h>
typedef struct vmem vmem_t;
typedef void *(vmem_alloc_t)(vmem_t *, size_t, int);
typedef void (vmem_free_t)(vmem_t *, void *, size_t);
typedef void *(vmem_ximport_t)(vmem_t *, size_t *, size_t, int);
vmem_t *
vmem_create(
const char *name,
void *base,
size_t size,
size_t quantum,
vmem_alloc_t *afunc,
vmem_free_t *ffunc,
vmem_t *source,
size_t qcache_max,
int vmflag);
vmem_t *
vmem_xcreate(
const char *name,
void *base,
size_t size,
size_t quantum,
vmem_ximport_t *afunc,
vmem_free_t *ffunc,
vmem_t *source,
size_t qcache_max,
int vmflag);
void
vmem_destroy(
vmem_t *vmp);
INTERFACE LEVEL
illumos DDI specific
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
-
quantum
-
The arena's “quantum”. The granularity of the arena. The amount allocated at minimum by each request.
-
afunc
-
A function which is called to import new spans from source. Which may be NULL if this arena does not import from another.
-
ffunc
-
A function which is called to return spans to source. Which may be NULL if this arena does not import from another.
-
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.
-
vmflag
-
A bitmask of flags indicating the characteristics of this arena.
-
VMC_IDENTIFIER
-
The arena represents arbitrary integer identifiers, rather than virtual memory.
-
vmp
-
A pointer to the vmem arena to be destroyed.
DESCRIPTION
A
vmem arena is a section of an arbitrary address space (a range of integer addresses). This commonly represents virtual memory, but can in fact be an arbitrary set of integers. The
VMC_IDENTIFIER flag set at arena creation time differentiates between these two cases.
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.
CONTEXT
These functions can be called from user or kernel context.
RETURN VALUES
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.