aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs
diff options
context:
space:
mode:
authorVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>2011-08-08 23:44:24 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-08-08 23:44:24 +0530
commitd0884642b827ec90a7e66d34f5cf1caa1a031990 (patch)
tree3ece7878714192c9400a2d05d2ee70311e624a53 /hw/9pfs
parent1b733fed7fe407169523cbdb73d97bb335a7f02c (diff)
hw/9pfs: Add yield support for mkdir 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')
-rw-r--r--hw/9pfs/codir.c19
-rw-r--r--hw/9pfs/virtio-9p-coth.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c
index 47b10df57d..28f2ad7320 100644
--- a/hw/9pfs/codir.c
+++ b/hw/9pfs/codir.c
@@ -64,3 +64,22 @@ void v9fs_co_rewinddir(V9fsState *s, V9fsFidState *fidp)
s->ops->rewinddir(&s->ctx, fidp->fs.dir);
});
}
+
+int v9fs_co_mkdir(V9fsState *s, char *name, mode_t mode, uid_t uid, gid_t gid)
+{
+ int err;
+ FsCred cred;
+
+ cred_init(&cred);
+ cred.fc_mode = mode;
+ cred.fc_uid = uid;
+ cred.fc_gid = gid;
+ v9fs_co_run_in_worker(
+ {
+ err = s->ops->mkdir(&s->ctx, name, &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 d02368306e..96e88d8656 100644
--- a/hw/9pfs/virtio-9p-coth.h
+++ b/hw/9pfs/virtio-9p-coth.h
@@ -73,4 +73,5 @@ extern int v9fs_co_lgetxattr(V9fsState *, V9fsString *,
V9fsString *, void *, size_t);
extern int v9fs_co_mknod(V9fsState *, V9fsString *, uid_t,
gid_t, dev_t, mode_t);
+extern int v9fs_co_mkdir(V9fsState *, char *, mode_t, uid_t, gid_t);
#endif