|
1 | 1 | use crate::entry::{Entry, EntryHandle}; |
2 | 2 | use crate::fdpool::FdPool; |
3 | 3 | use crate::handle::Handle; |
4 | | -use crate::sys::osfile::{OsFile, OsFileExt}; |
| 4 | +use crate::sys::osdir::OsDir; |
| 5 | +use crate::sys::osother::{OsOther, OsOtherExt}; |
5 | 6 | use crate::sys::stdio::{Stdio, StdioExt}; |
6 | 7 | use crate::virtfs::{VirtualDir, VirtualDirEntry}; |
7 | 8 | use crate::wasi::types; |
@@ -120,9 +121,9 @@ pub struct WasiCtxBuilder { |
120 | 121 | impl WasiCtxBuilder { |
121 | 122 | /// Builder for a new `WasiCtx`. |
122 | 123 | pub fn new() -> Self { |
123 | | - let stdin = Some(PendingEntry::Thunk(OsFile::from_null)); |
124 | | - let stdout = Some(PendingEntry::Thunk(OsFile::from_null)); |
125 | | - let stderr = Some(PendingEntry::Thunk(OsFile::from_null)); |
| 124 | + let stdin = Some(PendingEntry::Thunk(OsOther::from_null)); |
| 125 | + let stdout = Some(PendingEntry::Thunk(OsOther::from_null)); |
| 126 | + let stderr = Some(PendingEntry::Thunk(OsOther::from_null)); |
126 | 127 |
|
127 | 128 | Self { |
128 | 129 | stdin, |
@@ -253,7 +254,7 @@ impl WasiCtxBuilder { |
253 | 254 | pub fn preopened_dir<P: AsRef<Path>>(&mut self, dir: File, guest_path: P) -> &mut Self { |
254 | 255 | self.preopens.as_mut().unwrap().push(( |
255 | 256 | guest_path.as_ref().to_owned(), |
256 | | - <Box<dyn Handle>>::try_from(dir).expect("valid handle"), |
| 257 | + Box::new(OsDir::try_from(dir).expect("valid OsDir handle")), |
257 | 258 | )); |
258 | 259 | self |
259 | 260 | } |
@@ -345,8 +346,8 @@ impl WasiCtxBuilder { |
345 | 346 | .ok_or(WasiCtxBuilderError::TooManyFilesOpen)? |
346 | 347 | } |
347 | 348 | PendingEntry::File(f) => { |
348 | | - let handle = <Box<dyn Handle>>::try_from(f)?; |
349 | | - let handle = EntryHandle::from(handle); |
| 349 | + let handle = OsOther::try_from(f)?; |
| 350 | + let handle = EntryHandle::new(handle); |
350 | 351 | let entry = Entry::new(handle); |
351 | 352 | entries |
352 | 353 | .insert(entry) |
|
0 commit comments