5 * Copyright IBM, Corp. 2011
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_readlink(V9fsState *s, V9fsString *path, V9fsString *buf)
25 buf->data = g_malloc(PATH_MAX);
26 v9fs_co_run_in_worker(
28 len = s->ops->readlink(&s->ctx, path->data,
29 buf->data, PATH_MAX - 1);
46 int v9fs_co_statfs(V9fsState *s, V9fsString *path, struct statfs *stbuf)
50 v9fs_co_run_in_worker(
52 err = s->ops->statfs(&s->ctx, path->data, stbuf);
60 int v9fs_co_chmod(V9fsState *s, V9fsString *path, mode_t mode)
67 v9fs_co_run_in_worker(
69 err = s->ops->chmod(&s->ctx, path->data, &cred);
77 int v9fs_co_utimensat(V9fsState *s, V9fsString *path,
78 struct timespec times[2])
82 v9fs_co_run_in_worker(
84 err = s->ops->utimensat(&s->ctx, path->data, times);
92 int v9fs_co_chown(V9fsState *s, V9fsString *path, uid_t uid, gid_t gid)
100 v9fs_co_run_in_worker(
102 err = s->ops->chown(&s->ctx, path->data, &cred);
110 int v9fs_co_truncate(V9fsState *s, V9fsString *path, off_t size)
114 v9fs_co_run_in_worker(
116 err = s->ops->truncate(&s->ctx, path->data, size);
124 int v9fs_co_mknod(V9fsState *s, V9fsString *path, uid_t uid,
125 gid_t gid, dev_t dev, mode_t mode)
135 v9fs_co_run_in_worker(
137 err = s->ops->mknod(&s->ctx, path->data, &cred);
145 int v9fs_co_remove(V9fsState *s, V9fsString *path)
149 v9fs_co_run_in_worker(
151 err = s->ops->remove(&s->ctx, path->data);
159 int v9fs_co_rename(V9fsState *s, V9fsString *oldpath, V9fsString *newpath)
163 v9fs_co_run_in_worker(
165 err = s->ops->rename(&s->ctx, oldpath->data, newpath->data);
173 int v9fs_co_symlink(V9fsState *s, V9fsFidState *fidp,
174 const char *oldpath, const char *newpath, gid_t gid)
180 cred.fc_uid = fidp->uid;
183 v9fs_co_run_in_worker(
185 err = s->ops->symlink(&s->ctx, oldpath, newpath, &cred);