dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0003-hw-9pfs-Improve-portability-to-older-systems.patch

Justin M. Forbes 45e84a
From f03969b952bc2aaf9f4445b6da28aebb0a9abde5 Mon Sep 17 00:00:00 2001
Justin M. Forbes 45e84a
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Justin M. Forbes 45e84a
Date: Sun, 4 Dec 2011 22:35:27 +0530
Justin M. Forbes 45e84a
Subject: [PATCH 03/25] hw/9pfs: Improve portability to older systems
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
handle fs driver require a set of newly added syscalls. Don't
Justin M. Forbes 45e84a
Compile handle FS driver if those syscalls are not available.
Justin M. Forbes 45e84a
Instead of adding #ifdef for all those syscalls we check for
Justin M. Forbes 45e84a
open by handle syscall. If that is available then rest of the
Justin M. Forbes 45e84a
syscalls used by the driver should be available.
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Justin M. Forbes 45e84a
---
Justin M. Forbes 45e84a
 Makefile.objs              |    4 ++--
Justin M. Forbes 45e84a
 fsdev/qemu-fsdev.c         |    2 ++
Justin M. Forbes 45e84a
 hw/9pfs/virtio-9p-handle.c |   33 ---------------------------------
Justin M. Forbes 45e84a
 3 files changed, 4 insertions(+), 35 deletions(-)
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
diff --git a/Makefile.objs b/Makefile.objs
Justin M. Forbes 45e84a
index d7a6539..3a699ee 100644
Justin M. Forbes 45e84a
--- a/Makefile.objs
Justin M. Forbes 45e84a
+++ b/Makefile.objs
Justin M. Forbes 45e84a
@@ -310,8 +310,8 @@ hw-obj-$(CONFIG_SOUND) += $(sound-obj-y)
Justin M. Forbes 45e84a
 9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-local.o virtio-9p-xattr.o
Justin M. Forbes 45e84a
 9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-xattr-user.o virtio-9p-posix-acl.o
Justin M. Forbes 45e84a
 9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-coth.o cofs.o codir.o cofile.o
Justin M. Forbes 45e84a
-9pfs-nested-$(CONFIG_VIRTFS) += coxattr.o virtio-9p-handle.o
Justin M. Forbes 45e84a
-9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-synth.o
Justin M. Forbes 45e84a
+9pfs-nested-$(CONFIG_VIRTFS) += coxattr.o virtio-9p-synth.o
Justin M. Forbes 45e84a
+9pfs-nested-$(CONFIG_OPEN_BY_HANDLE) +=  virtio-9p-handle.o
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
 hw-obj-$(CONFIG_REALLY_VIRTFS) += $(addprefix 9pfs/, $(9pfs-nested-y))
Justin M. Forbes 45e84a
 $(addprefix 9pfs/, $(9pfs-nested-y)): QEMU_CFLAGS+=$(GLIB_CFLAGS)
Justin M. Forbes 45e84a
diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
Justin M. Forbes 45e84a
index 7fd2aa7..6684f7e 100644
Justin M. Forbes 45e84a
--- a/fsdev/qemu-fsdev.c
Justin M. Forbes 45e84a
+++ b/fsdev/qemu-fsdev.c
Justin M. Forbes 45e84a
@@ -23,7 +23,9 @@ static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
 static FsDriverTable FsDrivers[] = {
Justin M. Forbes 45e84a
     { .name = "local", .ops = &local_ops},
Justin M. Forbes 45e84a
+#ifdef CONFIG_OPEN_BY_HANDLE
Justin M. Forbes 45e84a
     { .name = "handle", .ops = &handle_ops},
Justin M. Forbes 45e84a
+#endif
Justin M. Forbes 45e84a
     { .name = "synth", .ops = &synth_ops},
Justin M. Forbes 45e84a
 };
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c
Justin M. Forbes 45e84a
index 7644ae5..a62f690 100644
Justin M. Forbes 45e84a
--- a/hw/9pfs/virtio-9p-handle.c
Justin M. Forbes 45e84a
+++ b/hw/9pfs/virtio-9p-handle.c
Justin M. Forbes 45e84a
@@ -45,7 +45,6 @@ struct handle_data {
Justin M. Forbes 45e84a
     int handle_bytes;
Justin M. Forbes 45e84a
 };
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
-#ifdef CONFIG_OPEN_BY_HANDLE
Justin M. Forbes 45e84a
 static inline int name_to_handle(int dirfd, const char *name,
Justin M. Forbes 45e84a
                                  struct file_handle *fh, int *mnt_id, int flags)
Justin M. Forbes 45e84a
 {
Justin M. Forbes 45e84a
@@ -56,38 +55,6 @@ static inline int open_by_handle(int mountfd, const char *fh, int flags)
Justin M. Forbes 45e84a
 {
Justin M. Forbes 45e84a
     return open_by_handle_at(mountfd, (struct file_handle *)fh, flags);
Justin M. Forbes 45e84a
 }
Justin M. Forbes 45e84a
-#else
Justin M. Forbes 45e84a
-
Justin M. Forbes 45e84a
-struct rpl_file_handle {
Justin M. Forbes 45e84a
-    unsigned int handle_bytes;
Justin M. Forbes 45e84a
-    int handle_type;
Justin M. Forbes 45e84a
-    unsigned char handle[0];
Justin M. Forbes 45e84a
-};
Justin M. Forbes 45e84a
-#define file_handle rpl_file_handle
Justin M. Forbes 45e84a
-
Justin M. Forbes 45e84a
-#ifndef AT_REMOVEDIR
Justin M. Forbes 45e84a
-#define AT_REMOVEDIR    0x200
Justin M. Forbes 45e84a
-#endif
Justin M. Forbes 45e84a
-#ifndef AT_EMPTY_PATH
Justin M. Forbes 45e84a
-#define AT_EMPTY_PATH   0x1000  /* Allow empty relative pathname */
Justin M. Forbes 45e84a
-#endif
Justin M. Forbes 45e84a
-#ifndef O_PATH
Justin M. Forbes 45e84a
-#define O_PATH    010000000
Justin M. Forbes 45e84a
-#endif
Justin M. Forbes 45e84a
-
Justin M. Forbes 45e84a
-static inline int name_to_handle(int dirfd, const char *name,
Justin M. Forbes 45e84a
-                                 struct file_handle *fh, int *mnt_id, int flags)
Justin M. Forbes 45e84a
-{
Justin M. Forbes 45e84a
-    errno = ENOSYS;
Justin M. Forbes 45e84a
-    return -1;
Justin M. Forbes 45e84a
-}
Justin M. Forbes 45e84a
-
Justin M. Forbes 45e84a
-static inline int open_by_handle(int mountfd, const char *fh, int flags)
Justin M. Forbes 45e84a
-{
Justin M. Forbes 45e84a
-    errno = ENOSYS;
Justin M. Forbes 45e84a
-    return -1;
Justin M. Forbes 45e84a
-}
Justin M. Forbes 45e84a
-#endif
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
 static int handle_update_file_cred(int dirfd, const char *name, FsCred *credp)
Justin M. Forbes 45e84a
 {
Justin M. Forbes 45e84a
-- 
Justin M. Forbes 45e84a
1.7.7.5
Justin M. Forbes 45e84a