Cleanup: Move wrapper/ headers to include/wrapper/
[lttng-modules.git] / include / wrapper / page_alloc.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * wrapper/page_alloc.h
4 *
5 * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address
6 * when available, else we need to have a kernel that exports this function to
7 * GPL modules.
8 *
9 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 */
11
12 #ifndef _LTTNG_WRAPPER_PAGE_ALLOC_H
13 #define _LTTNG_WRAPPER_PAGE_ALLOC_H
14
15 #include <lttng/kernel-version.h>
16
17 /*
18 * We need to redefine get_pfnblock_flags_mask to our wrapper, because
19 * the get_pageblock_migratetype() macro uses it.
20 */
21 #if (defined(CONFIG_KALLSYMS) \
22 && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
23 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
24 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
25 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
26 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0)))
27
28 #define get_pfnblock_flags_mask wrapper_get_pfnblock_flags_mask
29
30 #include <linux/mm_types.h>
31
32 int wrapper_get_pfnblock_flags_mask_init(void);
33
34 #else
35
36 #include <linux/mm_types.h>
37
38 static inline
39 int wrapper_get_pfnblock_flags_mask_init(void)
40 {
41 return 0;
42 }
43
44 #endif
45
46 /*
47 * For a specific range of Ubuntu 3.13 kernels, we need to redefine
48 * get_pageblock_flags_mask to our wrapper, because the
49 * get_pageblock_migratetype() macro uses it. This function has been
50 * introduced into mainline within commit
51 * e58469bafd0524e848c3733bc3918d854595e20f, but never actually showed
52 * up in a stable kernel version, since it has been changed by commit
53 * dc4b0caff24d9b2918e9f27bc65499ee63187eba. Since Ubuntu chose to only
54 * backport the former commit but not the latter, we need to do a
55 * special case to cover this.
56 */
57 #if (defined(CONFIG_KALLSYMS) \
58 && LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0))
59
60 #define get_pageblock_flags_mask wrapper_get_pageblock_flags_mask
61
62 #include <linux/mm_types.h>
63
64 int wrapper_get_pageblock_flags_mask_init(void);
65
66 #else
67
68 #include <linux/mm_types.h>
69
70 static inline
71 int wrapper_get_pageblock_flags_mask_init(void)
72 {
73 return 0;
74 }
75
76 #endif
77
78 #endif /* _LTTNG_WRAPPER_PAGE_ALLOC_H */
This page took 0.031013 seconds and 4 git commands to generate.