]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/kmem.h
xfs: allocate xattr buffer on demand
[thirdparty/xfsprogs-dev.git] / include / kmem.h
CommitLineData
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
13typedef 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
19extern kmem_zone_t *kmem_zone_init(int, char *);
20extern void *kmem_zone_alloc(kmem_zone_t *, int);
21extern void *kmem_zone_zalloc(kmem_zone_t *, int);
44488491 22extern int kmem_zone_destroy(kmem_zone_t *);
5e656dbb
BN
23
24static inline void
25kmem_zone_free(kmem_zone_t *zone, void *ptr)
26{
27 zone->allocated--;
28 free(ptr);
29}
30
31extern void *kmem_alloc(size_t, int);
b4b9ad30 32extern void *kmem_alloc_large(size_t, int);
5e656dbb
BN
33extern void *kmem_zalloc(size_t, int);
34
f8149110 35static inline void
5e656dbb
BN
36kmem_free(void *ptr) {
37 free(ptr);
38}
39
408c66dd 40extern void *kmem_realloc(void *, size_t, int);
5e656dbb
BN
41
42#endif