]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
5e656dbb BN |
2 | /* |
3 | * Copyright (c) 2008 Silicon Graphics, Inc. | |
4 | * All Rights Reserved. | |
5e656dbb BN |
5 | */ |
6 | #ifndef __KMEM_H__ | |
7 | #define __KMEM_H__ | |
8 | ||
5e656dbb BN |
9 | #define KM_NOFS 0x0004u |
10 | #define KM_MAYFAIL 0x0008u | |
11 | #define KM_LARGE 0x0010u | |
12 | ||
13 | typedef struct kmem_zone { | |
14 | int zone_unitsize; /* Size in bytes of zone unit */ | |
15 | char *zone_name; /* tag name */ | |
16 | int allocated; /* debug: How many currently allocated */ | |
17 | } kmem_zone_t; | |
18 | ||
19 | extern kmem_zone_t *kmem_zone_init(int, char *); | |
20 | extern void *kmem_zone_alloc(kmem_zone_t *, int); | |
21 | extern void *kmem_zone_zalloc(kmem_zone_t *, int); | |
44488491 | 22 | extern int kmem_zone_destroy(kmem_zone_t *); |
5e656dbb BN |
23 | |
24 | static inline void | |
25 | kmem_zone_free(kmem_zone_t *zone, void *ptr) | |
26 | { | |
27 | zone->allocated--; | |
28 | free(ptr); | |
29 | } | |
30 | ||
31 | extern void *kmem_alloc(size_t, int); | |
b4b9ad30 | 32 | extern void *kmem_alloc_large(size_t, int); |
5e656dbb BN |
33 | extern void *kmem_zalloc(size_t, int); |
34 | ||
f8149110 | 35 | static inline void |
5e656dbb BN |
36 | kmem_free(void *ptr) { |
37 | free(ptr); | |
38 | } | |
39 | ||
408c66dd | 40 | extern void *kmem_realloc(void *, size_t, int); |
5e656dbb BN |
41 | |
42 | #endif |