1 VMEM_CREATE(9F)          Kernel Functions for Drivers          VMEM_CREATE(9F)
   2 
   3 NAME
   4      vmem_create, vmem_xcreate, vmem_destroy - create and destroy vmem arenas
   5 
   6 SYNOPSIS
   7      #include <sys/vmem.h>
   8 
   9      typedef struct vmem vmem_t;
  10      typedef void *(vmem_alloc_t)(vmem_t *, size_t, int);
  11      typedef void (vmem_free_t)(vmem_t *, void *, size_t);
  12      typedef void *(vmem_ximport_t)(vmem_t *, size_t *, size_t, int);
  13 
  14      vmem_t *
  15      vmem_create(const char *name, void *base, size_t size, size_t quantum,
  16          vmem_alloc_t *afunc, vmem_free_t *ffunc, vmem_t *source,
  17          size_t qcache_max, int vmflag);
  18 
  19      vmem_t *
  20      vmem_xcreate(const char *name, void *base, size_t size, size_t quantum,
  21          vmem_ximport_t *afunc, vmem_free_t *ffunc, vmem_t *source,
  22          size_t qcache_max, int vmflag);
  23 
  24      void
  25      vmem_destroy(vmem_t *vmp);
  26 
  27 INTERFACE LEVEL
  28      illumos DDI specific
  29 
  30 PARAMETERS
  31      name    A character string giving a name to the vmem arena to be created.
  32 
  33      base    An address indicating the lowest possible value in the arena.
  34 
  35      size    The size of the arena to create
  36 
  37      quantum
  38              The arena's ``quantum''.  The granularity of the arena.  The
  39              amount allocated at minimum by each request.
  40 
  41      afunc   A function which is called to import new spans from source.
  42              Which may be NULL if this arena does not import from another.
  43 
  44      ffunc   A function which is called to return spans to source.  Which may
  45              be NULL if this arena does not import from another.
  46 
  47      source  An arena from which this arena will import.  Which may be NULL if
  48              this arena does not import from another.
  49 
  50      qcache_max
  51              Each arena offers caching of integer multiples of quantum up to
  52              qcache_max.
  53 
  54      vmflag  A bitmask of flags indicating the characteristics of this arena.
  55 
  56              VMC_IDENTIFIER
  57                      The arena represents arbitrary integer identifiers,
  58                      rather than virtual memory.
  59 
  60      vmp     A pointer to the vmem arena to be destroyed.
  61 
  62 DESCRIPTION
  63      A vmem arena is a section of an arbitrary address space (a range of
  64      integer addresses).  This commonly represents virtual memory, but can in
  65      fact be an arbitrary set of integers. The VMC_IDENTIFIER flag set at
  66      arena creation time differentiates between these two cases.
  67 
  68      The afunc, ffunc, and source arguments combine to support a hierarchical
  69      structure of arenas, each importing from a single parent (the source).
  70      The vmem_create() and vmem_xcreate() functions differ in that the latter
  71      provides an interface for afunc to alter the size of the span imported
  72      from source.  It is only legal to increase thise size.
  73 
  74 CONTEXT
  75      These functions can be called from user or kernel context.
  76 
  77 RETURN VALUES
  78      Upon successful completion the vmem_create(and) vmem_xcreate() functions
  79      return a pointer to a vmem arena.  Otherwise, NULL is returned to
  80      indicate the arena could not be created.
  81 
  82 SEE ALSO
  83      vmem(9), vmem_add(9F), vmem_alloc(9F)
  84 
  85 illumos                        January 18, 2017                        illumos