Fix: update writeback instrumentation for kernel 4.14
[lttng-modules.git] / wrapper / splice.c
CommitLineData
5dd620fa 1/*
886d51a3 2 * wrapper/splice.c
5dd620fa 3 *
711e3212 4 * wrapper around splice_to_pipe. Using KALLSYMS to get its address when
5dd620fa
MD
5 * available, else we need to have a kernel that exports this function to GPL
6 * modules.
7 *
886d51a3
MD
8 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; only
13 * version 2.1 of the License.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5dd620fa
MD
23 */
24
25#ifdef CONFIG_KALLSYMS
26
27#include <linux/kallsyms.h>
28#include <linux/fs.h>
29#include <linux/splice.h>
5a2f5e92 30#include <wrapper/kallsyms.h>
5dd620fa
MD
31
32static
33ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe,
34 struct splice_pipe_desc *spd);
35
36ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
37 struct splice_pipe_desc *spd)
38{
39 if (!splice_to_pipe_sym)
c539a324 40 splice_to_pipe_sym = (void *) kallsyms_lookup_funcptr("splice_to_pipe");
5dd620fa
MD
41 if (splice_to_pipe_sym) {
42 return splice_to_pipe_sym(pipe, spd);
43 } else {
e36de50d 44 printk_once(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n");
5dd620fa
MD
45 return -ENOSYS;
46 }
47}
48
49#else
50
51#include <linux/fs.h>
52#include <linux/splice.h>
53
54ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
55 struct splice_pipe_desc *spd)
56{
57 return splice_to_pipe(pipe, spd);
58}
59
60#endif
This page took 0.033157 seconds and 4 git commands to generate.