[Ocfs2-test-devel] [PATCH 2/4] Ocfs2-test: Add kapi-compat for ocfs2.

Tristan Ye tristan.ye at oracle.com
Tue Apr 14 00:27:52 PDT 2009


Such kapi-compat also was ported from ocfs2-1.4 git src, and move splice.h
into it from splice_test.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 Makefile                     |    2 ++
 kapi-compat/include/splice.h |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100644 kapi-compat/include/splice.h

diff --git a/Makefile b/Makefile
index d8d3f52..9074998 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,8 @@ SUBDIRS = programs utilities tests suites
 
 SUBDIRS += vendor
 
+KAPI_COMPAT_FILES = \
+	kapi-compat/include/splice.h
 
 DIST_FILES = \
 	COPYING					\
diff --git a/kapi-compat/include/splice.h b/kapi-compat/include/splice.h
new file mode 100644
index 0000000..c84eeff
--- /dev/null
+++ b/kapi-compat/include/splice.h
@@ -0,0 +1,38 @@
+#ifndef KAPI_SPLICE_H
+#define KAPI_SPLICE_H
+
+#include <unistd.h>
+#include <fcntl.h>
+
+#if defined(__i386__)
+
+#define __NR_splice	313
+
+#elif defined(__x86_64__)
+
+#define __NR_splice	275
+
+#elif defined(__powerpc__)
+
+#define __NR_splice	283
+
+#elif defined(__s390__)
+
+#define __NR_splice	306
+
+#elif defined(__ia64__)
+
+#define __NR_splice	1297
+
+#else
+#error unsupported arch
+#endif
+
+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
+
-- 
1.5.5




More information about the Ocfs2-test-devel mailing list