Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Async FS #271

Merged
merged 4 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/sefs
Submodule sefs updated 1 files
+1 −1 rcore-fs/src/vfs.rs
67 changes: 67 additions & 0 deletions src/libos/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/libos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ crate-type = ["staticlib"]
[dependencies]
async-rt = { path = "crates/async-rt", default-features = false, features = ["sgx"] }
async-io = { path = "crates/async-io", features = ["sgx"] }
async-vfs = { path = "crates/async-vfs", features = ["sgx"] }
async-sfs = { path = "crates/async-sfs", default-features = false, features = ["sgx"] }
atomic = "0.5"
bitflags = "1.0"
bitvec = { version = "0.17", default-features = false, features = ["alloc"] }
Expand Down
4 changes: 4 additions & 0 deletions src/libos/crates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
members = [
"async-rt",
"async-io",
"async-sfs",
"async-vfs",
"block-device",
"inherit-methods-macro",
"errno",
Expand All @@ -21,6 +23,8 @@ members = [
default-members = [
"async-rt",
"async-io",
"async-sfs",
"async-vfs",
"block-device",
"host-socket",
"inherit-methods-macro",
Expand Down
2 changes: 1 addition & 1 deletion src/libos/crates/async-io/src/file/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<F: File + ?Sized> Async<F> {
pub fn status_flags(&self) -> StatusFlags;
pub fn set_status_flags(&self, new_status: StatusFlags) -> Result<()>;
pub fn access_mode(&self) -> AccessMode;
pub fn ioctl(&self, cmd: &mut dyn IoctlCmd) -> Result<()>;
pub async fn ioctl(&self, cmd: &mut dyn IoctlCmd) -> Result<()>;
pub fn stat(&self) -> StatBuf;
}

Expand Down
4 changes: 2 additions & 2 deletions src/libos/crates/async-io/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ mod mount_flags;
mod stat_buf;

pub use rcore_fs::vfs::{
DirentWriter, DirentWriterContext, FallocateMode, FileSystem, FileType, FsError, FsInfo, INode,
Metadata, Timespec, PATH_MAX,
AnyExt, DirentWriter, DirentWriterContext, Extension, FallocateMode, FileSystem, FileType,
FsError, FsInfo, INode, Metadata, Timespec, PATH_MAX,
};

pub use self::fallocate_flags::FallocateFlags;
Expand Down
2 changes: 1 addition & 1 deletion src/libos/crates/async-io/src/ioctl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ use downcast_rs::{impl_downcast, Downcast};
/// let dummy : Box<dyn IoctlCmd> = Box::new(DummyCmd);
/// assert!(dummy.downcast_ref::<DummyCmd>().is_some());
/// ```
pub trait IoctlCmd: Downcast + Debug {}
pub trait IoctlCmd: Downcast + Debug + Sync + Send {}
impl_downcast!(IoctlCmd);

/// A convenient macro to define a struct for some type of ioctl command.
Expand Down
36 changes: 36 additions & 0 deletions src/libos/crates/async-sfs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "async-sfs"
version = "0.1.0"
authors = ["Li Qing <geding.lq@antgroup.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["libc", "lru/default", "page-cache/default"]
sgx = ["sgx_types", "sgx_tstd", "sgx_trts", "sgx_libc", "async-vfs/sgx", "async-io/sgx", "async-rt/sgx", "page-cache/sgx", "lru/sgx"]

[dependencies]
async-vfs = { path = "../async-vfs" }
async-io = { path = "../async-io" }
async-rt = { path = "../async-rt" }
errno = { path = "../errno" }
block-device = { path = "../block-device" }
page-cache = { path = "../page-cache", default-features = false }
async-trait = "0.1.52"
static_assertions = "0.3"
log = "0.4"
cfg-if = "1.0"
lru = { path = "../../../../deps/lru-rs", default-features = false }
libc = { version = "0.2", optional = true }
bitvec = { version = "0.17", default-features = false, features = ["alloc"] }
lazy_static = { version = "1.4.0", features = ["spin_no_std"] }

sgx_types = { path = "../../../../deps/rust-sgx-sdk/sgx_types", optional = true }
sgx_tstd = { path = "../../../../deps/rust-sgx-sdk/sgx_tstd", optional = true, features = ["backtrace"] }
sgx_trts = { path = "../../../../deps/rust-sgx-sdk/sgx_trts", optional = true }
sgx_libc = { path = "../../../../deps/rust-sgx-sdk/sgx_libc", optional = true }

[dev-dependencies]
async-rt = { path = "../async-rt", features = ["auto_run"] }
sgx-disk= { path = "../sgx-disk" }
Loading