callstack context: use delimiter when stack is incomplete
[lttng-modules.git] / wrapper / page_alloc.c
CommitLineData
389d7070
MD
1/*
2 * wrapper/page_alloc.c
3 *
0e14d6e7
MD
4 * wrapper around get_pfnblock_flags_mask and Ubuntu
5 * get_pageblock_flags_mask. Using KALLSYMS to get their address when
6 * available, else we need to have a kernel that exports this function
7 * to GPL modules.
389d7070
MD
8 *
9 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; only
14 * version 2.1 of the License.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
5a2f5e92 26#include <lttng-kernel-version.h>
389d7070 27
ffc696db 28#if (defined(CONFIG_KALLSYMS) \
36561775
MD
29 && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
30 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
31 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
397c12b4
MD
32 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
33 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0)))
389d7070
MD
34
35#include <linux/kallsyms.h>
36#include <linux/mm_types.h>
37#include <linux/module.h>
5a2f5e92
MD
38#include <wrapper/kallsyms.h>
39#include <wrapper/page_alloc.h>
389d7070
MD
40
41static
42unsigned long (*get_pfnblock_flags_mask_sym)(struct page *page,
43 unsigned long pfn,
44 unsigned long end_bitidx,
45 unsigned long mask);
46
47unsigned long wrapper_get_pfnblock_flags_mask(struct page *page,
48 unsigned long pfn,
49 unsigned long end_bitidx,
50 unsigned long mask)
51{
52 WARN_ON_ONCE(!get_pfnblock_flags_mask_sym);
53 if (get_pfnblock_flags_mask_sym) {
54 return get_pfnblock_flags_mask_sym(page, pfn, end_bitidx, mask);
55 } else {
56 return -ENOSYS;
57 }
58}
59EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask);
60
61int wrapper_get_pfnblock_flags_mask_init(void)
62{
63 get_pfnblock_flags_mask_sym =
64 (void *) kallsyms_lookup_funcptr("get_pfnblock_flags_mask");
65 if (!get_pfnblock_flags_mask_sym)
66 return -1;
67 return 0;
68}
69
0e14d6e7 70#else
389d7070
MD
71
72#include <linux/pageblock-flags.h>
73
0e14d6e7
MD
74#endif
75
76#if (defined(CONFIG_KALLSYMS) \
77 && LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0))
78
79#include <linux/kallsyms.h>
80#include <linux/mm_types.h>
81#include <linux/module.h>
5a2f5e92
MD
82#include <wrapper/kallsyms.h>
83#include <wrapper/page_alloc.h>
0e14d6e7
MD
84
85static
86unsigned long (*get_pageblock_flags_mask_sym)(struct page *page,
87 unsigned long end_bitidx,
88 unsigned long mask);
89
90unsigned long wrapper_get_pageblock_flags_mask(struct page *page,
91 unsigned long end_bitidx,
92 unsigned long mask)
93{
94 WARN_ON_ONCE(!get_pageblock_flags_mask_sym);
95 if (get_pageblock_flags_mask_sym) {
96 return get_pageblock_flags_mask_sym(page, end_bitidx, mask);
97 } else {
98 return -ENOSYS;
99 }
100}
101EXPORT_SYMBOL_GPL(wrapper_get_pageblock_flags_mask);
102
103int wrapper_get_pageblock_flags_mask_init(void)
104{
105 get_pageblock_flags_mask_sym =
106 (void *) kallsyms_lookup_funcptr("get_pageblock_flags_mask");
107 if (!get_pageblock_flags_mask_sym)
108 return -1;
109 return 0;
110}
111
112#else
113
114#include <linux/pageblock-flags.h>
115
116#endif
This page took 0.046847 seconds and 4 git commands to generate.