qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: peter.maydell@linaro.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	qemu-devel@nongnu.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 11/25] fsdev: rename virtio-9p-marshal.{c, h} to 9p-iov-marshal.{c, h}
Date: Tue, 12 Jan 2016 11:38:18 +0530	[thread overview]
Message-ID: <1452578912-12546-12-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1452578912-12546-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

From: Wei Liu <wei.liu2@citrix.com>

And rename v9fs_marshal to v9fs_iov_marshal, v9fs_unmarshal to
v9fs_iov_unmarshal.

The rationale behind this change is that, this marshalling interface is
used both by virtio and proxy helper. Renaming files and functions to
reflect the true nature of this interface.

Xen transport is going to have its own marshalling interface.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 Makefile                                        |   2 +-
 fsdev/{virtio-9p-marshal.c => 9p-iov-marshal.c} | 110 +++++++++++++-----------
 fsdev/9p-iov-marshal.h                          |  13 +++
 fsdev/Makefile.objs                             |   2 +-
 fsdev/virtfs-proxy-helper.c                     |   4 +-
 fsdev/virtio-9p-marshal.h                       |  13 ---
 hw/9pfs/9p-proxy.h                              |   4 +-
 hw/9pfs/virtio-9p.h                             |   6 +-
 8 files changed, 82 insertions(+), 72 deletions(-)
 rename fsdev/{virtio-9p-marshal.c => 9p-iov-marshal.c} (62%)
 create mode 100644 fsdev/9p-iov-marshal.h
 delete mode 100644 fsdev/virtio-9p-marshal.h

diff --git a/Makefile b/Makefile
index 7e881d88664f..d0de2d46b663 100644
--- a/Makefile
+++ b/Makefile
@@ -240,7 +240,7 @@ qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(qom-obj-y) libqemuu
 
 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
 
-fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/virtio-9p-marshal.o libqemuutil.a libqemustub.a
+fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
diff --git a/fsdev/virtio-9p-marshal.c b/fsdev/9p-iov-marshal.c
similarity index 62%
rename from fsdev/virtio-9p-marshal.c
rename to fsdev/9p-iov-marshal.c
index f236bab374cb..4883b60d17ca 100644
--- a/fsdev/virtio-9p-marshal.c
+++ b/fsdev/9p-iov-marshal.c
@@ -1,5 +1,5 @@
 /*
- * Virtio 9p backend
+ * 9p backend
  *
  * Copyright IBM, Corp. 2010
  *
@@ -22,7 +22,7 @@
 #include <errno.h>
 
 #include "qemu/compiler.h"
-#include "virtio-9p-marshal.h"
+#include "9p-iov-marshal.h"
 #include "qemu/bswap.h"
 
 static ssize_t v9fs_packunpack(void *addr, struct iovec *sg, int sg_count,
@@ -76,8 +76,8 @@ ssize_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset,
     return v9fs_packunpack((void *)src, in_sg, in_num, offset, size, 1);
 }
 
-ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
-                       int bswap, const char *fmt, ...)
+ssize_t v9fs_iov_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
+                           int bswap, const char *fmt, ...)
 {
     int i;
     va_list ap;
@@ -127,8 +127,8 @@ ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
         }
         case 's': {
             V9fsString *str = va_arg(ap, V9fsString *);
-            copied = v9fs_unmarshal(out_sg, out_num, offset, bswap,
-                                    "w", &str->size);
+            copied = v9fs_iov_unmarshal(out_sg, out_num, offset, bswap,
+                                        "w", &str->size);
             if (copied > 0) {
                 offset += copied;
                 str->data = g_malloc(str->size + 1);
@@ -144,31 +144,36 @@ ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
         }
         case 'Q': {
             V9fsQID *qidp = va_arg(ap, V9fsQID *);
-            copied = v9fs_unmarshal(out_sg, out_num, offset, bswap, "bdq",
-                                    &qidp->type, &qidp->version, &qidp->path);
+            copied = v9fs_iov_unmarshal(out_sg, out_num, offset, bswap,
+                                        "bdq", &qidp->type, &qidp->version,
+                                        &qidp->path);
             break;
         }
         case 'S': {
             V9fsStat *statp = va_arg(ap, V9fsStat *);
-            copied = v9fs_unmarshal(out_sg, out_num, offset, bswap,
-                                    "wwdQdddqsssssddd",
-                                    &statp->size, &statp->type, &statp->dev,
-                                    &statp->qid, &statp->mode, &statp->atime,
-                                    &statp->mtime, &statp->length,
-                                    &statp->name, &statp->uid, &statp->gid,
-                                    &statp->muid, &statp->extension,
-                                    &statp->n_uid, &statp->n_gid,
-                                    &statp->n_muid);
+            copied = v9fs_iov_unmarshal(out_sg, out_num, offset, bswap,
+                                        "wwdQdddqsssssddd",
+                                        &statp->size, &statp->type,
+                                        &statp->dev, &statp->qid,
+                                        &statp->mode, &statp->atime,
+                                        &statp->mtime, &statp->length,
+                                        &statp->name, &statp->uid,
+                                        &statp->gid, &statp->muid,
+                                        &statp->extension,
+                                        &statp->n_uid, &statp->n_gid,
+                                        &statp->n_muid);
             break;
         }
         case 'I': {
             V9fsIattr *iattr = va_arg(ap, V9fsIattr *);
-            copied = v9fs_unmarshal(out_sg, out_num, offset, bswap,
-                                    "ddddqqqqq",
-                                    &iattr->valid, &iattr->mode,
-                                    &iattr->uid, &iattr->gid, &iattr->size,
-                                    &iattr->atime_sec, &iattr->atime_nsec,
-                                    &iattr->mtime_sec, &iattr->mtime_nsec);
+            copied = v9fs_iov_unmarshal(out_sg, out_num, offset, bswap,
+                                        "ddddqqqqq",
+                                        &iattr->valid, &iattr->mode,
+                                        &iattr->uid, &iattr->gid,
+                                        &iattr->size, &iattr->atime_sec,
+                                        &iattr->atime_nsec,
+                                        &iattr->mtime_sec,
+                                        &iattr->mtime_nsec);
             break;
         }
         default:
@@ -185,8 +190,8 @@ ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
     return offset - old_offset;
 }
 
-ssize_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset,
-                     int bswap, const char *fmt, ...)
+ssize_t v9fs_iov_marshal(struct iovec *in_sg, int in_num, size_t offset,
+                         int bswap, const char *fmt, ...)
 {
     int i;
     va_list ap;
@@ -233,8 +238,8 @@ ssize_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset,
         }
         case 's': {
             V9fsString *str = va_arg(ap, V9fsString *);
-            copied = v9fs_marshal(in_sg, in_num, offset, bswap,
-                                  "w", str->size);
+            copied = v9fs_iov_marshal(in_sg, in_num, offset, bswap,
+                                      "w", str->size);
             if (copied > 0) {
                 offset += copied;
                 copied = v9fs_pack(in_sg, in_num, offset, str->data, str->size);
@@ -243,37 +248,42 @@ ssize_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset,
         }
         case 'Q': {
             V9fsQID *qidp = va_arg(ap, V9fsQID *);
-            copied = v9fs_marshal(in_sg, in_num, offset, bswap, "bdq",
-                                  qidp->type, qidp->version, qidp->path);
+            copied = v9fs_iov_marshal(in_sg, in_num, offset, bswap, "bdq",
+                                      qidp->type, qidp->version,
+                                      qidp->path);
             break;
         }
         case 'S': {
             V9fsStat *statp = va_arg(ap, V9fsStat *);
-            copied = v9fs_marshal(in_sg, in_num, offset, bswap,
-                                  "wwdQdddqsssssddd",
-                                  statp->size, statp->type, statp->dev,
-                                  &statp->qid, statp->mode, statp->atime,
-                                  statp->mtime, statp->length, &statp->name,
-                                  &statp->uid, &statp->gid, &statp->muid,
-                                  &statp->extension, statp->n_uid,
-                                  statp->n_gid, statp->n_muid);
+            copied = v9fs_iov_marshal(in_sg, in_num, offset, bswap,
+                                      "wwdQdddqsssssddd",
+                                      statp->size, statp->type, statp->dev,
+                                      &statp->qid, statp->mode, statp->atime,
+                                      statp->mtime, statp->length,
+                                      &statp->name,
+                                      &statp->uid, &statp->gid, &statp->muid,
+                                      &statp->extension, statp->n_uid,
+                                      statp->n_gid, statp->n_muid);
             break;
         }
         case 'A': {
             V9fsStatDotl *statp = va_arg(ap, V9fsStatDotl *);
-            copied = v9fs_marshal(in_sg, in_num, offset, bswap,
-                                   "qQdddqqqqqqqqqqqqqqq",
-                                   statp->st_result_mask,
-                                   &statp->qid, statp->st_mode,
-                                   statp->st_uid, statp->st_gid,
-                                   statp->st_nlink, statp->st_rdev,
-                                   statp->st_size, statp->st_blksize,
-                                   statp->st_blocks, statp->st_atime_sec,
-                                   statp->st_atime_nsec, statp->st_mtime_sec,
-                                   statp->st_mtime_nsec, statp->st_ctime_sec,
-                                   statp->st_ctime_nsec, statp->st_btime_sec,
-                                   statp->st_btime_nsec, statp->st_gen,
-                                   statp->st_data_version);
+            copied = v9fs_iov_marshal(in_sg, in_num, offset, bswap,
+                                      "qQdddqqqqqqqqqqqqqqq",
+                                      statp->st_result_mask,
+                                      &statp->qid, statp->st_mode,
+                                      statp->st_uid, statp->st_gid,
+                                      statp->st_nlink, statp->st_rdev,
+                                      statp->st_size, statp->st_blksize,
+                                      statp->st_blocks, statp->st_atime_sec,
+                                      statp->st_atime_nsec,
+                                      statp->st_mtime_sec,
+                                      statp->st_mtime_nsec,
+                                      statp->st_ctime_sec,
+                                      statp->st_ctime_nsec,
+                                      statp->st_btime_sec,
+                                      statp->st_btime_nsec, statp->st_gen,
+                                      statp->st_data_version);
             break;
         }
         default:
diff --git a/fsdev/9p-iov-marshal.h b/fsdev/9p-iov-marshal.h
new file mode 100644
index 000000000000..993614f54400
--- /dev/null
+++ b/fsdev/9p-iov-marshal.h
@@ -0,0 +1,13 @@
+#ifndef _QEMU_9P_IOV_MARSHAL_H
+#define _QEMU_9P_IOV_MARSHAL_H
+
+#include "9p-marshal.h"
+
+
+ssize_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset,
+                  const void *src, size_t size);
+ssize_t v9fs_iov_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
+                           int bswap, const char *fmt, ...);
+ssize_t v9fs_iov_marshal(struct iovec *in_sg, int in_num, size_t offset,
+                         int bswap, const char *fmt, ...);
+#endif
diff --git a/fsdev/Makefile.objs b/fsdev/Makefile.objs
index 8357851fe7ba..1b120a4a7d47 100644
--- a/fsdev/Makefile.objs
+++ b/fsdev/Makefile.objs
@@ -1,7 +1,7 @@
 ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
 # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
 # only pull in the actual virtio-9p device if we also enabled virtio.
-common-obj-y = qemu-fsdev.o 9p-marshal.o virtio-9p-marshal.o
+common-obj-y = qemu-fsdev.o 9p-marshal.o 9p-iov-marshal.o
 else
 common-obj-y = qemu-fsdev-dummy.o
 endif
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 77536548d072..44c7d88f1bda 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -23,9 +23,9 @@
 #include "qemu-common.h"
 #include "qemu/sockets.h"
 #include "qemu/xattr.h"
-#include "virtio-9p-marshal.h"
+#include "9p-iov-marshal.h"
 #include "hw/9pfs/9p-proxy.h"
-#include "fsdev/virtio-9p-marshal.h"
+#include "fsdev/9p-iov-marshal.h"
 
 #define PROGNAME "virtfs-proxy-helper"
 
diff --git a/fsdev/virtio-9p-marshal.h b/fsdev/virtio-9p-marshal.h
deleted file mode 100644
index 0709bcd06da0..000000000000
--- a/fsdev/virtio-9p-marshal.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _QEMU_VIRTIO_9P_MARSHAL_H
-#define _QEMU_VIRTIO_9P_MARSHAL_H
-
-#include "9p-marshal.h"
-
-
-ssize_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset,
-                  const void *src, size_t size);
-ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
-                       int bswap, const char *fmt, ...);
-ssize_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset,
-                     int bswap, const char *fmt, ...);
-#endif
diff --git a/hw/9pfs/9p-proxy.h b/hw/9pfs/9p-proxy.h
index 56150b948b4c..ba9ca203de16 100644
--- a/hw/9pfs/9p-proxy.h
+++ b/hw/9pfs/9p-proxy.h
@@ -20,9 +20,9 @@
  * marsha/unmarshal doesn't do little endian conversion.
  */
 #define proxy_unmarshal(in_sg, offset, fmt, args...) \
-    v9fs_unmarshal(in_sg, 1, offset, 0, fmt, ##args)
+    v9fs_iov_unmarshal(in_sg, 1, offset, 0, fmt, ##args)
 #define proxy_marshal(out_sg, offset, fmt, args...) \
-    v9fs_marshal(out_sg, 1, offset, 0, fmt, ##args)
+    v9fs_iov_marshal(out_sg, 1, offset, 0, fmt, ##args)
 
 union MsgControl {
     struct cmsghdr cmsg;
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 3c78d3cee1d0..3a7e136ab691 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -10,7 +10,7 @@
 #include "standard-headers/linux/virtio_9p.h"
 #include "hw/virtio/virtio.h"
 #include "fsdev/file-op-9p.h"
-#include "fsdev/virtio-9p-marshal.h"
+#include "fsdev/9p-iov-marshal.h"
 #include "qemu/thread.h"
 #include "qemu/coroutine.h"
 
@@ -321,9 +321,9 @@ extern int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
                              const char *name, V9fsPath *path);
 
 #define pdu_marshal(pdu, offset, fmt, args...)  \
-    v9fs_marshal(pdu->elem.in_sg, pdu->elem.in_num, offset, 1, fmt, ##args)
+    v9fs_iov_marshal(pdu->elem.in_sg, pdu->elem.in_num, offset, 1, fmt, ##args)
 #define pdu_unmarshal(pdu, offset, fmt, args...)  \
-    v9fs_unmarshal(pdu->elem.out_sg, pdu->elem.out_num, offset, 1, fmt, ##args)
+    v9fs_iov_unmarshal(pdu->elem.out_sg, pdu->elem.out_num, offset, 1, fmt, ##args)
 
 #define TYPE_VIRTIO_9P "virtio-9p-device"
 #define VIRTIO_9P(obj) \
-- 
2.5.0

  parent reply	other threads:[~2016-01-12  6:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  6:08 [Qemu-devel] [PULL 00/25] VirtFS update Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 01/25] 9pfs: rename virtio-9p-coth.{c, h} to coth.{c, h} Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 02/25] 9pfs: rename virtio-9p-handle.c to 9p-handle.c Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 03/25] 9pfs: rename virtio-9p-local.c to 9p-local.c Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 04/25] 9pfs: rename virtio-9p-posix-acl.c to 9p-posix-acl.c Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 05/25] 9pfs: rename virtio-9p-proxy.{c, h} to 9p-proxy.{c, h} Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 06/25] 9pfs: rename virtio-9p-synth.{c, h} to 9p-synth.{c, h} Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 07/25] 9pfs: rename virtio-9p-xattr{, -user}.{c, h} to 9p-xattr{, -user}.{c, h} Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 08/25] 9pfs: merge hw/virtio/virtio-9p.h into hw/9pfs/virtio-9p.h Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 09/25] 9pfs: remove dead code Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 10/25] fsdev: break out 9p-marshal.{c, h} from virtio-9p-marshal.{c, h} Aneesh Kumar K.V
2016-01-12  6:08 ` Aneesh Kumar K.V [this message]
2016-01-12  6:08 ` [Qemu-devel] [PATCH 12/25] 9pfs: PDU processing functions don't need to take V9fsState as argument Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 13/25] 9pfs: PDU processing functions should start pdu_ prefix Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 14/25] 9pfs: make pdu_{, un}marshal proper functions Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 15/25] 9pfs: factor out virtio_pdu_{, un}marshal Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 16/25] 9pfs: factor out pdu_push_and_notify Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 17/25] 9pfs: break out virtio_init_iov_from_pdu Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 18/25] 9pfs: break out 9p.h from virtio-9p.h Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 19/25] 9pfs: factor out virtio_9p_push_and_notify Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 20/25] 9pfs: export pdu_{submit,alloc,free} Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 21/25] 9pfs: move handle_9p_output and make it static function Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 22/25] 9pfs: rename virtio_9p_set_fd_limit to use v9fs_ prefix Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 23/25] 9pfs: rename virtio-9p.c to 9p.c Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 24/25] 9pfs: factor out v9fs_device_{, un}realize_common Aneesh Kumar K.V
2016-01-12  6:08 ` [Qemu-devel] [PATCH 25/25] 9pfs: introduce V9fsVirtioState Aneesh Kumar K.V
2016-01-12 18:10 ` [Qemu-devel] [PULL 00/25] VirtFS update Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452578912-12546-12-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.liu2@citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).