Drop support for kernels < 4.4 from 'wrapper/writeback.h'
[lttng-modules.git] / include / wrapper / writeback.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * wrapper/writeback.h
4 *
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.
8 *
9 * Copyright (C) 2013 Mentor Graphics Corp.
10 */
11
12 #ifndef _LTTNG_WRAPPER_WRITEBACK_H
13 #define _LTTNG_WRAPPER_WRITEBACK_H
14
15 #ifdef CONFIG_KALLSYMS_ALL
16
17 #include <linux/kallsyms.h>
18 #include <wrapper/kallsyms.h>
19
20 static struct wb_domain *global_wb_domain_sym;
21
22 static inline
23 unsigned long wrapper_global_dirty_limit(void)
24 {
25 if (!global_wb_domain_sym)
26 global_wb_domain_sym =
27 (void *) kallsyms_lookup_dataptr("global_wb_domain");
28 if (global_wb_domain_sym) {
29 return global_wb_domain_sym->dirty_limit;
30 } else {
31 printk_once(KERN_WARNING "LTTng: global_wb_domain symbol lookup failed.\n");
32 return 0;
33 }
34 }
35
36 /*
37 * Canary function to check for 'global_wb_domain' at compile time.
38 *
39 * From 'include/linux/writeback.h':
40 *
41 * extern struct wb_domain global_wb_domain;
42 */
43 static inline
44 unsigned long __canary__global_wb_domain(void)
45 {
46 return global_wb_domain.dirty_limit;
47 }
48
49 #else /* CONFIG_KALLSYMS_ALL */
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 /* CONFIG_KALLSYMS_ALL */
60
61 #endif /* _LTTNG_WRAPPER_WRITEBACK_H */
This page took 0.029957 seconds and 4 git commands to generate.