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_lstat(V9fsState
*s
, V9fsString
*path
, struct stat
*stbuf
)
24 v9fs_co_run_in_worker(
26 err
= s
->ops
->lstat(&s
->ctx
, path
->data
, stbuf
);
34 int v9fs_co_fstat(V9fsState
*s
, int fd
, struct stat
*stbuf
)
38 v9fs_co_run_in_worker(
40 err
= s
->ops
->fstat(&s
->ctx
, fd
, stbuf
);
48 int v9fs_co_open(V9fsState
*s
, V9fsFidState
*fidp
, int flags
)
52 v9fs_co_run_in_worker(
54 fidp
->fs
.fd
= s
->ops
->open(&s
->ctx
, fidp
->path
.data
, flags
);
55 if (fidp
->fs
.fd
== -1) {
64 int v9fs_co_open2(V9fsState
*s
, V9fsFidState
*fidp
, char *fullname
, gid_t gid
,
71 cred
.fc_mode
= mode
& 07777;
72 cred
.fc_uid
= fidp
->uid
;
74 v9fs_co_run_in_worker(
76 fidp
->fs
.fd
= s
->ops
->open2(&s
->ctx
, fullname
, flags
, &cred
);
78 if (fidp
->fs
.fd
== -1) {
85 int v9fs_co_close(V9fsState
*s
, V9fsFidState
*fidp
)
91 v9fs_co_run_in_worker(
93 err
= s
->ops
->close(&s
->ctx
, fd
);