Initial Linux ZFS GIT Repo
[zfs.git] / zfs / lib / libumem / vmem_base.h
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26
27 #ifndef _VMEM_BASE_H
28 #define _VMEM_BASE_H
29
30 /* #pragma ident        "@(#)vmem_base.h        1.3     05/06/08 SMI" */
31
32 #include <sys/vmem.h>
33 #include <umem.h>
34
35 #ifdef  __cplusplus
36 extern "C" {
37 #endif
38
39 #include "misc.h"
40
41 extern void vmem_startup(void);
42 extern vmem_t *vmem_init(const char *parent_name, size_t parent_quantum,
43         vmem_alloc_t *parent_alloc, vmem_free_t *parent_free,
44         const char *heap_name,
45         void *heap_start, size_t heap_size, size_t heap_quantum,
46         vmem_alloc_t *heap_alloc, vmem_free_t *heap_free);
47
48 extern void *_vmem_extend_alloc(vmem_t *vmp, void *vaddr, size_t size,
49         size_t alloc, int vmflag);
50
51 extern vmem_t *vmem_heap_arena(vmem_alloc_t **, vmem_free_t **);
52 extern void vmem_heap_init(void);
53
54 extern vmem_t *vmem_sbrk_arena(vmem_alloc_t **, vmem_free_t **);
55 extern vmem_t *vmem_mmap_arena(vmem_alloc_t **, vmem_free_t **);
56 extern vmem_t *vmem_stand_arena(vmem_alloc_t **, vmem_free_t **);
57
58 extern void vmem_update(void *);
59 extern void vmem_reap(void);            /* vmem_populate()-safe reap */
60
61 extern size_t pagesize;
62 extern size_t vmem_sbrk_pagesize;
63
64 extern uint_t vmem_backend;
65 #define VMEM_BACKEND_SBRK       0x0000001
66 #define VMEM_BACKEND_MMAP       0x0000002
67 #define VMEM_BACKEND_STAND      0x0000003
68
69 extern vmem_t *vmem_heap;
70 extern vmem_alloc_t *vmem_heap_alloc;
71 extern vmem_free_t *vmem_heap_free;
72
73 extern void vmem_lockup(void);
74 extern void vmem_release(void);
75
76 extern void vmem_sbrk_lockup(void);
77 extern void vmem_sbrk_release(void);
78
79 extern void vmem_no_debug(void);
80
81 #ifdef  __cplusplus
82 }
83 #endif
84
85 #endif  /* _VMEM_BASE_H */