Version 2.5.6
[lttng-modules.git] / wrapper / page_alloc.h
CommitLineData
66861b2e
MD
1#ifndef _LTTNG_WRAPPER_PAGE_ALLOC_H
2#define _LTTNG_WRAPPER_PAGE_ALLOC_H
3
4/*
5 * wrapper/page_alloc.h
6 *
7 * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address
8 * when available, else we need to have a kernel that exports this function to
9 * GPL modules.
10 *
11 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; only
16 * version 2.1 of the License.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27
28#include "../lttng-kernel-version.h"
29
30/*
31 * We need to redefine get_pfnblock_flags_mask to our wrapper, because
32 * the get_pageblock_migratetype() macro uses it.
33 */
34#if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2))
35
36#define get_pfnblock_flags_mask wrapper_get_pfnblock_flags_mask
37
38#include <linux/mm_types.h>
39
40int wrapper_get_pfnblock_flags_mask_init(void);
41
7d5f6cef 42#else
66861b2e
MD
43
44#include <linux/mm_types.h>
45
46static inline
47int wrapper_get_pfnblock_flags_mask_init(void)
48{
49 return 0;
50}
51
7d5f6cef
MD
52#endif
53
54/*
55 * For a specific range of Ubuntu 3.13 kernels, we need to redefine
56 * get_pageblock_flags_mask to our wrapper, because the
57 * get_pageblock_migratetype() macro uses it. This function has been
58 * introduced into mainline within commit
59 * e58469bafd0524e848c3733bc3918d854595e20f, but never actually showed
60 * up in a stable kernel version, since it has been changed by commit
61 * dc4b0caff24d9b2918e9f27bc65499ee63187eba. Since Ubuntu chose to only
62 * backport the former commit but not the latter, we need to do a
63 * special case to cover this.
64 */
65#if (defined(CONFIG_KALLSYMS) \
66 && LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0))
67
68#define get_pageblock_flags_mask wrapper_get_pageblock_flags_mask
69
70#include <linux/mm_types.h>
71
72int wrapper_get_pageblock_flags_mask_init(void);
73
74#else
75
76#include <linux/mm_types.h>
77
78static inline
79int wrapper_get_pageblock_flags_mask_init(void)
80{
81 return 0;
82}
83
84#endif
66861b2e
MD
85
86#endif /* _LTTNG_WRAPPER_PAGE_ALLOC_H */
This page took 0.027074 seconds and 4 git commands to generate.