aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/codir.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/9pfs/codir.c')
-rw-r--r--hw/9pfs/codir.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c
index b379f931c0..72732e7c53 100644
--- a/hw/9pfs/codir.c
+++ b/hw/9pfs/codir.c
@@ -17,11 +17,15 @@
#include "qemu-coroutine.h"
#include "virtio-9p-coth.h"
-int v9fs_co_readdir_r(V9fsState *s, V9fsFidState *fidp, struct dirent *dent,
+int v9fs_co_readdir_r(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent *dent,
struct dirent **result)
{
int err;
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return -EINTR;
+ }
v9fs_co_run_in_worker(
{
errno = 0;
@@ -35,10 +39,14 @@ int v9fs_co_readdir_r(V9fsState *s, V9fsFidState *fidp, struct dirent *dent,
return err;
}
-off_t v9fs_co_telldir(V9fsState *s, V9fsFidState *fidp)
+off_t v9fs_co_telldir(V9fsPDU *pdu, V9fsFidState *fidp)
{
off_t err;
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return -EINTR;
+ }
v9fs_co_run_in_worker(
{
err = s->ops->telldir(&s->ctx, fidp->fs.dir);
@@ -49,29 +57,41 @@ off_t v9fs_co_telldir(V9fsState *s, V9fsFidState *fidp)
return err;
}
-void v9fs_co_seekdir(V9fsState *s, V9fsFidState *fidp, off_t offset)
+void v9fs_co_seekdir(V9fsPDU *pdu, V9fsFidState *fidp, off_t offset)
{
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return;
+ }
v9fs_co_run_in_worker(
{
s->ops->seekdir(&s->ctx, fidp->fs.dir, offset);
});
}
-void v9fs_co_rewinddir(V9fsState *s, V9fsFidState *fidp)
+void v9fs_co_rewinddir(V9fsPDU *pdu, V9fsFidState *fidp)
{
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return;
+ }
v9fs_co_run_in_worker(
{
s->ops->rewinddir(&s->ctx, fidp->fs.dir);
});
}
-int v9fs_co_mkdir(V9fsState *s, V9fsFidState *fidp, V9fsString *name,
+int 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;
V9fsPath path;
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return -EINTR;;
+ }
cred_init(&cred);
cred.fc_mode = mode;
cred.fc_uid = uid;
@@ -98,10 +118,14 @@ int v9fs_co_mkdir(V9fsState *s, V9fsFidState *fidp, V9fsString *name,
return err;
}
-int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
+int v9fs_co_opendir(V9fsPDU *pdu, V9fsFidState *fidp)
{
int err;
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return -EINTR;;
+ }
v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
@@ -116,16 +140,20 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
if (!err) {
total_open_fd++;
if (total_open_fd > open_fd_hw) {
- v9fs_reclaim_fd(s);
+ v9fs_reclaim_fd(pdu);
}
}
return err;
}
-int v9fs_co_closedir(V9fsState *s, DIR *dir)
+int v9fs_co_closedir(V9fsPDU *pdu, DIR *dir)
{
int err;
+ V9fsState *s = pdu->s;
+ if (v9fs_request_cancelled(pdu)) {
+ return -EINTR;;
+ }
v9fs_co_run_in_worker(
{
err = s->ops->closedir(&s->ctx, dir);