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) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2))
29 #include <linux/kallsyms.h>
30 #include <linux/mm_types.h>
31 #include <linux/module.h>
33 #include "page_alloc.h"
36 unsigned long (*get_pfnblock_flags_mask_sym
)(struct page
*page
,
38 unsigned long end_bitidx
,
41 unsigned long wrapper_get_pfnblock_flags_mask(struct page
*page
,
43 unsigned long end_bitidx
,
46 WARN_ON_ONCE(!get_pfnblock_flags_mask_sym
);
47 if (get_pfnblock_flags_mask_sym
) {
48 return get_pfnblock_flags_mask_sym(page
, pfn
, end_bitidx
, mask
);
53 EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask
);
55 int wrapper_get_pfnblock_flags_mask_init(void)
57 get_pfnblock_flags_mask_sym
=
58 (void *) kallsyms_lookup_funcptr("get_pfnblock_flags_mask");
59 if (!get_pfnblock_flags_mask_sym
)
64 #else /* #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */
66 #include <linux/pageblock-flags.h>
68 #endif /* #else #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */