summaryrefslogtreecommitdiff
path: root/hw/9pfs/9p-synth.c
diff options
context:
space:
mode:
authorGreg Kurz <gkurz@linux.vnet.ibm.com>2016-06-06 11:52:34 +0200
committerGreg Kurz <gkurz@linux.vnet.ibm.com>2016-06-06 11:52:34 +0200
commit635324e83e238598e86628dba5ab62ce910e6f72 (patch)
tree959af05a3fb65f914171fa2c343f8b3fef9130b6 /hw/9pfs/9p-synth.c
parent7cde47d4a89d5efefcc805788bc29133f4f3c5c7 (diff)
downloadqemu-635324e83e238598e86628dba5ab62ce910e6f72.tar.gz
qemu-635324e83e238598e86628dba5ab62ce910e6f72.tar.bz2
qemu-635324e83e238598e86628dba5ab62ce910e6f72.zip
9p: switch back to readdir()
This patch changes the 9p code to use readdir() again instead of readdir_r(), which is deprecated in glibc 2.24. All the locking was put in place by a previous patch. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/9p-synth.c')
-rw-r--r--hw/9pfs/9p-synth.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
index 8e504130d9..73c8be816b 100644
--- a/hw/9pfs/9p-synth.c
+++ b/hw/9pfs/9p-synth.c
@@ -223,8 +223,8 @@ static void v9fs_synth_direntry(V9fsSynthNode *node,
entry->d_off = off + 1;
}
-static int v9fs_synth_get_dentry(V9fsSynthNode *dir, struct dirent *entry,
- struct dirent **result, off_t off)
+static struct dirent *v9fs_synth_get_dentry(V9fsSynthNode *dir,
+ struct dirent *entry, off_t off)
{
int i = 0;
V9fsSynthNode *node;
@@ -240,25 +240,22 @@ static int v9fs_synth_get_dentry(V9fsSynthNode *dir, struct dirent *entry,
rcu_read_unlock();
if (!node) {
/* end of directory */
- *result = NULL;
- return 0;
+ return NULL;
}
v9fs_synth_direntry(node, entry, off);
- *result = entry;
- return 0;
+ return entry;
}
-static int v9fs_synth_readdir_r(FsContext *ctx, V9fsFidOpenState *fs,
- struct dirent *entry, struct dirent **result)
+static struct dirent *v9fs_synth_readdir(FsContext *ctx, V9fsFidOpenState *fs)
{
- int ret;
+ struct dirent *entry;
V9fsSynthOpenState *synth_open = fs->private;
V9fsSynthNode *node = synth_open->node;
- ret = v9fs_synth_get_dentry(node, entry, result, synth_open->offset);
- if (!ret && *result != NULL) {
+ entry = v9fs_synth_get_dentry(node, &synth_open->dent, synth_open->offset);
+ if (entry) {
synth_open->offset++;
}
- return ret;
+ return entry;
}
static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path,
@@ -544,7 +541,7 @@ FileOperations synth_ops = {
.opendir = v9fs_synth_opendir,
.rewinddir = v9fs_synth_rewinddir,
.telldir = v9fs_synth_telldir,
- .readdir_r = v9fs_synth_readdir_r,
+ .readdir = v9fs_synth_readdir,
.seekdir = v9fs_synth_seekdir,
.preadv = v9fs_synth_preadv,
.pwritev = v9fs_synth_pwritev,