hw/9pfs: Add yield support for symlin coroutine
authorVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Mon, 8 Aug 2011 18:28:39 +0000 (23:58 +0530)
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 22 Aug 2011 04:14:26 +0000 (09:44 +0530)
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs/cofs.c
hw/9pfs/virtio-9p-coth.h

index 1f10632540d482419d3eeaccbf25cab501312dec..a78fccbe2334d428a9ca3c28e481f0aa2aef97db 100644 (file)
@@ -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;
+}
index a3881f3770a174079dbbcca1472dcc8460b1e1a9..e3949330c92b433335bfb2787006bce5c32901b4 100644 (file)
@@ -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