Borrow host descriptors while tracking VFS paths
ci / check (push) Successful in 13m25s

This commit is contained in:
agent-pool-8
2026-10-16 21:09:59 +00:00
parent 14f086423b
commit 6e07efaaa0
+7 -6
View File
@@ -328,14 +328,15 @@ impl VfsView<'_> {
async fn native_directory_entries(&mut self, fd: Resource<types::Descriptor>) -> FsResult<Vec<DirectoryEntry>> { async fn native_directory_entries(&mut self, fd: Resource<types::Descriptor>) -> FsResult<Vec<DirectoryEntry>> {
let stream = HostDescriptor::read_directory(&mut self.inner, fd).await?; let stream = HostDescriptor::read_directory(&mut self.inner, fd).await?;
let stream_rep = stream.rep();
let mut entries = Vec::new(); let mut entries = Vec::new();
loop { loop {
match HostDirectoryEntryStream::read_directory_entry(&mut self.inner, stream.clone()).await? { match HostDirectoryEntryStream::read_directory_entry(&mut self.inner, Resource::new_borrow(stream_rep)).await? {
Some(entry) => entries.push(entry), Some(entry) => entries.push(entry),
None => break, None => break,
} }
} }
HostDirectoryEntryStream::drop(&mut self.inner, stream)?; HostDirectoryEntryStream::drop(&mut self.inner, stream).map_err(|_| ErrorCode::Io)?;
Ok(entries) Ok(entries)
} }
@@ -587,10 +588,10 @@ impl HostDescriptor for VfsView<'_> {
None => { None => {
let child_path = self.state.dirs.get(&fd.rep()).map(|base| join(base, &path)); let child_path = self.state.dirs.get(&fd.rep()).map(|base| join(base, &path));
let opened = HostDescriptor::open_at(&mut self.inner, fd, path_flags, path, oflags, flags).await?; let opened = HostDescriptor::open_at(&mut self.inner, fd, path_flags, path, oflags, flags).await?;
if let Some(path) = child_path if let Some(path) = child_path {
&& HostDescriptor::get_type(&mut self.inner, opened.clone()).await? == DescriptorType::Directory if HostDescriptor::get_type(&mut self.inner, Resource::new_borrow(opened.rep())).await? == DescriptorType::Directory {
{ self.state.dirs.insert(opened.rep(), path);
self.state.dirs.insert(opened.rep(), path); }
} }
Ok(opened) Ok(opened)
} }