Cleanup comment
[deliverable/lttng-modules.git] / wrapper / splice.c
1 /*
2 * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com)
3 *
4 * wrapper around splice_to_pipe. 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 #include "kallsyms.h"
17
18 static
19 ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe,
20 struct splice_pipe_desc *spd);
21
22 ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
23 struct splice_pipe_desc *spd)
24 {
25 if (!splice_to_pipe_sym)
26 splice_to_pipe_sym = (void *) kallsyms_lookup_funcptr("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
35 #else
36
37 #include <linux/fs.h>
38 #include <linux/splice.h>
39
40 ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
41 struct splice_pipe_desc *spd)
42 {
43 return splice_to_pipe(pipe, spd);
44 }
45
46 #endif
This page took 0.034815 seconds and 6 git commands to generate.