1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
5 * wrapper around global_dirty_limit read. Using KALLSYMS with KALLSYMS_ALL
6 * to get its address when available, else we need to have a kernel that
7 * exports this variable to GPL modules.
9 * Copyright (C) 2013 Mentor Graphics Corp.
12 #ifndef _LTTNG_WRAPPER_WRITEBACK_H
13 #define _LTTNG_WRAPPER_WRITEBACK_H
15 #include <lttng-kernel-version.h>
17 #ifdef CONFIG_KALLSYMS_ALL
18 #include <linux/kallsyms.h>
19 #include <wrapper/kallsyms.h>
23 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
25 static struct wb_domain
*global_wb_domain_sym
;
28 unsigned long wrapper_global_dirty_limit(void)
30 if (!global_wb_domain_sym
)
31 global_wb_domain_sym
=
32 (void *) kallsyms_lookup_dataptr("global_wb_domain");
33 if (global_wb_domain_sym
) {
34 return global_wb_domain_sym
->dirty_limit
;
36 printk_once(KERN_WARNING
"LTTng: global_wb_domain symbol lookup failed.\n");
42 static unsigned long *global_dirty_limit_sym
;
45 unsigned long wrapper_global_dirty_limit(void)
47 if (!global_dirty_limit_sym
)
48 global_dirty_limit_sym
=
49 (void *) kallsyms_lookup_dataptr("global_dirty_limit");
50 if (global_dirty_limit_sym
) {
51 return *global_dirty_limit_sym
;
53 printk_once(KERN_WARNING
"LTTng: global_dirty_limit symbol lookup failed.\n");
59 #else /* CONFIG_KALLSYMS_ALL */
61 #include <linux/writeback.h>
64 unsigned long wrapper_global_dirty_limit(void)
66 return global_dirty_limit
;
71 #endif /* _LTTNG_WRAPPER_WRITEBACK_H */
This page took 0.034271 seconds and 4 git commands to generate.