[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH -V4 08/26] [virtio-9p] clean up v9fs_mkdir.
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH -V4 08/26] [virtio-9p] clean up v9fs_mkdir. |
Date: |
Mon, 8 Aug 2011 22:33:56 +0530 |
From: Venkateswararao Jujjuri (JV) <address@hidden>
Rearrange the code so that we can avoid V9fsMkState and additional malloc()s.
Signed-off-by: Venkateswararao Jujjuri "<address@hidden>
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/9pfs/virtio-9p.c | 38 +++++++++++++++++---------------------
1 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index bb0fb54..7af3883 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -3310,46 +3310,42 @@ out:
static void v9fs_mkdir(void *opaque)
{
V9fsPDU *pdu = opaque;
- V9fsState *s = pdu->s;
+ size_t offset = 7;
int32_t fid;
- V9fsMkState *vs;
- int err = 0;
+ struct stat stbuf;
+ V9fsString name, fullname;
+ V9fsQID qid;
V9fsFidState *fidp;
gid_t gid;
int mode;
+ int err = 0;
- vs = qemu_malloc(sizeof(*vs));
- vs->pdu = pdu;
- vs->offset = 7;
-
- v9fs_string_init(&vs->fullname);
- pdu_unmarshal(vs->pdu, vs->offset, "dsdd", &fid, &vs->name, &mode,
- &gid);
+ v9fs_string_init(&fullname);
+ pdu_unmarshal(pdu, offset, "dsdd", &fid, &name, &mode, &gid);
- fidp = lookup_fid(s, fid);
+ fidp = lookup_fid(pdu->s, fid);
if (fidp == NULL) {
err = -ENOENT;
goto out;
}
- v9fs_string_sprintf(&vs->fullname, "%s/%s", fidp->path.data,
vs->name.data);
- err = v9fs_do_mkdir(s, vs->fullname.data, mode, fidp->uid, gid);
+ v9fs_string_sprintf(&fullname, "%s/%s", fidp->path.data, name.data);
+ err = v9fs_do_mkdir(pdu->s, fullname.data, mode, fidp->uid, gid);
if (err == -1) {
err = -errno;
goto out;
}
- err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf);
+ err = v9fs_do_lstat(pdu->s, &fullname, &stbuf);
if (err == -1) {
err = -errno;
goto out;
}
- stat_to_qid(&vs->stbuf, &vs->qid);
- vs->offset += pdu_marshal(vs->pdu, vs->offset, "Q", &vs->qid);
- err = vs->offset;
+ stat_to_qid(&stbuf, &qid);
+ offset += pdu_marshal(pdu, offset, "Q", &qid);
+ err = offset;
out:
- complete_pdu(s, vs->pdu, err);
- v9fs_string_free(&vs->fullname);
- v9fs_string_free(&vs->name);
- qemu_free(vs);
+ complete_pdu(pdu->s, pdu, err);
+ v9fs_string_free(&fullname);
+ v9fs_string_free(&name);
}
static void v9fs_post_xattr_getvalue(V9fsState *s, V9fsXattrState *vs, int err)
--
1.7.4.1
- [Qemu-devel] [PATCH -V4 16/26] hw/9pfs: Update v9fs_setattr to use coroutines, (continued)
- [Qemu-devel] [PATCH -V4 16/26] hw/9pfs: Update v9fs_setattr to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 18/26] hw/9pfs: Update v9fs_xattrwalk to coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 21/26] hw/9pfs: Update v9fs_mknod to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 20/26] hw/9pfs: Add yield support to mknod coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 19/26] hw/9pfs: Update v9fs_xattrcreate to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 23/26] [virtio-9p] Remove post functions for v9fs_remove, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 22/26] [virtio-9p] coroutine and threading for mkdir, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 25/26] [virtio-9p] coroutine and threading for remove/unlink, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 24/26] [virtio-9p] clean up v9fs_remove., Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 26/26] hw/9pfs: Add yeild support to rename coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 08/26] [virtio-9p] clean up v9fs_mkdir.,
Aneesh Kumar K.V <=
- [Qemu-devel] [PATCH -V4 11/26] hw/9pfs: Add yield support to statfs coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PULL] [PATCHSET 1] VirtFS coroutine changes, Aneesh Kumar K.V, 2011/08/11