Skip to content

Commit d4395ee

Browse files
committed
Delete DirOptions{,Ext}
Not used anywhere on `wasmtime-wasi`
1 parent bf33049 commit d4395ee

10 files changed

Lines changed: 10 additions & 95 deletions

File tree

crates/wasi/src/filesystem.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::clocks::Datetime;
2-
use crate::filesystem::primitives::{DirOptions, FollowSymlinks, Metadata, OpenOptions};
2+
use crate::filesystem::primitives::{FollowSymlinks, Metadata, OpenOptions};
33
use crate::runtime::{AbortOnDropJoinHandle, spawn_blocking};
44
use std::collections::hash_map;
55
use std::sync::Arc;
@@ -853,10 +853,8 @@ impl Dir {
853853
if self.perms.write_not_permitted() {
854854
return Err(ErrorCode::NotPermitted);
855855
}
856-
self.run_blocking(move |d| {
857-
crate::filesystem::primitives::create_dir(d, path.as_ref(), &DirOptions::new())
858-
})
859-
.await?;
856+
self.run_blocking(move |d| crate::filesystem::primitives::create_dir(d, path.as_ref()))
857+
.await?;
860858
Ok(())
861859
}
862860

crates/wasi/src/filesystem/primitives/dir_options.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

crates/wasi/src/filesystem/primitives/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::path::{Path, PathBuf};
2121
use std::{fs, io};
2222

2323
mod dir_entry;
24-
mod dir_options;
2524
mod file_type;
2625
mod maybe_owned_file;
2726
mod metadata;
@@ -53,7 +52,6 @@ use sys::read_link_impl as read_link_contents;
5352
use sys::*;
5453

5554
pub(crate) use dir_entry::DirEntry;
56-
pub(crate) use dir_options::DirOptions;
5755
pub(crate) use file_type::FileType;
5856
#[cfg(any(unix, target_os = "vxworks"))]
5957
pub(crate) use file_type::FileTypeExt;
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
use crate::filesystem::primitives::DirOptions;
2-
use rustix::fs::{Mode, RawMode, mkdirat};
1+
use rustix::fs::{Mode, mkdirat};
32
use std::path::Path;
43
use std::{fs, io};
54

65
/// *Unsandboxed* function similar to `create_dir`, but which does not perform
76
/// sandboxing.
8-
pub(crate) fn create_dir_unchecked(
9-
start: &fs::File,
10-
path: &Path,
11-
options: &DirOptions,
12-
) -> io::Result<()> {
13-
#[cfg(not(target_os = "wasi"))]
14-
let raw_mode = options.ext.mode as RawMode;
15-
#[cfg(target_os = "wasi")]
16-
let raw_mode = 0;
17-
18-
Ok(mkdirat(start, path, Mode::from_bits(raw_mode).unwrap())?)
7+
pub(crate) fn create_dir_unchecked(start: &fs::File, path: &Path) -> io::Result<()> {
8+
Ok(mkdirat(start, path, Mode::empty())?)
199
}

crates/wasi/src/filesystem/primitives/rustix/fs/dir_options_ext.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

crates/wasi/src/filesystem/primitives/rustix/fs/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
mod create_dir_unchecked;
22
mod dir_entry_inner;
3-
#[cfg(not(target_os = "wasi"))]
4-
mod dir_options_ext;
53
mod dir_utils;
64
mod file_type_ext;
75
mod hard_link_unchecked;
@@ -60,8 +58,6 @@ pub(crate) use crate::filesystem::primitives::{
6058

6159
pub(crate) use create_dir_unchecked::create_dir_unchecked;
6260
pub(crate) use dir_entry_inner::DirEntryInner;
63-
#[cfg(not(target_os = "wasi"))]
64-
pub(crate) use dir_options_ext::DirOptionsExt;
6561
pub(crate) use dir_utils::*;
6662
pub(crate) use file_type_ext::ImplFileTypeExt;
6763
pub(crate) use hard_link_unchecked::hard_link_unchecked;
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use super::open_parent;
2-
use crate::filesystem::primitives::{
3-
DirOptions, MaybeOwnedFile, create_dir_unchecked, strip_dir_suffix,
4-
};
2+
use crate::filesystem::primitives::{MaybeOwnedFile, create_dir_unchecked, strip_dir_suffix};
53
use std::path::Path;
64
use std::{fs, io};
75

86
/// Implement `create_dir` by `open`ing up the parent component of the path and
97
/// then calling `create_dir_unchecked` on the last component.
10-
pub(crate) fn create_dir(start: &fs::File, path: &Path, options: &DirOptions) -> io::Result<()> {
8+
pub(crate) fn create_dir(start: &fs::File, path: &Path) -> io::Result<()> {
119
let start = MaybeOwnedFile::borrowed(start);
1210

1311
// As a special case, `create_dir` ignores a trailing slash rather than
@@ -17,5 +15,5 @@ pub(crate) fn create_dir(start: &fs::File, path: &Path, options: &DirOptions) ->
1715

1816
let (dir, basename) = open_parent(start, &path)?;
1917

20-
create_dir_unchecked(&dir, basename.as_ref(), options)
18+
create_dir_unchecked(&dir, basename.as_ref())
2119
}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
use super::get_path::concatenate;
2-
use crate::filesystem::primitives::DirOptions;
32
use std::path::Path;
43
use std::{fs, io};
54

65
/// *Unsandboxed* function similar to `create_dir`, but which does not perform
76
/// sandboxing.
87
///
9-
/// Windows doesn't have any extra flags in `DirOptions`, so the `options`
10-
/// parameter is ignored.
11-
pub(crate) fn create_dir_unchecked(
12-
start: &fs::File,
13-
path: &Path,
14-
_options: &DirOptions,
15-
) -> io::Result<()> {
8+
pub(crate) fn create_dir_unchecked(start: &fs::File, path: &Path) -> io::Result<()> {
169
let out_path = concatenate(start, path)?;
1710
fs::create_dir(out_path)
1811
}

crates/wasi/src/filesystem/primitives/windows/fs/dir_options_ext.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

crates/wasi/src/filesystem/primitives/windows/fs/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod create_dir_unchecked;
22
mod create_file_at_w;
33
mod dir_entry_inner;
4-
mod dir_options_ext;
54
mod dir_utils;
65
mod file_type_ext;
76
mod get_path;
@@ -37,7 +36,6 @@ pub(crate) use crate::filesystem::primitives::{
3736

3837
pub(crate) use create_dir_unchecked::*;
3938
pub(crate) use dir_entry_inner::*;
40-
pub(crate) use dir_options_ext::*;
4139
pub(crate) use dir_utils::*;
4240
pub(crate) use file_type_ext::*;
4341
pub(crate) use hard_link_unchecked::*;

0 commit comments

Comments
 (0)