[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH -V4 03/28] hw/9pfs: Update v9fs_lock to use coroutin
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH -V4 03/28] hw/9pfs: Update v9fs_lock to use coroutines |
Date: |
Mon, 8 Aug 2011 22:36:30 +0530 |
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/9pfs/virtio-9p.c | 44 ++++++++++++++++++++------------------------
hw/9pfs/virtio-9p.h | 10 ----------
2 files changed, 20 insertions(+), 34 deletions(-)
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index f2193d6..c8dfa16 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -3006,47 +3006,43 @@ out:
* do any thing in * qemu 9p server side lock code path.
* So when a TLOCK request comes, always return success
*/
-
static void v9fs_lock(void *opaque)
{
+ int8_t status;
+ V9fsFlock *flock;
+ size_t offset = 7;
+ struct stat stbuf;
+ V9fsFidState *fidp;
+ int32_t fid, err = 0;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
- int32_t fid, err = 0;
- V9fsLockState *vs;
-
- vs = qemu_mallocz(sizeof(*vs));
- vs->pdu = pdu;
- vs->offset = 7;
-
- vs->flock = qemu_malloc(sizeof(*vs->flock));
- pdu_unmarshal(vs->pdu, vs->offset, "dbdqqds", &fid, &vs->flock->type,
- &vs->flock->flags, &vs->flock->start, &vs->flock->length,
- &vs->flock->proc_id, &vs->flock->client_id);
- vs->status = P9_LOCK_ERROR;
+ flock = qemu_malloc(sizeof(*flock));
+ pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type,
+ &flock->flags, &flock->start, &flock->length,
+ &flock->proc_id, &flock->client_id);
+ status = P9_LOCK_ERROR;
/* We support only block flag now (that too ignored currently) */
- if (vs->flock->flags & ~P9_LOCK_FLAGS_BLOCK) {
+ if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) {
err = -EINVAL;
goto out;
}
- 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->status = P9_LOCK_SUCCESS;
+ status = P9_LOCK_SUCCESS;
out:
- vs->offset += pdu_marshal(vs->pdu, vs->offset, "b", vs->status);
- complete_pdu(s, vs->pdu, err);
- qemu_free(vs->flock);
- qemu_free(vs);
+ err = offset;
+ err += pdu_marshal(pdu, offset, "b", status);
+ complete_pdu(s, pdu, err);
+ qemu_free(flock);
}
/*
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 46d79da..0c1e3ee 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -403,16 +403,6 @@ typedef struct V9fsFlock
V9fsString client_id;
} V9fsFlock;
-typedef struct V9fsLockState
-{
- V9fsPDU *pdu;
- size_t offset;
- int8_t status;
- struct stat stbuf;
- V9fsFidState *fidp;
- V9fsFlock *flock;
-} V9fsLockState;
-
typedef struct V9fsGetlock
{
uint8_t type;
--
1.7.4.1
- [Qemu-devel] [PATCH -V4 12/28] hw/9pfs: Add yeild support for clunk related coroutine, (continued)
- [Qemu-devel] [PATCH -V4 12/28] hw/9pfs: Add yeild support for clunk related coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 21/28] [virtio-9p] coroutine and threading for v9fs_do_link, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 20/28] [virtio-9p] coroutine and threading for v9fs_do_symlink, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 28/28] use readdir_r instead of readdir for reentrancy, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 24/28] hw/9pfs: Update v9fs_wstat to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 01/28] hw/9pfs: Update vfs_rename to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 08/28] [virtio-9p] clean up v9fs_lcreate, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 23/28] hw/9pfs: Update v9fs_write to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 14/28] hw/9pfs: Add yield support for fsync coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 22/28] hw/9pfs: Add yield support for pwritev coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 03/28] hw/9pfs: Update v9fs_lock to use coroutines,
Aneesh Kumar K.V <=
- [Qemu-devel] [PATCH -V4 16/28] [virtio-9p] Remove post functions for v9fs_create, Aneesh Kumar K.V, 2011/08/08
- Re: [Qemu-devel] [PATCHSET 2] VirtFS coroutine changes, Aneesh Kumar K.V, 2011/08/11