1 #ifndef _LTTNG_WRAPPER_WRITEBACK_H
2 #define _LTTNG_WRAPPER_WRITEBACK_H
7 * wrapper around global_dirty_limit read. Using KALLSYMS with KALLSYMS_ALL
8 * to get its address when available, else we need to have a kernel that
9 * exports this variable to GPL modules.
11 * Copyright (C) 2013 Mentor Graphics Corp.
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.
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.
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
28 #include <lttng-kernel-version.h>
30 #ifdef CONFIG_KALLSYMS_ALL
31 #include <linux/kallsyms.h>
32 #include <wrapper/kallsyms.h>
36 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
38 static struct wb_domain
*global_wb_domain_sym
;
41 unsigned long wrapper_global_dirty_limit(void)
43 if (!global_wb_domain_sym
)
44 global_wb_domain_sym
=
45 (void *) kallsyms_lookup_dataptr("global_wb_domain");
46 if (global_wb_domain_sym
) {
47 return global_wb_domain_sym
->dirty_limit
;
49 printk_once(KERN_WARNING
"LTTng: global_wb_domain symbol lookup failed.\n");
55 static unsigned long *global_dirty_limit_sym
;
58 unsigned long wrapper_global_dirty_limit(void)
60 if (!global_dirty_limit_sym
)
61 global_dirty_limit_sym
=
62 (void *) kallsyms_lookup_dataptr("global_dirty_limit");
63 if (global_dirty_limit_sym
) {
64 return *global_dirty_limit_sym
;
66 printk_once(KERN_WARNING
"LTTng: global_dirty_limit symbol lookup failed.\n");
72 #else /* CONFIG_KALLSYMS_ALL */
74 #include <linux/writeback.h>
77 unsigned long wrapper_global_dirty_limit(void)
79 return global_dirty_limit
;
84 #endif /* _LTTNG_WRAPPER_WRITEBACK_H */
This page took 0.030894 seconds and 4 git commands to generate.