1 #ifndef __XFS_SUPPORT_KMEM_H__
2 #define __XFS_SUPPORT_KMEM_H__
6 #include <sys/malloc.h>
7 #include <sys/kernel.h>
12 typedef unsigned long xfs_pflags_t;
14 #define PFLAGS_TEST_NOIO() 0
15 #define PFLAGS_TEST_FSTRANS() 0
17 #define PFLAGS_SET_NOIO(STATEP) do { \
20 #define PFLAGS_SET_FSTRANS(STATEP) do { \
23 #define PFLAGS_RESTORE(STATEP) do { \
26 #define PFLAGS_DUP(OSTATEP, NSTATEP) do { \
29 /* Restore the PF_FSTRANS state to what was saved in STATEP */
30 #define PFLAGS_RESTORE_FSTRANS(STATEP) do { \
34 * memory management routines
36 #define KM_SLEEP M_WAITOK
37 #define KM_NOSLEEP M_NOWAIT
38 #define KM_NOFS M_WAITOK
41 #define kmem_zone uma_zone
43 typedef struct uma_zone kmem_zone_t;
44 typedef struct uma_zone xfs_zone_t;
47 #define KM_ZONE_HWALIGN 0
48 #define KM_ZONE_RECLAIM 0
49 #define KM_ZONE_SPREAD 0
51 #define kmem_zone_init(len, name) \
52 uma_zcreate(name, len, NULL, NULL, NULL, NULL, 0, 0)
54 static inline kmem_zone_t *
55 kmem_zone_init_flags(int size, char *zone_name, unsigned long flags,
56 void (*construct)(void *, kmem_zone_t *, unsigned long))
58 return uma_zcreate(zone_name, size, NULL, NULL, NULL, NULL, 0, 0);
61 #define kmem_zone_free(zone, ptr) \
65 kmem_zone_destroy(kmem_zone_t *zone)
70 #define kmem_zone_alloc(zone, flg) \
72 #define kmem_zone_zalloc(zone, flg) \
73 uma_zalloc(zone, (flg) | M_ZERO)
75 #define kmem_alloc(len, flg) \
76 malloc(len, M_XFS, flg)
77 #define kmem_zalloc(len, flg) \
78 malloc(len, M_XFS, (flg) | M_ZERO)
79 #define kmem_free(ptr, size) \
81 #define kmem_realloc(ptr, nsize, osize, flg) \
82 realloc(ptr, nsize, M_XFS, flg)
84 MALLOC_DECLARE(M_XFS);
86 #endif /* __XFS_SUPPORT_KMEM_H__ */