aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/cofile.c
diff options
context:
space:
mode:
authorVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>2011-08-08 23:52:33 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-08-22 09:21:42 +0530
commite4de423214d7c778effc2889ef5cad98b83a4986 (patch)
tree67d4b4243f21fdbf0aa41dc155d6dba0e1bebf83 /hw/9pfs/cofile.c
parent857bc158d4d2d271db5b0df8e9f6d90395a42cb4 (diff)
hw/9pfs: Add yield support for open2 coroutine
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/cofile.c')
-rw-r--r--hw/9pfs/cofile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 4a3ca21477..4b0d96c703 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -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;
+}