mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
9pfs: refactor 'name_idx' -> 'nwalked' in v9fs_walk()
The local variable 'name_idx' is used in two loops in function v9fs_walk(). Let the first loop use its own variable 'nwalked' instead, which we will use in subsequent patch as the number of (requested) path components successfully walked by background I/O thread. Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by: Greg Kurz <groug@kaod.org> Message-Id: <d506308e7e343023c4db95d0e6053dd2627ed3c1.1647339025.git.qemu_oss@crudebyte.com>
This commit is contained in:
parent
a6821b8284
commit
fd6c979e65
1 changed files with 8 additions and 8 deletions
16
hw/9pfs/9p.c
16
hw/9pfs/9p.c
|
@ -1766,7 +1766,7 @@ static bool same_stat_id(const struct stat *a, const struct stat *b)
|
||||||
|
|
||||||
static void coroutine_fn v9fs_walk(void *opaque)
|
static void coroutine_fn v9fs_walk(void *opaque)
|
||||||
{
|
{
|
||||||
int name_idx;
|
int name_idx, nwalked;
|
||||||
g_autofree V9fsQID *qids = NULL;
|
g_autofree V9fsQID *qids = NULL;
|
||||||
int i, err = 0;
|
int i, err = 0;
|
||||||
V9fsPath dpath, path;
|
V9fsPath dpath, path;
|
||||||
|
@ -1844,17 +1844,17 @@ static void coroutine_fn v9fs_walk(void *opaque)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stbuf = fidst;
|
stbuf = fidst;
|
||||||
for (name_idx = 0; name_idx < nwnames; name_idx++) {
|
for (nwalked = 0; nwalked < nwnames; nwalked++) {
|
||||||
if (v9fs_request_cancelled(pdu)) {
|
if (v9fs_request_cancelled(pdu)) {
|
||||||
err = -EINTR;
|
err = -EINTR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!same_stat_id(&pdu->s->root_st, &stbuf) ||
|
if (!same_stat_id(&pdu->s->root_st, &stbuf) ||
|
||||||
strcmp("..", wnames[name_idx].data))
|
strcmp("..", wnames[nwalked].data))
|
||||||
{
|
{
|
||||||
err = s->ops->name_to_path(&s->ctx, &dpath,
|
err = s->ops->name_to_path(&s->ctx, &dpath,
|
||||||
wnames[name_idx].data,
|
wnames[nwalked].data,
|
||||||
&pathes[name_idx]);
|
&pathes[nwalked]);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
break;
|
break;
|
||||||
|
@ -1863,13 +1863,13 @@ static void coroutine_fn v9fs_walk(void *opaque)
|
||||||
err = -EINTR;
|
err = -EINTR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
err = s->ops->lstat(&s->ctx, &pathes[name_idx], &stbuf);
|
err = s->ops->lstat(&s->ctx, &pathes[nwalked], &stbuf);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stbufs[name_idx] = stbuf;
|
stbufs[nwalked] = stbuf;
|
||||||
v9fs_path_copy(&dpath, &pathes[name_idx]);
|
v9fs_path_copy(&dpath, &pathes[nwalked]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue