From 02ac7a34ff124b8d41dc1afadf622b07fa292b48 Mon Sep 17 00:00:00 2001 From: Venkateswararao Jujjuri Date: Mon, 8 Aug 2011 23:58:39 +0530 Subject: hw/9pfs: Add yield support for symlin coroutine Signed-off-by: Venkateswararao Jujjuri Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/cofs.c | 20 ++++++++++++++++++++ hw/9pfs/virtio-9p-coth.h | 2 ++ 2 files changed, 22 insertions(+) (limited to 'hw/9pfs') diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c index 1f10632..a78fccb 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 -- cgit v1.1