summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>2011-08-08 23:58:39 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-08-22 09:44:26 +0530
commit02ac7a34ff124b8d41dc1afadf622b07fa292b48 (patch)
tree825e01a93df09e9b425aebe9d919b6a74b3661ca
parentbaaa86d9f5d516d423d34af92e0c15b56e06ac4b (diff)
downloadfocaccia-qemu-02ac7a34ff124b8d41dc1afadf622b07fa292b48.tar.gz
focaccia-qemu-02ac7a34ff124b8d41dc1afadf622b07fa292b48.zip
hw/9pfs: Add yield support for symlin coroutine
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-rw-r--r--hw/9pfs/cofs.c20
-rw-r--r--hw/9pfs/virtio-9p-coth.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c
index 1f10632540..a78fccbe23 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 a3881f3770..e3949330c9 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