[Ocfs2-test-devel] [PATCH] splice: fix splice() conflicted definitions

tristan.ye tristan.ye at oracle.com
Sun Mar 22 19:34:03 PDT 2009


On Sat, 2009-03-21 at 01:54 +0800, Coly Li wrote:
> the splice() defined in programs/splice/splice_test.h is conflicted with the one
> defined in /usr/include/bits/fcntl.h, which results a compiling error:
> 
> splice_test.h:35: error: conflicting types for ‘splice’
> /usr/include/bits/fcntl.h:244: error: previous declaration of ‘splice’ was here
> 
> This patch fixes the compiling error. When people wants to test the code with
> splice() from libc, just define USE_LIBC_SPLICE.
> 
> Signed-off-by: Coly Li <coly.li at suse.de>
> ---
>  programs/splice/splice_test.h |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/programs/splice/splice_test.h b/programs/splice/splice_test.h
> index 5113bbb..9a223d3 100644
> --- a/programs/splice/splice_test.h
> +++ b/programs/splice/splice_test.h
> @@ -31,9 +31,12 @@
>  #error unsupported arch
>  #endif
> 
> -int splice(int fdin, loff_t *off_in, int fdout,
> +int test_splice(int fdin, loff_t *off_in, int fdout,
>  			 loff_t *off_out, size_t len, unsigned int flags)
>  {
>  	return syscall(__NR_splice, fdin, off_in, fdout, off_out, len, flags);
>  }
> 
> +#ifndef USE_LIBC_SPLICE
> +#define splice test_splice
> +#endif

shouldn't it be following:

#ifndef USE_LIBC_SPLICE
int test_splice(int fdin, loff_t *off_in, int fdout,
                         loff_t *off_out, size_t len, unsigned int
flags)
{
        return syscall(__NR_splice, fdin, off_in, fdout, off_out, len,
flags);
}

#define splice test_splice
#else
int splice(int fdin, loff_t *off_in, int fdout,
                         loff_t *off_out, size_t len, unsigned int
flags)
{
        return syscall(__NR_splice, fdin, off_in, fdout, off_out, len,
flags);
}

#endif


> 
> --
> Coly Li
> SuSE Labs
> 
> _______________________________________________
> Ocfs2-test-devel mailing list
> Ocfs2-test-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-test-devel




More information about the Ocfs2-test-devel mailing list