summaryrefslogtreecommitdiffstats
path: root/sys/gnu/fs/xfs/FreeBSD/support/kmem.h
blob: f457302c062faa398c6c74016330cc1719db17eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef __XFS_SUPPORT_KMEM_H__
#define __XFS_SUPPORT_KMEM_H__

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <vm/uma.h>

typedef unsigned long xfs_pflags_t;

#define PFLAGS_TEST_NOIO()              0
#define PFLAGS_TEST_FSTRANS()           0

#define PFLAGS_SET_NOIO(STATEP) do {    \
} while (0)

#define PFLAGS_SET_FSTRANS(STATEP) do { \
} while (0)

#define PFLAGS_RESTORE(STATEP) do {     \
} while (0)

#define PFLAGS_DUP(OSTATEP, NSTATEP) do { \
} while (0)

/*
 * memory management routines
 */
#define KM_SLEEP	M_WAITOK
#define KM_SLEEP_IO	M_WAITOK
#define KM_NOFS		M_WAITOK
#define KM_NOSLEEP	M_NOWAIT
#define KM_CACHEALIGN	0

#define kmem_zone	uma_zone

typedef struct uma_zone kmem_zone_t;
typedef struct uma_zone xfs_zone_t;

#define kmem_zone_init(len, name)		\
	uma_zcreate(name, len, NULL, NULL, NULL, NULL, 0, 0)
#define kmem_zone_free(zone, ptr)		\
	uma_zfree(zone, ptr)
#define kmem_cache_destroy(zone)		\
	uma_zdestroy(zone)
#define kmem_zone_alloc(zone, flg)		\
	uma_zalloc(zone, flg)
#define kmem_zone_zalloc(zone, flg)		\
	uma_zalloc(zone, (flg) | M_ZERO)

#define	kmem_alloc(len, flg)			\
	malloc(len, M_XFS, flg)
#define	kmem_zalloc(len, flg)			\
	malloc(len, M_XFS, (flg) | M_ZERO)
#define kmem_free(ptr, size)			\
	free(ptr, M_XFS)
#define kmem_realloc(ptr, nsize, osize, flg)	\
	realloc(ptr, nsize, M_XFS, flg)

MALLOC_DECLARE(M_XFS);

#endif /* __XFS_SUPPORT_KMEM_H__ */
OpenPOWER on IntegriCloud