9pfs: use P9Array in v9fs_walk()
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <90c65d1c1ca11c1b434bb981b1fc7966f7711c8f.1633097129.git.qemu_oss@crudebyte.com>staging
parent
cc82fde9c7
commit
7e985780aa
17
hw/9pfs/9p.c
17
hw/9pfs/9p.c
|
@ -1738,13 +1738,14 @@ static void coroutine_fn v9fs_walk(void *opaque)
|
||||||
int name_idx;
|
int name_idx;
|
||||||
g_autofree V9fsQID *qids = NULL;
|
g_autofree V9fsQID *qids = NULL;
|
||||||
int i, err = 0;
|
int i, err = 0;
|
||||||
V9fsPath dpath, path, *pathes = NULL;
|
V9fsPath dpath, path;
|
||||||
|
P9ARRAY_REF(V9fsPath) pathes = NULL;
|
||||||
uint16_t nwnames;
|
uint16_t nwnames;
|
||||||
struct stat stbuf, fidst;
|
struct stat stbuf, fidst;
|
||||||
g_autofree struct stat *stbufs = NULL;
|
g_autofree struct stat *stbufs = NULL;
|
||||||
size_t offset = 7;
|
size_t offset = 7;
|
||||||
int32_t fid, newfid;
|
int32_t fid, newfid;
|
||||||
V9fsString *wnames = NULL;
|
P9ARRAY_REF(V9fsString) wnames = NULL;
|
||||||
V9fsFidState *fidp;
|
V9fsFidState *fidp;
|
||||||
V9fsFidState *newfidp = NULL;
|
V9fsFidState *newfidp = NULL;
|
||||||
V9fsPDU *pdu = opaque;
|
V9fsPDU *pdu = opaque;
|
||||||
|
@ -1765,10 +1766,10 @@ static void coroutine_fn v9fs_walk(void *opaque)
|
||||||
goto out_nofid;
|
goto out_nofid;
|
||||||
}
|
}
|
||||||
if (nwnames) {
|
if (nwnames) {
|
||||||
wnames = g_new0(V9fsString, nwnames);
|
P9ARRAY_NEW(V9fsString, wnames, nwnames);
|
||||||
qids = g_new0(V9fsQID, nwnames);
|
qids = g_new0(V9fsQID, nwnames);
|
||||||
stbufs = g_new0(struct stat, nwnames);
|
stbufs = g_new0(struct stat, nwnames);
|
||||||
pathes = g_new0(V9fsPath, nwnames);
|
P9ARRAY_NEW(V9fsPath, pathes, nwnames);
|
||||||
for (i = 0; i < nwnames; i++) {
|
for (i = 0; i < nwnames; i++) {
|
||||||
err = pdu_unmarshal(pdu, offset, "s", &wnames[i]);
|
err = pdu_unmarshal(pdu, offset, "s", &wnames[i]);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -1900,14 +1901,6 @@ out:
|
||||||
v9fs_path_free(&path);
|
v9fs_path_free(&path);
|
||||||
out_nofid:
|
out_nofid:
|
||||||
pdu_complete(pdu, err);
|
pdu_complete(pdu, err);
|
||||||
if (nwnames && nwnames <= P9_MAXWELEM) {
|
|
||||||
for (name_idx = 0; name_idx < nwnames; name_idx++) {
|
|
||||||
v9fs_string_free(&wnames[name_idx]);
|
|
||||||
v9fs_path_free(&pathes[name_idx]);
|
|
||||||
}
|
|
||||||
g_free(wnames);
|
|
||||||
g_free(pathes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t coroutine_fn get_iounit(V9fsPDU *pdu, V9fsPath *path)
|
static int32_t coroutine_fn get_iounit(V9fsPDU *pdu, V9fsPath *path)
|
||||||
|
|
Loading…
Reference in New Issue