Print this page
code review from Josh and Robert


  20 .Nd walk a (sub\-)set of the segments in a vmem arena
  21 .Sh SYNOPSIS
  22 .In sys/vmem.h
  23 .Ft void
  24 .Fo vmem_walk
  25 .Fa "vmem_t *vmp"
  26 .Fa "int typemask"
  27 .Fa "void (*func)(void *, void *, size_t)"
  28 .Fa "void *arg"
  29 .Fc
  30 .Ft size_t
  31 .Fo vmem_size
  32 .Fa "vmem_t *vmp"
  33 .Fa "int typemask"
  34 .Fc
  35 .Sh INTERFACE LEVEL
  36 illumos DDI specific
  37 .Sh PARAMETERS
  38 .Bl -tag -width Ds
  39 .It Fa vmp
  40 The vmem arena to walk
  41 .It Fa typemask
  42 A bitmask indicating the types of segment to operate on
  43 .Bl -tag -width Ds
  44 .It Dv VMEM_ALLOC
  45 Allocated segments
  46 .It Dv VMEM_FREE
  47 Free segments
  48 .El
  49 .It Fa func
  50 The function to apply to each segment matching
  51 .Fa typemask .
  52 .Fa func
  53 should be of 3 values and return void:
  54 .Bl -tag -width Ds
  55 .It Fa "void *arg"
  56 The
  57 .Fa arg
  58 passed to
  59 .Fn vmem_walk
  60 .It Fa "void *vaddr"
  61 The base address of the segment
  62 .It Fa "size_t size"
  63 The size of the segment
  64 .El
  65 .It Fa arg
  66 An arbitrary argument passed to each call to
  67 .Fn func
  68 .El
  69 .Sh DESCRIPTION
  70 .Fn vmem_walk
  71 walks each segment in the arena
  72 .Fa vmp
  73 and applies
  74 .Fa func
  75 to each which matches
  76 .Fa typemask .
  77 .Pp
  78 .Fn vmem_size
  79 walks each segment in the arena
  80 .Fa vmp
  81 and totals the size of each matching
  82 .Fa typemask .
  83 .Sh CONTEXT
  84 This function may be called from user or kernel context.
  85 .Sh SEE ALSO
  86 .Xr vmem 9 ,
  87 .Xr vmem_alloc 9F ,


  20 .Nd walk a (sub\-)set of the segments in a vmem arena
  21 .Sh SYNOPSIS
  22 .In sys/vmem.h
  23 .Ft void
  24 .Fo vmem_walk
  25 .Fa "vmem_t *vmp"
  26 .Fa "int typemask"
  27 .Fa "void (*func)(void *, void *, size_t)"
  28 .Fa "void *arg"
  29 .Fc
  30 .Ft size_t
  31 .Fo vmem_size
  32 .Fa "vmem_t *vmp"
  33 .Fa "int typemask"
  34 .Fc
  35 .Sh INTERFACE LEVEL
  36 illumos DDI specific
  37 .Sh PARAMETERS
  38 .Bl -tag -width Ds
  39 .It Fa vmp
  40 The vmem arena to walk.
  41 .It Fa typemask
  42 A bitmask indicating the types of segment to operate on.
  43 .Bl -tag -width Ds
  44 .It Dv VMEM_ALLOC
  45 Allocated segments.
  46 .It Dv VMEM_FREE
  47 Free segments.
  48 .El
  49 .It Fa func
  50 The function to apply to each segment matching
  51 .Fa typemask .
  52 .Fa func
  53 should accept 3 arguments and return void:
  54 .Bl -tag -width Ds
  55 .It Fa "void *arg"
  56 The
  57 .Fa arg
  58 passed to
  59 .Fn vmem_walk .
  60 .It Fa "void *vaddr"
  61 The base address of the segment.
  62 .It Fa "size_t size"
  63 The size of the segment.
  64 .El
  65 .It Fa arg
  66 An arbitrary argument passed to each call to
  67 .Fn func .
  68 .El
  69 .Sh DESCRIPTION
  70 .Fn vmem_walk
  71 walks each segment in the arena
  72 .Fa vmp
  73 and applies
  74 .Fa func
  75 to each which matches
  76 .Fa typemask .
  77 .Pp
  78 .Fn vmem_size
  79 walks each segment in the arena
  80 .Fa vmp
  81 and totals the size of each matching
  82 .Fa typemask .
  83 .Sh CONTEXT
  84 This function may be called from user or kernel context.
  85 .Sh SEE ALSO
  86 .Xr vmem 9 ,
  87 .Xr vmem_alloc 9F ,