Patchwork [V3,10/24] hw/9pfs: Add yield support to statfs coroutine

login
register
mail settings
Submitter jvrao
Date May 19, 2011, 2:57 a.m.
Message ID <1305773834-16359-11-git-send-email-jvrao@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/96282/
State New
Headers show

Comments

jvrao - May 19, 2011, 2:57 a.m.
From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com>
---
 hw/9pfs/cofs.c           |   14 ++++++++++++++
 hw/9pfs/virtio-9p-coth.h |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c
index 3e5f4c7..b4ae372 100644
--- a/hw/9pfs/cofs.c
+++ b/hw/9pfs/cofs.c
@@ -41,3 +41,17 @@  int v9fs_co_readlink(V9fsState *s, V9fsString *path, V9fsString *buf)
     buf->data = tbuf.data;
     return err;
 }
+
+int v9fs_co_statfs(V9fsState *s, V9fsString *path, struct statfs *stbuf)
+{
+    int err;
+
+    v9fs_co_run_in_worker(
+        {
+            err = s->ops->statfs(&s->ctx, path->data, stbuf);
+            if (err < 0) {
+                err = -errno;
+            }
+        });
+    return err;
+}
diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h
index 9aa5953..5d9dc0f 100644
--- a/hw/9pfs/virtio-9p-coth.h
+++ b/hw/9pfs/virtio-9p-coth.h
@@ -62,4 +62,5 @@  extern int v9fs_co_readdir(V9fsState *, V9fsFidState *,
 extern off_t v9fs_co_telldir(V9fsState *, V9fsFidState *);
 extern void v9fs_co_seekdir(V9fsState *, V9fsFidState *, off_t);
 extern void v9fs_co_rewinddir(V9fsState *, V9fsFidState *);
+extern int v9fs_co_statfs(V9fsState *, V9fsString *, struct statfs *);
 #endif