1 | #ifndef __LINUX_GFP_H
|
---|
2 | #define __LINUX_GFP_H
|
---|
3 |
|
---|
4 | #include <linux/types.h>
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * GFP bitmasks..
|
---|
8 | */
|
---|
9 | #define __GFP_WAIT 0x01
|
---|
10 | #define __GFP_LOW 0x02
|
---|
11 | #define __GFP_MED 0x04
|
---|
12 | #define __GFP_HIGH 0x08
|
---|
13 | #define __GFP_IO 0x10
|
---|
14 | #define __GFP_SWAP 0x20
|
---|
15 |
|
---|
16 | /* Plain integer GFP bitmasks. Do not use this directly. */
|
---|
17 | #define ___GFP_DMA 0x01u
|
---|
18 | #define ___GFP_HIGHMEM 0x02u
|
---|
19 | #define ___GFP_DMA32 0x04u
|
---|
20 | #define ___GFP_MOVABLE 0x08u
|
---|
21 | #define ___GFP_RECLAIMABLE 0x10u
|
---|
22 | #define ___GFP_HIGH 0x20u
|
---|
23 | #define ___GFP_IO 0x40u
|
---|
24 | #define ___GFP_FS 0x80u
|
---|
25 | #define ___GFP_ZERO 0x100u
|
---|
26 | #define ___GFP_ATOMIC 0x200u
|
---|
27 | #define ___GFP_DIRECT_RECLAIM 0x400u
|
---|
28 | #define ___GFP_KSWAPD_RECLAIM 0x800u
|
---|
29 | #define ___GFP_WRITE 0x1000u
|
---|
30 | #define ___GFP_NOWARN 0x2000u
|
---|
31 | #define ___GFP_RETRY_MAYFAIL 0x4000u
|
---|
32 | #define ___GFP_NOFAIL 0x8000u
|
---|
33 | #define ___GFP_NORETRY 0x10000u
|
---|
34 | #define ___GFP_MEMALLOC 0x20000u
|
---|
35 | #define ___GFP_COMP 0x40000u
|
---|
36 | #define ___GFP_NOMEMALLOC 0x80000u
|
---|
37 | #define ___GFP_HARDWALL 0x100000u
|
---|
38 | #define ___GFP_THISNODE 0x200000u
|
---|
39 | #define ___GFP_ACCOUNT 0x400000u
|
---|
40 | #ifdef CONFIG_LOCKDEP
|
---|
41 | #define ___GFP_NOLOCKDEP 0x800000u
|
---|
42 | #else
|
---|
43 | #define ___GFP_NOLOCKDEP 0
|
---|
44 | #endif
|
---|
45 | /* If the above are modified, __GFP_BITS_SHIFT may need updating */
|
---|
46 |
|
---|
47 | #define __GFP_NORETRY 0
|
---|
48 | #define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN)
|
---|
49 | #define __GFP_COMP ((__force gfp_t)___GFP_COMP)
|
---|
50 | #define __GFP_ZERO ((__force gfp_t)___GFP_ZERO)
|
---|
51 | #define __GFP_RETRY_MAYFAIL ((__force gfp_t)___GFP_RETRY_MAYFAIL)
|
---|
52 | #define GFP_DMA32 0 /* driver must check for 32-bit address */
|
---|
53 | #define GFP_BUFFER (__GFP_LOW | __GFP_WAIT)
|
---|
54 | #define GFP_ATOMIC (__GFP_HIGH)
|
---|
55 | #define GFP_USER (__GFP_LOW | __GFP_WAIT | __GFP_IO)
|
---|
56 | #define GFP_HIGHUSER (GFP_USER | __GFP_HIGHMEM)
|
---|
57 | #define GFP_KERNEL (__GFP_MED | __GFP_WAIT | __GFP_IO)
|
---|
58 | #define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
|
---|
59 | #define GFP_KSWAPD (__GFP_IO | __GFP_SWAP)
|
---|
60 |
|
---|
61 |
|
---|
62 | /*
|
---|
63 | * Physical address zone modifiers (see linux/mmzone.h - low four bits)
|
---|
64 | *
|
---|
65 | * Do not put any conditional on these. If necessary modify the definitions
|
---|
66 | * without the underscores and use them consistently. The definitions here may
|
---|
67 | * be used in bit comparisons.
|
---|
68 | */
|
---|
69 | #define __GFP_DMA ((__force gfp_t)___GFP_DMA)
|
---|
70 | #define __GFP_HIGHMEM ((__force gfp_t)___GFP_HIGHMEM)
|
---|
71 | #define __GFP_DMA32 ((__force gfp_t)___GFP_DMA32)
|
---|
72 | #define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
|
---|
73 | #define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
|
---|
74 | /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
|
---|
75 | platforms, used as appropriate on others */
|
---|
76 |
|
---|
77 | #define GFP_DMA __GFP_DMA
|
---|
78 |
|
---|
79 | /* Flag - indicates that the buffer can be taken from high memory which is not
|
---|
80 | directly addressable by the kernel */
|
---|
81 |
|
---|
82 | #define GFP_HIGHMEM __GFP_HIGHMEM
|
---|
83 | #define __GFP_DMAHIGHMEM 0x100
|
---|
84 | #define GFP_DMAHIGHMEM __GFP_DMAHIGHMEM
|
---|
85 |
|
---|
86 | void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
|
---|
87 | void free_pages_exact(void *virt, size_t size);
|
---|
88 |
|
---|
89 | #endif /* __LINUX_GFP_H */
|
---|
90 |
|
---|