@@ -3586,35 +3586,30 @@ out:
static void v9fs_readlink(void *opaque)
{
V9fsPDU *pdu = opaque;
- V9fsState *s = pdu->s;
+ 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(pdu, offset, "d", &fid);
+ fidp = lookup_fid(pdu->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(pdu->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(pdu, offset, "s", &target);
+ err = offset;
+ v9fs_string_free(&target);
out:
- complete_pdu(s, vs->pdu, err);
- qemu_free(vs);
+ complete_pdu(pdu->s, pdu, err);
}
static CoroutineEntry *pdu_co_handlers[] = {
@@ -495,13 +495,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);
Rearrange the code so that we can avoid V9fsReadLinkState. Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com> --- hw/9pfs/virtio-9p.c | 25 ++++++++++--------------- hw/9pfs/virtio-9p.h | 7 ------- 2 files changed, 10 insertions(+), 22 deletions(-)