Cleanup: remove trailing white spaces across project
[lttng-modules.git] / wrapper / splice.c
... / ...
CommitLineData
1/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2 *
3 * wrapper/splice.c
4 *
5 * wrapper around splice_to_pipe. Using KALLSYMS to get its address when
6 * available, else we need to have a kernel that exports this function to GPL
7 * modules.
8 *
9 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 */
11
12#ifdef CONFIG_KALLSYMS
13
14#include <linux/kallsyms.h>
15#include <linux/fs.h>
16#include <linux/splice.h>
17#include <wrapper/kallsyms.h>
18
19static
20ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe,
21 struct splice_pipe_desc *spd);
22
23ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
24 struct splice_pipe_desc *spd)
25{
26 if (!splice_to_pipe_sym)
27 splice_to_pipe_sym = (void *) kallsyms_lookup_funcptr("splice_to_pipe");
28 if (splice_to_pipe_sym) {
29 return splice_to_pipe_sym(pipe, spd);
30 } else {
31 printk_once(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n");
32 return -ENOSYS;
33 }
34}
35
36#else
37
38#include <linux/fs.h>
39#include <linux/splice.h>
40
41ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
42 struct splice_pipe_desc *spd)
43{
44 return splice_to_pipe(pipe, spd);
45}
46
47#endif
This page took 0.022988 seconds and 4 git commands to generate.