9pfs: use coroutine_fn annotation in hw/9pfs/co*.[ch]

All these functions use the v9fs_co_run_in_worker() macro, and thus always
call qemu_coroutine_self() and qemu_coroutine_yield().

Let's mark them to make it obvious they execute in coroutine context.

Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
Greg Kurz 2016-10-17 14:13:58 +02:00
parent bc70a5925f
commit 5bdade6621
5 changed files with 109 additions and 95 deletions

View file

@ -17,7 +17,8 @@
#include "qemu/coroutine.h"
#include "coth.h"
int v9fs_co_readdir(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent **dent)
int coroutine_fn v9fs_co_readdir(V9fsPDU *pdu, V9fsFidState *fidp,
struct dirent **dent)
{
int err;
V9fsState *s = pdu->s;
@ -59,7 +60,8 @@ off_t v9fs_co_telldir(V9fsPDU *pdu, V9fsFidState *fidp)
return err;
}
void v9fs_co_seekdir(V9fsPDU *pdu, V9fsFidState *fidp, off_t offset)
void coroutine_fn v9fs_co_seekdir(V9fsPDU *pdu, V9fsFidState *fidp,
off_t offset)
{
V9fsState *s = pdu->s;
if (v9fs_request_cancelled(pdu)) {
@ -71,7 +73,7 @@ void v9fs_co_seekdir(V9fsPDU *pdu, V9fsFidState *fidp, off_t offset)
});
}
void v9fs_co_rewinddir(V9fsPDU *pdu, V9fsFidState *fidp)
void coroutine_fn v9fs_co_rewinddir(V9fsPDU *pdu, V9fsFidState *fidp)
{
V9fsState *s = pdu->s;
if (v9fs_request_cancelled(pdu)) {
@ -83,8 +85,9 @@ void v9fs_co_rewinddir(V9fsPDU *pdu, V9fsFidState *fidp)
});
}
int v9fs_co_mkdir(V9fsPDU *pdu, V9fsFidState *fidp, V9fsString *name,
mode_t mode, uid_t uid, gid_t gid, struct stat *stbuf)
int coroutine_fn v9fs_co_mkdir(V9fsPDU *pdu, V9fsFidState *fidp,
V9fsString *name, mode_t mode, uid_t uid,
gid_t gid, struct stat *stbuf)
{
int err;
FsCred cred;
@ -120,7 +123,7 @@ int v9fs_co_mkdir(V9fsPDU *pdu, V9fsFidState *fidp, V9fsString *name,
return err;
}
int v9fs_co_opendir(V9fsPDU *pdu, V9fsFidState *fidp)
int coroutine_fn v9fs_co_opendir(V9fsPDU *pdu, V9fsFidState *fidp)
{
int err;
V9fsState *s = pdu->s;
@ -148,7 +151,7 @@ int v9fs_co_opendir(V9fsPDU *pdu, V9fsFidState *fidp)
return err;
}
int v9fs_co_closedir(V9fsPDU *pdu, V9fsFidOpenState *fs)
int coroutine_fn v9fs_co_closedir(V9fsPDU *pdu, V9fsFidOpenState *fs)
{
int err;
V9fsState *s = pdu->s;