Commit | Line | Data |
---|---|---|
90225db5 MD |
1 | #ifndef _LTT_WRAPPER_SPLICE_H |
2 | #define _LTT_WRAPPER_SPLICE_H | |
3 | ||
4 | /* | |
5 | * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) | |
6 | * | |
7 | * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when | |
8 | * available, else we need to have a kernel that exports this function to GPL | |
9 | * modules. | |
10 | * | |
11 | * Dual LGPL v2.1/GPL v2 license. | |
12 | */ | |
13 | ||
14 | #ifdef CONFIG_KALLSYMS | |
15 | ||
16 | #include <linux/kallsyms.h> | |
17 | #include <linux/splice.h> | |
18 | ||
19 | static inline | |
20 | ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, | |
21 | struct splice_pipe_desc *spd) | |
22 | { | |
23 | ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe, | |
24 | struct splice_pipe_desc *spd); | |
25 | ||
26 | splice_to_pipe_sym = (void *) kallsyms_lookup_name("splice_to_pipe"); | |
27 | if (splice_to_pipe_sym) { | |
28 | return splice_to_pipe_sym(pipe, spd); | |
29 | } else { | |
30 | printk(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n"); | |
31 | return -ENOSYS; | |
32 | } | |
33 | } | |
34 | #else | |
35 | ||
36 | #include <linux/splice.h> | |
37 | ||
38 | static inline | |
39 | ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, | |
40 | struct splice_pipe_desc *spd) | |
41 | { | |
42 | return splice_to_pipe(pipe, spd); | |
43 | } | |
44 | #endif | |
45 | ||
46 | #endif /* _LTT_WRAPPER_SPLICE_H */ |