5 * Copyright IBM, Corp. 2011
8 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
15 #include "fsdev/qemu-fsdev.h"
16 #include "qemu-thread.h"
17 #include "qemu-coroutine.h"
18 #include "virtio-9p-coth.h"
20 int v9fs_co_readdir_r(V9fsState *s, V9fsFidState *fidp, struct dirent *dent,
21 struct dirent **result)
25 v9fs_co_run_in_worker(
28 err = s->ops->readdir_r(&s->ctx, fidp->fs.dir, dent, result);
29 if (!*result && errno) {
38 off_t v9fs_co_telldir(V9fsState *s, V9fsFidState *fidp)
42 v9fs_co_run_in_worker(
44 err = s->ops->telldir(&s->ctx, fidp->fs.dir);
52 void v9fs_co_seekdir(V9fsState *s, V9fsFidState *fidp, off_t offset)
54 v9fs_co_run_in_worker(
56 s->ops->seekdir(&s->ctx, fidp->fs.dir, offset);
60 void v9fs_co_rewinddir(V9fsState *s, V9fsFidState *fidp)
62 v9fs_co_run_in_worker(
64 s->ops->rewinddir(&s->ctx, fidp->fs.dir);
68 int v9fs_co_mkdir(V9fsState *s, char *name, mode_t mode, uid_t uid, gid_t gid)
77 v9fs_co_run_in_worker(
79 err = s->ops->mkdir(&s->ctx, name, &cred);
87 int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
91 v9fs_co_run_in_worker(
93 fidp->fs.dir = s->ops->opendir(&s->ctx, fidp->path.data);
102 if (total_open_fd > open_fd_hw) {
109 int v9fs_co_closedir(V9fsState *s, DIR *dir)
113 v9fs_co_run_in_worker(
115 err = s->ops->closedir(&s->ctx, dir);