Move splice wrapper into c file
[lttng-modules.git] / wrapper / splice.c
1 /*
2 * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com)
3 *
4 * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when
5 * available, else we need to have a kernel that exports this function to GPL
6 * modules.
7 *
8 * Dual LGPL v2.1/GPL v2 license.
9 */
10
11 #ifdef CONFIG_KALLSYMS
12
13 #include <linux/kallsyms.h>
14 #include <linux/fs.h>
15 #include <linux/splice.h>
16
17 static
18 ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe,
19 struct splice_pipe_desc *spd);
20
21 ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
22 struct splice_pipe_desc *spd)
23 {
24 if (!splice_to_pipe_sym)
25 splice_to_pipe_sym = (void *) kallsyms_lookup_name("splice_to_pipe");
26 if (splice_to_pipe_sym) {
27 return splice_to_pipe_sym(pipe, spd);
28 } else {
29 printk(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n");
30 return -ENOSYS;
31 }
32 }
33
34 #else
35
36 #include <linux/fs.h>
37 #include <linux/splice.h>
38
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
45 #endif
This page took 0.032121 seconds and 5 git commands to generate.