Commit | Line | Data |
---|---|---|
42d9070d AG |
1 | #ifndef _LTTNG_WRAPPER_WRITEBACK_H |
2 | #define _LTTNG_WRAPPER_WRITEBACK_H | |
3 | ||
4 | /* | |
5 | * wrapper/writeback.h | |
6 | * | |
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. | |
10 | * | |
11 | * Copyright (C) 2013 Mentor Graphics Corp. | |
12 | * | |
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. | |
17 | * | |
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. | |
22 | * | |
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 | |
26 | */ | |
27 | ||
28 | #ifdef CONFIG_KALLSYMS_ALL | |
29 | ||
30 | #include <linux/kallsyms.h> | |
31 | #include "kallsyms.h" | |
32 | ||
33 | static unsigned long *global_dirty_limit_sym; | |
34 | ||
35 | static inline | |
36 | unsigned long wrapper_global_dirty_limit(void) | |
37 | { | |
38 | if (!global_dirty_limit_sym) | |
39 | global_dirty_limit_sym = | |
40 | (void *) kallsyms_lookup_dataptr("global_dirty_limit"); | |
41 | if (global_dirty_limit_sym) { | |
42 | return *global_dirty_limit_sym; | |
43 | } else { | |
44 | printk(KERN_WARNING "LTTng: global_dirty_limit symbol lookup failed.\n"); | |
45 | return 0; | |
46 | } | |
47 | } | |
48 | ||
49 | #else | |
50 | ||
51 | #include <linux/writeback.h> | |
52 | ||
53 | static inline | |
54 | unsigned long wrapper_global_dirty_limit(void) | |
55 | { | |
56 | return global_dirty_limit; | |
57 | } | |
58 | ||
59 | #endif | |
60 | ||
61 | #endif /* _LTTNG_WRAPPER_WRITEBACK_H */ |