4 * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address
5 * when available, else we need to have a kernel that exports this function to
8 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; only
13 * version 2.1 of the License.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "../lttng-kernel-version.h"
27 #if (defined(CONFIG_KALLSYMS) \
28 && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
29 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0)))
31 #include <linux/kallsyms.h>
32 #include <linux/mm_types.h>
33 #include <linux/module.h>
35 #include "page_alloc.h"
38 unsigned long (*get_pfnblock_flags_mask_sym
)(struct page
*page
,
40 unsigned long end_bitidx
,
43 unsigned long wrapper_get_pfnblock_flags_mask(struct page
*page
,
45 unsigned long end_bitidx
,
48 WARN_ON_ONCE(!get_pfnblock_flags_mask_sym
);
49 if (get_pfnblock_flags_mask_sym
) {
50 return get_pfnblock_flags_mask_sym(page
, pfn
, end_bitidx
, mask
);
55 EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask
);
57 int wrapper_get_pfnblock_flags_mask_init(void)
59 get_pfnblock_flags_mask_sym
=
60 (void *) kallsyms_lookup_funcptr("get_pfnblock_flags_mask");
61 if (!get_pfnblock_flags_mask_sym
)
66 #else /* #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */
68 #include <linux/pageblock-flags.h>
70 #endif /* #else #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */