VMEM_CREATE(9)

NAME
vmem_create - create a vmem arena

SYNOPSIS
#include <sys/vmem.h>
vmem_t *
vmem_create(const char *name, vmem_addr_t base, vmem_size_t size, vmem_size_t quantum, vmem_addr_t (*allocfn)(vmem_t *, vmem_size_t, vmem_size_t *, vm_flag_t), void (*freefn)(vmem_t *, vmem_addr_t, vmem_size_t), vmem_t *source, vmem_size_t qcache_max, vm_flag_t flags, int ipl);

DESCRIPTION
vmem_create() creates a new vmem arena.

name
    The string to describe the vmem.

base
    The start address of the initial span. It can be VMEM_ADDR_NULL if no initial span is required.

size
    The size of the initial span.

quantum
    The smallest unit of allocation.

allocfn
    The callback function used to import spans from the backend arena.

freefn
    The callback function used to free spans to the backend arena.

source
    The backend arena.

qcache_max
    The largest size of allocations which can be served by quantum cache. It is merely a hint and can be ignored.

flags
    Either of:

    VM_SLEEP
        Can sleep until enough resources are available.

    VM_NOSLEEP
        Don't sleep. Immediately return NULL if there are not enough resources available.

ipl Interrupt level to be blocked for allocating from vmem.

RETURN VALUES
vmem_create() return a pointer to the newly allocated vmem_t. Otherwise, it returns NULL.

SEE ALSO
intro(9), vmem(9)