From e4de423214d7c778effc2889ef5cad98b83a4986 Mon Sep 17 00:00:00 2001 From: Venkateswararao Jujjuri Date: Mon, 8 Aug 2011 23:52:33 +0530 Subject: hw/9pfs: Add yield support for open2 coroutine Signed-off-by: Venkateswararao Jujjuri Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/cofile.c | 21 +++++++++++++++++++++ hw/9pfs/virtio-9p-coth.h | 1 + 2 files changed, 22 insertions(+) (limited to 'hw/9pfs') diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c index 4a3ca21..4b0d96c 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; +} diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h index 1df7063..f9610b9 100644 --- a/hw/9pfs/virtio-9p-coth.h +++ b/hw/9pfs/virtio-9p-coth.h @@ -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 -- cgit v1.1