From: Mathieu Desnoyers Date: Thu, 9 Jun 2011 20:45:38 +0000 (-0400) Subject: Move splice wrapper into c file X-Git-Tag: v2.0-pre1~55^2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5dd620faf35aaa3f5633435e22556d843f9cd4a5;p=lttng-modules.git Move splice wrapper into c file Don't require a kallsyms lookup each time the wrapper is called. Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/Makefile b/lib/Makefile index 1697b7f5..3fc82edc 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -8,4 +8,5 @@ lib-ring-buffer-objs := \ ringbuffer/ring_buffer_splice.o \ ringbuffer/ring_buffer_mmap.o \ prio_heap/lttng_prio_heap.o \ - ../wrapper/poll.o + ../wrapper/poll.o \ + ../wrapper/splice.o diff --git a/wrapper/splice.c b/wrapper/splice.c new file mode 100644 index 00000000..edc499c8 --- /dev/null +++ b/wrapper/splice.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) + * + * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when + * available, else we need to have a kernel that exports this function to GPL + * modules. + * + * Dual LGPL v2.1/GPL v2 license. + */ + +#ifdef CONFIG_KALLSYMS + +#include +#include +#include + +static +ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe, + struct splice_pipe_desc *spd); + +ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, + struct splice_pipe_desc *spd) +{ + if (!splice_to_pipe_sym) + splice_to_pipe_sym = (void *) kallsyms_lookup_name("splice_to_pipe"); + if (splice_to_pipe_sym) { + return splice_to_pipe_sym(pipe, spd); + } else { + printk(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n"); + return -ENOSYS; + } +} + +#else + +#include +#include + +ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, + struct splice_pipe_desc *spd) +{ + return splice_to_pipe(pipe, spd); +} + +#endif diff --git a/wrapper/splice.h b/wrapper/splice.h index 5f400747..d419847d 100644 --- a/wrapper/splice.h +++ b/wrapper/splice.h @@ -11,36 +11,9 @@ * Dual LGPL v2.1/GPL v2 license. */ -#ifdef CONFIG_KALLSYMS - -#include -#include - -static inline -ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, - struct splice_pipe_desc *spd) -{ - ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe, - struct splice_pipe_desc *spd); - - splice_to_pipe_sym = (void *) kallsyms_lookup_name("splice_to_pipe"); - if (splice_to_pipe_sym) { - return splice_to_pipe_sym(pipe, spd); - } else { - printk(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n"); - return -ENOSYS; - } -} -#else - #include -static inline ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, - struct splice_pipe_desc *spd) -{ - return splice_to_pipe(pipe, spd); -} -#endif + struct splice_pipe_desc *spd); #endif /* _LTT_WRAPPER_SPLICE_H */