[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 21/29] [virtio-9p] coroutine and threading for v9fs_
From: |
Venkateswararao Jujjuri (JV) |
Subject: |
[Qemu-devel] [PATCH 21/29] [virtio-9p] coroutine and threading for v9fs_do_symlink |
Date: |
Wed, 25 May 2011 16:53:09 -0700 |
Signed-off-by: Venkateswararao Jujjuri "<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 1e6c2b8..cb11ee6 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);
@@ -2030,10 +2018,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) {
@@ -2142,19 +2129,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.1
- [Qemu-devel] [PATCH 10/29] [PATCH] [virtio-9p] coroutine and threading for open2, (continued)
- [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
- [Qemu-devel] [PATCH 27/29] hw/9pfs: Add yield support for preadv coroutine, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 11/29] hw/9pfs: Update v9fs_stat to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 08/29] [virtio-9p] Remove post functions for v9fs_lcreate, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 23/29] hw/9pfs: Add yield support for pwritev coroutine, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 21/29] [virtio-9p] coroutine and threading for v9fs_do_symlink,
Venkateswararao Jujjuri (JV) <=
- [Qemu-devel] [PATCH 13/29] hw/9pfs: Add yeild support for clunk related coroutine, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 29/29] use readdir_r instead of readdir for reentrancy, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 26/29] hw/9pfs: Update v9fs_attach to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 25/29] hw/9pfs: Update v9fs_wstat to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 24/29] hw/9pfs: Update v9fs_write to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 28/29] hw/9pfs: Update v9fs_read to use coroutines, Venkateswararao Jujjuri (JV), 2011/05/25
- [Qemu-devel] [PATCH 15/29] hw/9pfs: Add yield support for fsync coroutine, Venkateswararao Jujjuri (JV), 2011/05/25