9p: introduce the V9fsDir type
If we are to switch back to readdir(), we need a more complex type than
DIR * to be able to serialize concurrent accesses to the directory stream.
This patch introduces a placeholder type and fixes all users.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 42ac4d7..803f525 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -231,7 +231,7 @@
} while (err == -EINTR && !pdu->cancelled);
}
} else if (f->fid_type == P9_FID_DIR) {
- if (f->fs.dir == NULL) {
+ if (f->fs.dir.stream == NULL) {
do {
err = v9fs_co_opendir(pdu, f);
} while (err == -EINTR && !pdu->cancelled);
@@ -345,7 +345,7 @@
retval = v9fs_co_close(pdu, &fidp->fs);
}
} else if (fidp->fid_type == P9_FID_DIR) {
- if (fidp->fs.dir != NULL) {
+ if (fidp->fs.dir.stream != NULL) {
retval = v9fs_co_closedir(pdu, &fidp->fs);
}
} else if (fidp->fid_type == P9_FID_XATTR) {
@@ -443,7 +443,7 @@
reclaim_count++;
}
} else if (f->fid_type == P9_FID_DIR) {
- if (f->fs.dir != NULL) {
+ if (f->fs.dir.stream != NULL) {
/*
* Up the reference count so that
* a clunk request won't free this fid
@@ -451,8 +451,8 @@
f->ref++;
f->rclm_lst = reclaim_list;
reclaim_list = f;
- f->fs_reclaim.dir = f->fs.dir;
- f->fs.dir = NULL;
+ f->fs_reclaim.dir.stream = f->fs.dir.stream;
+ f->fs.dir.stream = NULL;
reclaim_count++;
}
}
@@ -1883,7 +1883,7 @@
retval = -EINVAL;
goto out_nofid;
}
- if (!fidp->fs.dir) {
+ if (!fidp->fs.dir.stream) {
retval = -EINVAL;
goto out;
}