diff options
author | Wei Liu <wei.liu2@citrix.com> | 2015-11-30 16:14:29 +0000 |
---|---|---|
committer | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2016-01-08 14:35:06 +0530 |
commit | 2209bd050a9287120b74f8616837293d739c5fb3 (patch) | |
tree | a7e4380dcadee18ed1ecfed2458a174d9b7c5188 /fsdev | |
parent | 829dd2861a0f925526c5598d65a1bc05de9186c2 (diff) | |
download | qemu-2209bd050a9287120b74f8616837293d739c5fb3.zip qemu-2209bd050a9287120b74f8616837293d739c5fb3.tar.gz qemu-2209bd050a9287120b74f8616837293d739c5fb3.tar.bz2 |
fsdev: rename virtio-9p-marshal.{c,h} to 9p-iov-marshal.{c,h}
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>
Diffstat (limited to 'fsdev')
-rw-r--r-- | fsdev/9p-iov-marshal.c (renamed from fsdev/virtio-9p-marshal.c) | 110 | ||||
-rw-r--r-- | fsdev/9p-iov-marshal.h | 13 | ||||
-rw-r--r-- | fsdev/Makefile.objs | 2 | ||||
-rw-r--r-- | fsdev/virtfs-proxy-helper.c | 4 | ||||
-rw-r--r-- | fsdev/virtio-9p-marshal.h | 13 |
5 files changed, 76 insertions, 66 deletions
diff --git a/fsdev/virtio-9p-marshal.c b/fsdev/9p-iov-marshal.c index f236bab..4883b60 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 0000000..993614f --- /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 8357851..1b120a4 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 7753654..44c7d88 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 0709bcd..0000000 --- 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 |