]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/9pfs: Add yield support for open2 coroutine
authorVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Mon, 8 Aug 2011 18:22:33 +0000 (23:52 +0530)
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 22 Aug 2011 03:51:42 +0000 (09:21 +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/cofile.c
hw/9pfs/virtio-9p-coth.h

index 4a3ca214779f4ff5555d329673c80a2bd010c821..4b0d96c703b0a4986279c513b001c29011f065b1 100644 (file)
@@ -60,3 +60,24 @@ int v9fs_co_open(V9fsState *s, V9fsFidState *fidp, int flags)
         });
     return err;
 }
+
+int v9fs_co_open2(V9fsState *s, V9fsFidState *fidp, char *fullname, gid_t gid,
+                  int flags, int mode)
+{
+    int err;
+    FsCred cred;
+
+    cred_init(&cred);
+    cred.fc_mode = mode & 07777;
+    cred.fc_uid = fidp->uid;
+    cred.fc_gid = gid;
+    v9fs_co_run_in_worker(
+        {
+            fidp->fs.fd = s->ops->open2(&s->ctx, fullname, flags, &cred);
+            err = 0;
+            if (fidp->fs.fd == -1) {
+                err = -errno;
+            }
+        });
+    return err;
+}
index 1df7063c077d618cdd341ef1d400bb880359d8ed..f9610b9d8a6b346a86f8b0d7e06ef478876e3138 100644 (file)
@@ -79,4 +79,5 @@ extern int v9fs_co_rename(V9fsState *, V9fsString *, V9fsString *);
 extern int v9fs_co_fstat(V9fsState *, int, struct stat *);
 extern int v9fs_co_opendir(V9fsState *, V9fsFidState *);
 extern int v9fs_co_open(V9fsState *, V9fsFidState *, int);
+extern int v9fs_co_open2(V9fsState *, V9fsFidState *, char *, gid_t, int, int);
 #endif