virtio: Correct dir creation to use existing stream

Rather than creating a new stream, which gets lost, virtio_fs_dir_open()
should use the existing one. Fix it, so that the fh member is preserved
for future use.

This fixes a problem where the fh value is not preserved, thus causing
a subsequent 'ls' on the same directory to fail.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: #15
This commit is contained in:
Simon Glass
2025-07-12 12:35:38 +02:00
parent 753438e516
commit 1560075474

View File

@@ -25,10 +25,6 @@ static int virtio_fs_dir_open(struct udevice *dev, struct fs_dir_stream *strm)
struct udevice *fs = dev_get_parent(dev);
int ret;
strm = malloc(sizeof(struct fs_dir_stream));
if (!strm)
return log_msg_ret("vso", -ENOMEM);
log_debug("opening inode %lld\n", dir_priv->inode);
ret = virtio_fs_opendir(fs, dir_priv->inode, &strm->fh);
log_debug("2 open ret %d strm %p fh %llx\n", ret, strm, strm->fh);