[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH -V4 20/28] [virtio-9p] coroutine and threading for v
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH -V4 20/28] [virtio-9p] coroutine and threading for v9fs_do_symlink |
Date: |
Mon, 8 Aug 2011 22:36:47 +0530 |
From: Venkateswararao Jujjuri (JV) <address@hidden>
Signed-off-by: Venkateswararao Jujjuri "<address@hidden>
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/9pfs/cofs.c | 20 ++++++++++++++++++++
hw/9pfs/virtio-9p-coth.h | 2 ++
hw/9pfs/virtio-9p.c | 31 ++++++++-----------------------
3 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c
index 473ce53..60468bc 100644
--- a/hw/9pfs/cofs.c
+++ b/hw/9pfs/cofs.c
@@ -169,3 +169,23 @@ int v9fs_co_rename(V9fsState *s, V9fsString *oldpath,
V9fsString *newpath)
});
return err;
}
+
+int v9fs_co_symlink(V9fsState *s, V9fsFidState *fidp,
+ const char *oldpath, const char *newpath, gid_t gid)
+{
+ int err;
+ FsCred cred;
+
+ cred_init(&cred);
+ cred.fc_uid = fidp->uid;
+ cred.fc_gid = gid;
+ cred.fc_mode = 0777;
+ v9fs_co_run_in_worker(
+ {
+ err = s->ops->symlink(&s->ctx, oldpath, newpath, &cred);
+ if (err < 0) {
+ err = -errno;
+ }
+ });
+ return err;
+}
diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h
index a3881f3..e394933 100644
--- a/hw/9pfs/virtio-9p-coth.h
+++ b/hw/9pfs/virtio-9p-coth.h
@@ -86,4 +86,6 @@ extern int v9fs_co_lremovexattr(V9fsState *, V9fsString *,
V9fsString *);
extern int v9fs_co_closedir(V9fsState *, V9fsFidState *);
extern int v9fs_co_close(V9fsState *, V9fsFidState *);
extern int v9fs_co_fsync(V9fsState *, V9fsFidState *, int);
+extern int v9fs_co_symlink(V9fsState *, V9fsFidState *, const char *,
+ const char *, gid_t);
#endif
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 32a439c..1760cdb 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -117,18 +117,6 @@ static int v9fs_do_chmod(V9fsState *s, V9fsString *path,
mode_t mode)
return s->ops->chmod(&s->ctx, path->data, &cred);
}
-static int v9fs_do_symlink(V9fsState *s, V9fsFidState *fidp,
- const char *oldpath, const char *newpath, gid_t gid)
-{
- FsCred cred;
- cred_init(&cred);
- cred.fc_uid = fidp->uid;
- cred.fc_gid = gid;
- cred.fc_mode = 0777;
-
- return s->ops->symlink(&s->ctx, oldpath, newpath, &cred);
-}
-
static int v9fs_do_link(V9fsState *s, V9fsString *oldpath, V9fsString *newpath)
{
return s->ops->link(&s->ctx, oldpath->data, newpath->data);
@@ -2032,10 +2020,9 @@ static void v9fs_create(void *opaque)
}
fidp->fid_type = P9_FID_DIR;
} else if (perm & P9_STAT_MODE_SYMLINK) {
- err = v9fs_do_symlink(pdu->s, fidp, extension.data,
+ err = v9fs_co_symlink(pdu->s, fidp, extension.data,
fullname.data, -1);
if (err < 0) {
- err = -errno;
goto out;
}
} else if (perm & P9_STAT_MODE_LINK) {
@@ -2144,19 +2131,17 @@ static void v9fs_symlink(void *opaque)
}
v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data);
- err = v9fs_do_symlink(pdu->s, dfidp, symname.data, fullname.data, gid);
+ err = v9fs_co_symlink(pdu->s, dfidp, symname.data, fullname.data, gid);
if (err < 0) {
- err = -errno;
goto out;
}
- err = v9fs_do_lstat(pdu->s, &fullname, &stbuf);
- if (err == 0) {
- stat_to_qid(&stbuf, &qid);
- offset += pdu_marshal(pdu, offset, "Q", &qid);
- err = offset;
- } else {
- err = -errno;
+ err = v9fs_co_lstat(pdu->s, &fullname, &stbuf);
+ if (err < 0) {
+ goto out;
}
+ stat_to_qid(&stbuf, &qid);
+ offset += pdu_marshal(pdu, offset, "Q", &qid);
+ err = offset;
out:
complete_pdu(pdu->s, pdu, err);
v9fs_string_free(&name);
--
1.7.4.1
- [Qemu-devel] [PATCH -V4 06/28] hw/9pfs: Update v9fs_open to use coroutines, (continued)
- [Qemu-devel] [PATCH -V4 06/28] hw/9pfs: Update v9fs_open to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 25/28] hw/9pfs: Update v9fs_attach to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 15/28] hw/9pfs: Update v9fs_fsync to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 19/28] [virtio-9p] clean up v9fs_symlink, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 04/28] hw/9pfs: Update v9fs_getlock to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 13/28] hw/9pfs: Update v9fs_clunk to use coroutines, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 05/28] hw/9pfs: Add yield support for open and opendir coroutine, Aneesh Kumar K.V, 2011/08/08
- [Qemu-devel] [PATCH -V4 17/28] [virtio-9p] clean up v9fs_create Rearrange the code, Aneesh Kumar K.V, 2011/08/08
- [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 <=
- [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, 2011/08/08
- [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