[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/25] [virtio-9p] clean up v9fs_readlink.
From: |
Venkateswararao Jujjuri (JV) |
Subject: |
[Qemu-devel] [PATCH 04/25] [virtio-9p] clean up v9fs_readlink. |
Date: |
Thu, 12 May 2011 13:57:26 -0700 |
Rearrange the code so that we can avoid V9fsReadLinkState.
Signed-off-by: Venkateswararao Jujjuri "<address@hidden>
---
hw/9pfs/virtio-9p.c | 26 ++++++++++----------------
hw/9pfs/virtio-9p.h | 7 -------
2 files changed, 10 insertions(+), 23 deletions(-)
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 0b38868..c4d903a 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -3640,36 +3640,30 @@ out:
static void v9fs_readlink(void *opaque)
{
V9fsCoPdu *copdu = opaque;
- V9fsState *s = copdu->s;
- V9fsPDU *pdu = copdu->pdu;
+ size_t offset = 7;
+ V9fsString target;
int32_t fid;
- V9fsReadLinkState *vs;
int err = 0;
V9fsFidState *fidp;
- vs = qemu_malloc(sizeof(*vs));
- vs->pdu = pdu;
- vs->offset = 7;
-
- pdu_unmarshal(vs->pdu, vs->offset, "d", &fid);
- fidp = lookup_fid(s, fid);
+ pdu_unmarshal(copdu->pdu, offset, "d", &fid);
+ fidp = lookup_fid(copdu->s, fid);
if (fidp == NULL) {
err = -ENOENT;
goto out;
}
- v9fs_string_init(&vs->target);
- err = v9fs_do_readlink(s, &fidp->path, &vs->target);
+ v9fs_string_init(&target);
+ err = v9fs_do_readlink(copdu->s, &fidp->path, &target);
if (err < 0) {
err = -errno;
goto out;
}
- vs->offset += pdu_marshal(vs->pdu, vs->offset, "s", &vs->target);
- err = vs->offset;
- v9fs_string_free(&vs->target);
+ offset += pdu_marshal(copdu->pdu, offset, "s", &target);
+ err = offset;
+ v9fs_string_free(&target);
out:
- complete_pdu(s, vs->pdu, err);
- qemu_free(vs);
+ complete_pdu(copdu->s, copdu->pdu, err);
qemu_free(copdu);
}
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 5021da8..bf8f64b 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -493,13 +493,6 @@ typedef struct V9fsGetlockState
V9fsGetlock *glock;
} V9fsGetlockState;
-typedef struct V9fsReadLinkState
-{
- V9fsPDU *pdu;
- size_t offset;
- V9fsString target;
-} V9fsReadLinkState;
-
size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count,
size_t offset, size_t size, int pack);
--
1.7.1
- [Qemu-devel] [0/25] Async threading for VirtFS using glib threads & coroutines., Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 05/25] [virtio-9p] Move errno into v9fs_do_readlink, Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 03/25] [virtio-9p] Remove post functions for v9fs_readlink., Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 04/25] [virtio-9p] clean up v9fs_readlink.,
Venkateswararao Jujjuri (JV) <=
- [Qemu-devel] [PATCH 02/25] [virtio-9p] Change all pdu handlers to coroutines., Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 06/25] [virtio-9p] coroutines for readlink, Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 07/25] [virtio-9p] Remove post functions for v9fs_mkdir., Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 14/25] hw/9pfs: Update v9fs_getattr to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 12/25] hw/9pfs: Update v9fs_statfs to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/12
- [Qemu-devel] [PATCH 01/25] [virtio-9p] Add infrastructure to support glib threads and coroutines., Venkateswararao Jujjuri (JV), 2011/05/12