1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2017, Richard Lowe.
  13 .\"
  14 .Dd Jan 18, 2017
  15 .Dt VMEM_WALK 9F
  16 .Os
  17 .Sh NAME
  18 .Nm vmem_walk ,
  19 .Nm vmem_size
  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 ,
  88 .Xr vmem_create 9F