Drop support for kernels < 4.4 from 'wrapper/writeback.h'
[lttng-modules.git] / include / wrapper / writeback.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
9f36eaed 2 *
42d9070d
AG
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.
42d9070d
AG
10 */
11
9f36eaed
MJ
12#ifndef _LTTNG_WRAPPER_WRITEBACK_H
13#define _LTTNG_WRAPPER_WRITEBACK_H
14
6284ae7c 15#ifdef CONFIG_KALLSYMS_ALL
9f881196 16
42d9070d 17#include <linux/kallsyms.h>
5a2f5e92 18#include <wrapper/kallsyms.h>
42d9070d 19
6284ae7c
MJ
20static struct wb_domain *global_wb_domain_sym;
21
22static inline
23unsigned 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}
3dfec228
MJ
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 */
43static inline
44unsigned long __canary__global_wb_domain(void)
45{
46 return global_wb_domain.dirty_limit;
47}
48
6284ae7c 49#else /* CONFIG_KALLSYMS_ALL */
42d9070d
AG
50
51#include <linux/writeback.h>
52
53static inline
54unsigned long wrapper_global_dirty_limit(void)
55{
56 return global_dirty_limit;
57}
58
9f881196 59#endif /* CONFIG_KALLSYMS_ALL */
42d9070d
AG
60
61#endif /* _LTTNG_WRAPPER_WRITEBACK_H */
This page took 0.051886 seconds and 4 git commands to generate.