[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/29] hw/9pfs: Update v9fs_getlock to use coroutine
From: |
Venkateswararao Jujjuri (JV) |
Subject: |
[Qemu-devel] [PATCH 05/29] hw/9pfs: Update v9fs_getlock to use coroutines |
Date: |
Wed, 25 May 2011 16:52:53 -0700 |
From: Aneesh Kumar K.V <address@hidden>
Signed-off-by: Aneesh Kumar K.V <address@hidden>
Signed-off-by: Venkateswararao Jujjuri "<address@hidden>
---
hw/9pfs/virtio-9p.c | 42 +++++++++++++++++++-----------------------
hw/9pfs/virtio-9p.h | 9 ---------
2 files changed, 19 insertions(+), 32 deletions(-)
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 1729422..e6032cd 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -3052,42 +3052,38 @@ out:
* When a TGETLOCK request comes, always return success because all lock
* handling is done by client's VFS layer.
*/
-
static void v9fs_getlock(void *opaque)
{
+ size_t offset = 7;
+ struct stat stbuf;
+ V9fsFidState *fidp;
+ V9fsGetlock *glock;
+ int32_t fid, err = 0;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
- int32_t fid, err = 0;
- V9fsGetlockState *vs;
- vs = qemu_mallocz(sizeof(*vs));
- vs->pdu = pdu;
- vs->offset = 7;
-
- vs->glock = qemu_malloc(sizeof(*vs->glock));
- pdu_unmarshal(vs->pdu, vs->offset, "dbqqds", &fid, &vs->glock->type,
- &vs->glock->start, &vs->glock->length, &vs->glock->proc_id,
- &vs->glock->client_id);
+ glock = qemu_malloc(sizeof(*glock));
+ pdu_unmarshal(pdu, offset, "dbqqds", &fid, &glock->type,
+ &glock->start, &glock->length, &glock->proc_id,
+ &glock->client_id);
- vs->fidp = lookup_fid(s, fid);
- if (vs->fidp == NULL) {
+ fidp = lookup_fid(s, fid);
+ if (fidp == NULL) {
err = -ENOENT;
goto out;
}
-
- err = v9fs_do_fstat(s, vs->fidp->fs.fd, &vs->stbuf);
+ err = v9fs_co_fstat(s, fidp->fs.fd, &stbuf);
if (err < 0) {
- err = -errno;
goto out;
}
- vs->glock->type = F_UNLCK;
- vs->offset += pdu_marshal(vs->pdu, vs->offset, "bqqds", vs->glock->type,
- vs->glock->start, vs->glock->length, vs->glock->proc_id,
- &vs->glock->client_id);
+ glock->type = F_UNLCK;
+ offset += pdu_marshal(pdu, offset, "bqqds", glock->type,
+ glock->start, glock->length, glock->proc_id,
+ &glock->client_id);
+ err = offset;
out:
- complete_pdu(s, vs->pdu, err);
- qemu_free(vs->glock);
- qemu_free(vs);
+ complete_pdu(s, pdu, err);
+ qemu_free(glock);
}
static void v9fs_mkdir(void *opaque)
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 0c1e3ee..edf3413 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -412,15 +412,6 @@ typedef struct V9fsGetlock
V9fsString client_id;
} V9fsGetlock;
-typedef struct V9fsGetlockState
-{
- V9fsPDU *pdu;
- size_t offset;
- struct stat stbuf;
- V9fsFidState *fidp;
- V9fsGetlock *glock;
-} V9fsGetlockState;
-
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/29] Second batch of VirtFS routines converted to coroutines., Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 02/29] hw/9pfs: Update vfs_rename to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 06/29] hw/9pfs: Add yield support for open and opendir coroutine, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 03/29] hw/9pfs: Add yeild support for fstat coroutine, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 01/29] hw/9pfs: Add yeild support to rename coroutine, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 04/29] hw/9pfs: Update v9fs_lock to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 09/29] [virtio-9p] clean up v9fs_lcreate, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 05/29] hw/9pfs: Update v9fs_getlock to use coroutines,
Venkateswararao Jujjuri (JV) <=
- [Qemu-devel] [PATCH 14/29] hw/9pfs: Update v9fs_clunk to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 07/29] hw/9pfs: Update v9fs_open to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 16/29] hw/9pfs: Update v9fs_fsync to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 22/29] [virtio-9p] coroutine and threading for v9fs_do_link, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 10/29] [PATCH] [virtio-9p] coroutine and threading for open2, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 12/29] hw/9pfs: Update v9fs_walk to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 17/29] [virtio-9p] Remove post functions for v9fs_create, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 20/29] [virtio-9p] clean up v9fs_symlink, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 19/29] [virtio-9p] Remove post functions for v9fs_symlink, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 18/29] [virtio-9p] clean up v9fs_create Rearrange the code, Venkateswararao Jujjuri (JV), 2011/05/25