qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/5] experimental native preadv/pwritev support for


From: Christoph Hellwig
Subject: [Qemu-devel] [PATCH 5/5] experimental native preadv/pwritev support for Linux
Date: Sun, 29 Mar 2009 21:55:39 +0200
User-agent: Mutt/1.3.28i

This ties up Gerd Hoffmann's unmerged preadv/pwritev syscalls to qemu.  Use with
care as the syscall numbers aren't finalized yet.

Also the patch is ugly enough that I hope we might not need it at all if
preadv/pwritev go into glibc fast enough..


Signed-off-by: Christoph Hellwig <address@hidden>

Index: qemu/posix-aio-compat.c
===================================================================
--- qemu.orig/posix-aio-compat.c        2009-03-29 21:40:34.841130592 +0200
+++ qemu/posix-aio-compat.c     2009-03-29 21:42:13.582073269 +0200
@@ -33,7 +33,7 @@ static int cur_threads = 0;
 static int idle_threads = 0;
 static TAILQ_HEAD(, qemu_paiocb) request_list;
 
-#ifdef HAVE_PREADV
+#if defined(HAVE_PREADV) || (defined(__linux__) && defined(__i386__))
 static int preadv_present = 1;
 #else
 static int preadv_present = 0;
@@ -93,6 +93,31 @@ static size_t handle_aiocb_ioctl(struct 
        return ret;
 }
 
+#if defined (__linux__) && defined(__i386__)
+
+#define __NR_preadv             333
+#define __NR_pwritev            334
+
+static ssize_t
+qemu_preadv(int fd, const struct iovec *iov, int nr_iov, off_t offset)
+{
+    uint32_t pos_high = offset >> 32;
+    uint32_t pos_low = offset;
+
+    return syscall(__NR_preadv, fd, iov, (unsigned long)nr_iov, pos_high, 
pos_low);
+}
+
+static ssize_t
+qemu_pwritev(int fd, const struct iovec *iov, int nr_iov, off_t offset)
+{
+    uint32_t pos_high = offset >> 32;
+    uint32_t pos_low = offset;
+
+    return syscall(__NR_pwritev, fd, iov, (unsigned long)nr_iov, pos_high, 
pos_low);
+}
+
+#else
+
 #ifdef HAVE_PREADV
 
 static ssize_t
@@ -122,6 +147,7 @@ qemu_pwritev(int fd, const struct iovec 
 }
 
 #endif
+#endif
 
 /*
  * Check if we need to copy the data in the aiocb into a new




reply via email to

[Prev in Thread] Current Thread [Next in Thread]