Renamed virtfs to virtual-fs and virtnet to virtual-net

This commit is contained in:
ptitSeb
2023-03-16 09:29:31 +01:00
parent 21b0bb6c2e
commit f59ab5caee
40 changed files with 125 additions and 125 deletions

40
Cargo.lock generated
View File

@ -4370,7 +4370,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "virtfs"
name = "virtnet-native"
version = "0.1.0"
dependencies = [
"async-trait",
"bytes",
"libc",
"tokio",
"tracing",
"virtual-net",
]
[[package]]
name = "virtual-fs"
version = "0.1.0"
dependencies = [
"anyhow",
@ -4393,7 +4405,7 @@ dependencies = [
]
[[package]]
name = "virtnet"
name = "virtual-net"
version = "0.1.0"
dependencies = [
"async-trait",
@ -4402,18 +4414,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "virtnet-native"
version = "0.1.0"
dependencies = [
"async-trait",
"bytes",
"libc",
"tokio",
"tracing",
"virtnet",
]
[[package]]
name = "void"
version = "1.0.2"
@ -4843,7 +4843,7 @@ dependencies = [
"paste",
"thiserror",
"typetag",
"virtfs",
"virtual-fs",
"wasmer",
"wasmer-compiler",
"wasmer-compiler-cranelift",
@ -4938,9 +4938,9 @@ dependencies = [
"tracing-subscriber 0.3.16",
"unix_mode",
"url",
"virtfs",
"virtnet",
"virtnet-native",
"virtual-fs",
"virtual-net",
"walkdir",
"wasm-coredump-builder",
"wasmer",
@ -5313,9 +5313,9 @@ dependencies = [
"tracing-wasm",
"typetag",
"urlencoding",
"virtfs",
"virtnet",
"virtnet-native",
"virtual-fs",
"virtual-net",
"wai-bindgen-wasmer",
"waker-fn",
"wasm-bindgen",
@ -5390,7 +5390,7 @@ dependencies = [
"tempfile",
"thiserror",
"tokio",
"virtfs",
"virtual-fs",
"wasmer",
"wasmer-wasix",
"wast 38.0.1",

View File

@ -31,7 +31,7 @@ wasmer-compiler = { version = "=3.2.0-alpha.1", path = "../compiler" }
wasmer-middlewares = { version = "=3.2.0-alpha.1", path = "../middlewares", optional = true }
wasmer-wasix = { version = "0.1.0", path = "../wasi", features = ["host-fs", "host-vnet"], optional = true }
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types" }
virtfs = { version = "0.1.0", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] }
virtual-fs = { version = "0.1.0", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] }
webc = { version = "5.0.0-rc.5", optional = true }
enumset = "1.0.2"
cfg-if = "1.0"
@ -92,7 +92,7 @@ wasmer-artifact-load = ["wasmer-compiler/wasmer-artifact-load"]
wasmer-artifact-create = ["wasmer-compiler/wasmer-artifact-create"]
static-artifact-load = ["wasmer-compiler/static-artifact-load"]
static-artifact-create = ["wasmer-compiler/static-artifact-create"]
webc_runner = ["wasmer-wasix/webc_runner", "virtfs", "webc"]
webc_runner = ["wasmer-wasix/webc_runner", "virtual-fs", "webc"]
# Deprecated features.
jit = ["compiler"]

View File

@ -19,7 +19,7 @@ use std::slice;
#[cfg(feature = "webc_runner")]
use wasmer_api::{AsStoreMut, Imports, Module};
use wasmer_wasix::{
default_fs_backing, get_wasi_version, virtfs::AsyncReadExt, Pipe, VirtualTaskManager, WasiEnv,
default_fs_backing, get_wasi_version, virtual_fs::AsyncReadExt, Pipe, VirtualTaskManager, WasiEnv,
WasiEnvBuilder, WasiFile, WasiFunctionEnv, WasiVersion,
};
@ -248,7 +248,7 @@ fn prepare_webc_env(
len: usize,
package_name: &str,
) -> Option<(WasiFunctionEnv, Imports)> {
use virtfs::static_fs::StaticFileSystem;
use virtual_fs::static_fs::StaticFileSystem;
use webc::v1::{FsEntryType, WebC};
let slice = unsafe { std::slice::from_raw_parts(bytes, len) };

View File

@ -40,8 +40,8 @@ wasmer-cache = { version = "=3.2.0-alpha.1", path = "../cache", optional = true
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types", features = ["enable-serde"] }
wasmer-registry = { version = "=4.0.0", path = "../registry" }
wasmer-object = { version = "=3.2.0-alpha.1", path = "../object", optional = true }
virtfs = { version = "0.1.0", path = "../vfs", default-features = false, features = ["host-fs"] }
virtnet = { version = "0.1.0", path = "../vnet" }
virtual-fs = { version = "0.1.0", path = "../vfs", default-features = false, features = ["host-fs"] }
virtual-net = { version = "0.1.0", path = "../vnet" }
wasmer-wasm-interface = { version = "3.2.0-alpha.1", path = "../wasm-interface" }
wasmparser = "0.51.4"
atty = "0.2"

View File

@ -4,8 +4,8 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::{collections::BTreeSet, path::Path};
use virtfs::FileSystem;
use virtfs::{DeviceFile, PassthruFileSystem, RootFileSystemBuilder};
use virtual_fs::FileSystem;
use virtual_fs::{DeviceFile, PassthruFileSystem, RootFileSystemBuilder};
use wasmer::{AsStoreMut, Instance, Module, RuntimeError, Value};
use wasmer_wasix::types::__WASI_STDIN_FILENO;
use wasmer_wasix::{
@ -123,7 +123,7 @@ impl Wasi {
if self.networking {
rt.set_networking_implementation(virtnet_native::LocalNetworking::default());
} else {
rt.set_networking_implementation(virtnet::UnsupportedVirtualNetworking::default());
rt.set_networking_implementation(virtual_net::UnsupportedVirtualNetworking::default());
}
let engine = store.as_store_mut().engine().clone();

View File

@ -4,7 +4,7 @@
// use wasmer::{BaseTunables, Engine, Module, Store, Tunables};
// use wasmer_vm::VMMemory;
// use wasmer_wasix::{
// bin_factory::spawn_exec_module, virtfs::host_fs::File, BusSpawnedProcessJoin,
// bin_factory::spawn_exec_module, virtual_fs::host_fs::File, BusSpawnedProcessJoin,
// PluggableRuntimeImplementation, WasiControlPlane, WasiEnv, WasiRuntime,
// WasiState,
// };

View File

@ -1,5 +1,5 @@
[package]
name = "virtfs"
name = "virtual-fs"
version = "0.1.0"
description = "Wasmer Virtual FileSystem"
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -311,7 +311,7 @@ impl FileSystem for UnionFileSystem {
Err(err) => {
// This fixes a bug when attempting to create the directory /usr when it does not exist
// on the x86 version of memfs
// TODO: patch virtfs and remove
// TODO: patch virtual-fs and remove
if let FsError::NotAFile = &err {
ret_error = FsError::EntryNotFound;
} else {
@ -335,7 +335,7 @@ impl FileSystem for UnionFileSystem {
Err(err) => {
// This fixes a bug when attempting to create the directory /usr when it does not exist
// on the x86 version of memfs
// TODO: patch virtfs and remove
// TODO: patch virtual-fs and remove
if let FsError::NotAFile = &err {
ret_error = FsError::EntryNotFound;
} else {

View File

@ -1,5 +1,5 @@
[package]
name = "virtnet"
name = "virtual-net"
version = "0.1.0"
description = "Wasmer Virtual Networking"
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -14,7 +14,7 @@ edition = "2018"
maintenance = { status = "experimental" }
[dependencies]
virtnet = { version = "0.1.0", path = "../vnet" }
virtual-net = { version = "0.1.0", path = "../vnet" }
tracing = "0.1"
bytes = "1.1"
tokio = { version = "1", features = [ "sync", "macros", "io-util", "signal" ], default_features = false }

View File

@ -11,7 +11,7 @@ use tokio::sync::mpsc;
#[allow(unused_imports, dead_code)]
use tracing::{debug, error, info, trace, warn};
#[allow(unused_imports)]
use virtnet::{
use virtual_net::{
IpCidr, IpRoute, NetworkError, Result, SocketStatus, StreamSecurity, VirtualConnectedSocket,
VirtualConnectionlessSocket, VirtualIcmpSocket, VirtualNetworking, VirtualRawSocket,
VirtualSocket, VirtualTcpListener, VirtualTcpSocket, VirtualUdpSocket,

View File

@ -19,8 +19,8 @@ wasmer-wasix-types = { path = "../wasi-types", version = "0.1.0" }
wasmer-types = { path = "../types", version = "=3.2.0-alpha.1", default-features = false }
wasmer = { path = "../api", version = "=3.2.0-alpha.1", default-features = false, features = ["wat", "js-serializable-module"] }
wasmer-vm = { path = "../vm", version = "=3.2.0-alpha.1", optional = true }
virtfs = { path = "../vfs", version = "0.1.0", default-features = false, features = ["webc-fs"] }
virtnet = { path = "../vnet", version = "0.1.0", default-features = false }
virtual-fs = { path = "../vfs", version = "0.1.0", default-features = false, features = ["webc-fs"] }
virtual-net = { path = "../vnet", version = "0.1.0", default-features = false }
virtnet-native = { path = "../wasi-local-networking", version = "0.1.0", default-features = false, optional = true }
wasmer-emscripten = { path = "../emscripten", version = "=3.2.0-alpha.1", optional = true }
typetag = { version = "0.1", optional = true }
@ -108,14 +108,14 @@ sys-thread = ["tokio/rt", "tokio/time", "tokio/rt-multi-thread"]
compiler = [ "wasmer/compiler", "wasmer-compiler"]
js = ["wasmer/js", "virtfs/no-time", "getrandom/js", "chrono", "wasmer-wasix-types/js"]
js = ["wasmer/js", "virtual-fs/no-time", "getrandom/js", "chrono", "wasmer-wasix-types/js"]
js-default = ["js", "wasmer/js-default"]
test-js = ["js", "wasmer/js-default", "wasmer/wat"]
host-vnet = [ "virtnet-native" ]
host-threads = []
host-reqwest = ["reqwest"]
host-fs = ["virtfs/host-fs"]
host-fs = ["virtual-fs/host-fs"]
host-termios = ["termios", "term_size"]
logging = ["tracing/log"]
@ -125,7 +125,7 @@ disable-all-logging = [
]
enable-serde = [
"typetag",
"virtfs/enable-serde",
"virtual-fs/enable-serde",
"wasmer-wasix-types/enable-serde",
]

View File

@ -6,7 +6,7 @@ use std::{
};
use derivative::*;
use virtfs::{FileSystem, TmpFileSystem};
use virtual_fs::{FileSystem, TmpFileSystem};
use wasmer_wasix_types::wasi::Snapshot0Clockid;
use super::hash_of_binary;

View File

@ -4,7 +4,7 @@ use std::{
sync::{Arc, RwLock},
};
use virtfs::{AsyncReadExt, FileSystem};
use virtual_fs::{AsyncReadExt, FileSystem};
mod binary_package;
mod exec;

View File

@ -7,7 +7,7 @@ use std::{
#[cfg(feature = "enable-serde")]
use serde_derive::{Deserialize, Serialize};
use virtfs::{Pipe, VirtualFile};
use virtual_fs::{Pipe, VirtualFile};
use wasmer_wasix_types::wasi::{Fd as WasiFd, Fdflags, Filestat, Rights};
use crate::net::socket::InodeSocket;

View File

@ -9,8 +9,8 @@ use std::{
};
use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite};
use virtfs::{FsError, VirtualFile};
use virtnet::NetworkError;
use virtual_fs::{FsError, VirtualFile};
use virtual_net::NetworkError;
use wasmer_wasix_types::{
types::Eventtype,
wasi,

View File

@ -18,7 +18,7 @@ use crate::state::{Stderr, Stdin, Stdout};
use serde_derive::{Deserialize, Serialize};
use tokio::io::AsyncWriteExt;
use tracing::{debug, trace};
use virtfs::{FileSystem, FsError, OpenOptions, VirtualFile};
use virtual_fs::{FileSystem, FsError, OpenOptions, VirtualFile};
use wasmer_wasix_types::{
types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO},
wasi::{
@ -261,48 +261,48 @@ impl Default for WasiInodes {
#[derive(Debug, Clone)]
pub enum WasiFsRoot {
Sandbox(Arc<virtfs::tmp_fs::TmpFileSystem>),
Sandbox(Arc<virtual_fs::tmp_fs::TmpFileSystem>),
Backing(Arc<Box<dyn FileSystem>>),
}
impl FileSystem for WasiFsRoot {
fn read_dir(&self, path: &Path) -> virtfs::Result<virtfs::ReadDir> {
fn read_dir(&self, path: &Path) -> virtual_fs::Result<virtual_fs::ReadDir> {
match self {
WasiFsRoot::Sandbox(fs) => fs.read_dir(path),
WasiFsRoot::Backing(fs) => fs.read_dir(path),
}
}
fn create_dir(&self, path: &Path) -> virtfs::Result<()> {
fn create_dir(&self, path: &Path) -> virtual_fs::Result<()> {
match self {
WasiFsRoot::Sandbox(fs) => fs.create_dir(path),
WasiFsRoot::Backing(fs) => fs.create_dir(path),
}
}
fn remove_dir(&self, path: &Path) -> virtfs::Result<()> {
fn remove_dir(&self, path: &Path) -> virtual_fs::Result<()> {
match self {
WasiFsRoot::Sandbox(fs) => fs.remove_dir(path),
WasiFsRoot::Backing(fs) => fs.remove_dir(path),
}
}
fn rename(&self, from: &Path, to: &Path) -> virtfs::Result<()> {
fn rename(&self, from: &Path, to: &Path) -> virtual_fs::Result<()> {
match self {
WasiFsRoot::Sandbox(fs) => fs.rename(from, to),
WasiFsRoot::Backing(fs) => fs.rename(from, to),
}
}
fn metadata(&self, path: &Path) -> virtfs::Result<virtfs::Metadata> {
fn metadata(&self, path: &Path) -> virtual_fs::Result<virtual_fs::Metadata> {
match self {
WasiFsRoot::Sandbox(fs) => fs.metadata(path),
WasiFsRoot::Backing(fs) => fs.metadata(path),
}
}
fn symlink_metadata(&self, path: &Path) -> virtfs::Result<virtfs::Metadata> {
fn symlink_metadata(&self, path: &Path) -> virtual_fs::Result<virtual_fs::Metadata> {
match self {
WasiFsRoot::Sandbox(fs) => fs.symlink_metadata(path),
WasiFsRoot::Backing(fs) => fs.symlink_metadata(path),
}
}
fn remove_file(&self, path: &Path) -> virtfs::Result<()> {
fn remove_file(&self, path: &Path) -> virtual_fs::Result<()> {
match self {
WasiFsRoot::Sandbox(fs) => fs.remove_file(path),
WasiFsRoot::Backing(fs) => fs.remove_file(path),
@ -1763,12 +1763,12 @@ impl std::fmt::Debug for WasiFs {
}
/// Returns the default filesystem backing
pub fn default_fs_backing() -> Box<dyn virtfs::FileSystem + Send + Sync> {
pub fn default_fs_backing() -> Box<dyn virtual_fs::FileSystem + Send + Sync> {
cfg_if::cfg_if! {
if #[cfg(feature = "host-fs")] {
Box::new(virtfs::host_fs::FileSystem::default())
Box::new(virtual_fs::host_fs::FileSystem::default())
} else if #[cfg(not(feature = "host-fs"))] {
Box::new(virtfs::mem_fs::FileSystem::default())
Box::new(virtual_fs::mem_fs::FileSystem::default())
} else {
Box::new(FallbackFileSystem::default())
}
@ -1785,7 +1785,7 @@ impl FallbackFileSystem {
}
impl FileSystem for FallbackFileSystem {
fn read_dir(&self, _path: &Path) -> Result<virtfs::ReadDir, FsError> {
fn read_dir(&self, _path: &Path) -> Result<virtual_fs::ReadDir, FsError> {
Self::fail();
}
fn create_dir(&self, _path: &Path) -> Result<(), FsError> {
@ -1797,21 +1797,21 @@ impl FileSystem for FallbackFileSystem {
fn rename(&self, _from: &Path, _to: &Path) -> Result<(), FsError> {
Self::fail();
}
fn metadata(&self, _path: &Path) -> Result<virtfs::Metadata, FsError> {
fn metadata(&self, _path: &Path) -> Result<virtual_fs::Metadata, FsError> {
Self::fail();
}
fn symlink_metadata(&self, _path: &Path) -> Result<virtfs::Metadata, FsError> {
fn symlink_metadata(&self, _path: &Path) -> Result<virtual_fs::Metadata, FsError> {
Self::fail();
}
fn remove_file(&self, _path: &Path) -> Result<(), FsError> {
Self::fail();
}
fn new_open_options(&self) -> virtfs::OpenOptions {
fn new_open_options(&self) -> virtual_fs::OpenOptions {
Self::fail();
}
}
pub fn virtual_file_type_to_wasi_file_type(file_type: virtfs::FileType) -> Filetype {
pub fn virtual_file_type_to_wasi_file_type(file_type: virtual_fs::FileType) -> Filetype {
// TODO: handle other file types
if file_type.is_dir() {
Filetype::Directory

View File

@ -72,14 +72,14 @@ use wasmer::{
MemorySize, RuntimeError,
};
pub use virtfs;
#[deprecated(since = "2.1.0", note = "Please use `virtfs::FsError`")]
pub use virtfs::FsError as WasiFsError;
#[deprecated(since = "2.1.0", note = "Please use `virtfs::VirtualFile`")]
pub use virtfs::VirtualFile as WasiFile;
pub use virtfs::{DuplexPipe, FsError, Pipe, VirtualFile, WasiBidirectionalSharedPipePair};
pub use virtnet;
pub use virtnet::{UnsupportedVirtualNetworking, VirtualNetworking};
pub use virtual_fs;
#[deprecated(since = "2.1.0", note = "Please use `virtual_fs::FsError`")]
pub use virtual_fs::FsError as WasiFsError;
#[deprecated(since = "2.1.0", note = "Please use `virtual_fs::VirtualFile`")]
pub use virtual_fs::VirtualFile as WasiFile;
pub use virtual_fs::{DuplexPipe, FsError, Pipe, VirtualFile, WasiBidirectionalSharedPipePair};
pub use virtual_net;
pub use virtual_net::{UnsupportedVirtualNetworking, VirtualNetworking};
#[cfg(feature = "host-vnet")]
pub use virtnet_native::{

View File

@ -4,7 +4,7 @@ use std::{
time::Duration,
};
use virtnet::{IpCidr, IpRoute, NetworkError};
use virtual_net::{IpCidr, IpRoute, NetworkError};
use wasmer::{MemoryView, WasmPtr};
use wasmer_types::MemorySize;
use wasmer_wasix_types::{

View File

@ -10,7 +10,7 @@ use std::{
#[cfg(feature = "enable-serde")]
use serde_derive::{Deserialize, Serialize};
use virtnet::{
use virtual_net::{
VirtualIcmpSocket, VirtualNetworking, VirtualRawSocket, VirtualTcpListener, VirtualTcpSocket,
VirtualUdpSocket,
};
@ -1213,7 +1213,7 @@ impl InodeSocketProtected {
pub fn poll_read_ready(
&mut self,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<virtnet::Result<usize>> {
) -> std::task::Poll<virtual_net::Result<usize>> {
match &mut self.kind {
InodeSocketKind::TcpListener { socket, .. } => socket.poll_accept_ready(cx),
InodeSocketKind::TcpStream { socket, .. } => socket.poll_read_ready(cx),
@ -1221,7 +1221,7 @@ impl InodeSocketProtected {
InodeSocketKind::Raw(socket) => socket.poll_read_ready(cx),
InodeSocketKind::Icmp(socket) => socket.poll_read_ready(cx),
InodeSocketKind::PreSocket { .. } => {
std::task::Poll::Ready(Err(virtnet::NetworkError::IOError))
std::task::Poll::Ready(Err(virtual_net::NetworkError::IOError))
}
}
}
@ -1229,7 +1229,7 @@ impl InodeSocketProtected {
pub fn poll_write_ready(
&mut self,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<virtnet::Result<usize>> {
) -> std::task::Poll<virtual_net::Result<usize>> {
match &mut self.kind {
InodeSocketKind::TcpListener { .. } => std::task::Poll::Pending,
InodeSocketKind::TcpStream { socket, .. } => socket.poll_write_ready(cx),
@ -1237,7 +1237,7 @@ impl InodeSocketProtected {
InodeSocketKind::Raw(socket) => socket.poll_write_ready(cx),
InodeSocketKind::Icmp(socket) => socket.poll_write_ready(cx),
InodeSocketKind::PreSocket { .. } => {
std::task::Poll::Ready(Err(virtnet::NetworkError::IOError))
std::task::Poll::Ready(Err(virtual_net::NetworkError::IOError))
}
}
}

View File

@ -16,7 +16,7 @@ use linked_hash_set::LinkedHashSet;
use tokio::sync::{mpsc, RwLock};
#[allow(unused_imports, dead_code)]
use tracing::{debug, error, info, trace, warn};
use virtfs::{
use virtual_fs::{
ArcBoxFile, ArcFile, AsyncWriteExt, CombineFile, DeviceFile, DuplexPipe, FileSystem, Pipe,
PipeRx, PipeTx, RootFileSystemBuilder, VirtualFile,
};
@ -209,7 +209,7 @@ impl Console {
} else {
let mut stderr = self.stderr.clone();
tasks.block_on(async {
virtfs::AsyncWriteExt::write_all(
virtual_fs::AsyncWriteExt::write_all(
&mut stderr,
format!("package not found [{}]\r\n", webc).as_bytes(),
)
@ -229,7 +229,7 @@ impl Console {
if let Err(err) = env.uses(self.uses.clone()) {
let mut stderr = self.stderr.clone();
tasks.block_on(async {
virtfs::AsyncWriteExt::write_all(&mut stderr, format!("{}\r\n", err).as_bytes())
virtual_fs::AsyncWriteExt::write_all(&mut stderr, format!("{}\r\n", err).as_bytes())
.await
.ok();
});
@ -265,7 +265,7 @@ impl Console {
data.insert_str(0, ConsoleConst::TERM_NO_WRAPAROUND);
let mut stderr = self.stderr.clone();
virtfs::AsyncWriteExt::write_all(&mut stderr, data.as_str().as_bytes())
virtual_fs::AsyncWriteExt::write_all(&mut stderr, data.as_str().as_bytes())
.await
.ok();
}

View File

@ -5,7 +5,7 @@ use std::{
use derivative::*;
use futures::future::BoxFuture;
use virtfs::{AsyncWriteExt, NullFile, VirtualFile};
use virtual_fs::{AsyncWriteExt, NullFile, VirtualFile};
use wasmer_wasix_types::wasi::{Signal, Snapshot0Clockid};
use crate::syscalls::platform_clock_time_get;

View File

@ -1,7 +1,7 @@
use std::{path::PathBuf, sync::Arc};
use bytes::Bytes;
use virtfs::{webc_fs::WebcFileSystem, FileSystem};
use virtual_fs::{webc_fs::WebcFileSystem, FileSystem};
use webc::{
metadata::Manifest,
v1::{ParseOptions, WebC, WebCMmap, WebCOwned},

View File

@ -15,7 +15,7 @@ use tokio::{
io::{AsyncBufReadExt, AsyncRead, AsyncWrite, AsyncWriteExt},
runtime::Handle,
};
use virtfs::{FileSystem, PassthruFileSystem, RootFileSystemBuilder, TmpFileSystem};
use virtual_fs::{FileSystem, PassthruFileSystem, RootFileSystemBuilder, TmpFileSystem};
use wasmer::Module;
use wcgi_host::CgiDialect;

View File

@ -2,7 +2,7 @@ use std::{collections::HashMap, convert::Infallible, net::SocketAddr, path::Path
use anyhow::{Context, Error};
use futures::future::AbortHandle;
use virtfs::FileSystem;
use virtual_fs::FileSystem;
use wasmer::{Engine, Module, Store};
use wcgi_host::CgiDialect;
use webc::metadata::{

View File

@ -4,7 +4,7 @@ pub use self::task_manager::{SpawnType, SpawnedMemory, VirtualTaskManager};
use std::{fmt, sync::Arc};
use virtnet::{DynVirtualNetworking, VirtualNetworking};
use virtual_net::{DynVirtualNetworking, VirtualNetworking};
use crate::{http::DynHttpClient, os::TtyBridge};
@ -85,7 +85,7 @@ impl PluggableRuntimeImplementation {
if #[cfg(feature = "host-vnet")] {
let networking = Arc::new(virtnet_native::LocalNetworking::default());
} else {
let networking = Arc::new(virtnet::UnsupportedVirtualNetworking::default());
let networking = Arc::new(virtual_net::UnsupportedVirtualNetworking::default());
}
}
cfg_if::cfg_if! {

View File

@ -8,7 +8,7 @@ use std::{
use rand::Rng;
use thiserror::Error;
use virtfs::{ArcFile, FsError, TmpFileSystem, VirtualFile};
use virtual_fs::{ArcFile, FsError, TmpFileSystem, VirtualFile};
use wasmer::{AsStoreMut, Instance, Module};
use crate::{
@ -480,19 +480,19 @@ impl WasiEnvBuilder {
/// Sets the FileSystem to be used with this WASI instance.
///
/// This is usually used in case a custom `virtfs::FileSystem` is needed.
pub fn fs(mut self, fs: Box<dyn virtfs::FileSystem + Send + Sync>) -> Self {
/// This is usually used in case a custom `virtual_fs::FileSystem` is needed.
pub fn fs(mut self, fs: Box<dyn virtual_fs::FileSystem + Send + Sync>) -> Self {
self.set_fs(fs);
self
}
pub fn set_fs(&mut self, fs: Box<dyn virtfs::FileSystem + Send + Sync>) {
pub fn set_fs(&mut self, fs: Box<dyn virtual_fs::FileSystem + Send + Sync>) {
self.fs = Some(WasiFsRoot::Backing(Arc::new(fs)));
}
/// Sets a new sandbox FileSystem to be used with this WASI instance.
///
/// This is usually used in case a custom `virtfs::FileSystem` is needed.
/// This is usually used in case a custom `virtual_fs::FileSystem` is needed.
pub fn sandbox_fs(mut self, fs: TmpFileSystem) -> Self {
self.fs = Some(WasiFsRoot::Sandbox(Arc::new(fs)));
self

View File

@ -3,8 +3,8 @@ use std::{collections::HashMap, ops::Deref, path::PathBuf, sync::Arc, time::Dura
use derivative::Derivative;
use rand::Rng;
use tracing::{trace, warn};
use virtfs::{FsError, VirtualFile};
use virtnet::DynVirtualNetworking;
use virtual_fs::{FsError, VirtualFile};
use virtual_net::DynVirtualNetworking;
#[cfg(feature = "sys")]
use wasmer::NativeEngineExt;
use wasmer::{
@ -766,7 +766,7 @@ impl WasiEnv {
use std::{borrow::Cow, collections::VecDeque};
#[allow(unused_imports)]
use virtfs::FileSystem;
use virtual_fs::FileSystem;
let mut already: HashMap<String, Cow<'static, str>> = HashMap::new();
@ -859,7 +859,7 @@ impl WasiEnv {
use std::path::Path;
#[allow(unused_imports)]
use virtfs::FileSystem;
use virtual_fs::FileSystem;
#[cfg(feature = "sys")]
for (command, target) in map_commands.iter() {

View File

@ -32,7 +32,7 @@ use std::{
use derivative::Derivative;
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
use virtfs::{FileOpener, FileSystem, FsError, OpenOptions, VirtualFile};
use virtual_fs::{FileOpener, FileSystem, FsError, OpenOptions, VirtualFile};
use wasmer::Store;
use wasmer_wasix_types::wasi::{Errno, Fd as WasiFd, Rights, Snapshot0Clockid};
@ -61,8 +61,8 @@ impl FileOpener for WasiStateOpener {
fn open(
&self,
path: &Path,
conf: &virtfs::OpenOptionsConfig,
) -> virtfs::Result<Box<dyn VirtualFile + Send + Sync + 'static>> {
conf: &virtual_fs::OpenOptionsConfig,
) -> virtual_fs::Result<Box<dyn VirtualFile + Send + Sync + 'static>> {
let mut new_options = self.root_fs.new_open_options();
new_options.options(conf.clone());
new_options.open(path)
@ -177,7 +177,7 @@ impl WasiState {
// Implementations of direct to FS calls so that we can easily change their implementation
impl WasiState {
pub(crate) fn fs_read_dir<P: AsRef<Path>>(&self, path: P) -> Result<virtfs::ReadDir, Errno> {
pub(crate) fn fs_read_dir<P: AsRef<Path>>(&self, path: P) -> Result<virtual_fs::ReadDir, Errno> {
self.fs
.root_fs
.read_dir(path.as_ref())

View File

@ -11,9 +11,9 @@ use crate::VirtualBusError;
cfg_if! {
if #[cfg(feature = "host-fs")] {
pub use virtfs::host_fs::{Stderr, Stdin, Stdout};
pub use virtual_fs::host_fs::{Stderr, Stdin, Stdout};
} else {
pub use virtfs::mem_fs::{Stderr, Stdin, Stdout};
pub use virtual_fs::mem_fs::{Stderr, Stdin, Stdout};
}
}

View File

@ -63,10 +63,10 @@ pub use unix::*;
#[cfg(any(target_family = "wasm"))]
pub use wasm::*;
pub(crate) use virtfs::{
pub(crate) use virtual_fs::{
AsyncSeekExt, AsyncWriteExt, DuplexPipe, FileSystem, FsError, VirtualFile,
};
pub(crate) use virtnet::StreamSecurity;
pub(crate) use virtual_net::StreamSecurity;
pub(crate) use wasmer::{
AsStoreMut, AsStoreRef, Extern, Function, FunctionEnv, FunctionEnvMut, Global, Instance,
Memory, Memory32, Memory64, MemoryAccessError, MemoryError, MemorySize, MemoryView, Module,

View File

@ -1,6 +1,6 @@
use std::{collections::VecDeque, task::Waker};
use virtfs::{AsyncReadExt, ReadBuf};
use virtual_fs::{AsyncReadExt, ReadBuf};
use super::*;
use crate::{fs::NotificationInner, syscalls::*};
@ -280,7 +280,7 @@ fn fd_read_internal<M: MemorySize>(
.map_err(mem_error_to_wasi)?;
total_read +=
virtfs::AsyncReadExt::read(&mut pipe, buf.as_mut()).await?;
virtual_fs::AsyncReadExt::read(&mut pipe, buf.as_mut()).await?;
}
Ok(total_read)
}

View File

@ -109,7 +109,7 @@ pub fn path_open<M: MemorySize>(
(false, false, false)
};
virtfs::OpenOptionsConfig {
virtual_fs::OpenOptionsConfig {
read: fs_rights_base.contains(Rights::FD_READ),
write: write_permission,
create_new: create_permission && o_flags.contains(Oflags::EXCL),
@ -118,7 +118,7 @@ pub fn path_open<M: MemorySize>(
truncate: truncate_permission,
}
}
Err(_) => virtfs::OpenOptionsConfig {
Err(_) => virtual_fs::OpenOptionsConfig {
append: fs_flags.contains(Fdflags::APPEND),
write: fs_rights_base.contains(Rights::FD_WRITE),
read: fs_rights_base.contains(Rights::FD_READ),
@ -128,7 +128,7 @@ pub fn path_open<M: MemorySize>(
},
};
let parent_rights = virtfs::OpenOptionsConfig {
let parent_rights = virtual_fs::OpenOptionsConfig {
read: working_dir.rights.contains(Rights::FD_READ),
write: working_dir.rights.contains(Rights::FD_WRITE),
// The parent is a directory, which is why these options

View File

@ -1,4 +1,4 @@
use virtfs::Pipe;
use virtual_fs::Pipe;
use super::*;
use crate::syscalls::*;

View File

@ -1,4 +1,4 @@
use virtfs::Pipe;
use virtual_fs::Pipe;
use super::*;
use crate::syscalls::*;

View File

@ -1,4 +1,4 @@
use virtfs::AsyncReadExt;
use virtual_fs::AsyncReadExt;
use super::*;
use crate::{syscalls::*, WasiInodes};
@ -130,7 +130,7 @@ pub fn sock_send_file<M: MemorySize>(
// TODO: optimize with MaybeUninit
let mut buf = vec![0u8; sub_count as usize];
let amt =
virtfs::AsyncReadExt::read(pipe, &mut buf[..])
virtual_fs::AsyncReadExt::read(pipe, &mut buf[..])
.await
.map_err(map_io_err)?;
buf.truncate(amt);

View File

@ -4,7 +4,7 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
use virtfs::FileSystem;
use virtual_fs::FileSystem;
use tracing::*;
#[allow(unused_imports)]
@ -364,7 +364,7 @@ where
}
// Add the file system from the webc
let webc_fs = virtfs::webc_fs::WebcFileSystem::init_all(ownership.clone());
let webc_fs = virtual_fs::webc_fs::WebcFileSystem::init_all(ownership.clone());
let top_level_dirs = webc_fs.top_level_dirs().clone();
pck.webc_fs = Some(Arc::new(webc_fs));
pck.webc_top_level_dirs = top_level_dirs;

View File

@ -1,6 +1,6 @@
use std::sync::Arc;
use virtfs::{AsyncReadExt, AsyncWriteExt};
use virtual_fs::{AsyncReadExt, AsyncWriteExt};
use wasmer::{Module, Store};
use wasmer_wasix::{Pipe, PluggableRuntimeImplementation, WasiEnv};

View File

@ -14,7 +14,7 @@ edition = "2018"
anyhow = "1.0"
wasmer = { path = "../../../lib/api", version = "=3.2.0-alpha.1", default-features = false }
wasmer-wasix = { path = "../../../lib/wasi", version = "0.1.0" }
virtfs = { path = "../../../lib/vfs", version = "0.1.0" }
virtual-fs = { path = "../../../lib/vfs", version = "0.1.0" }
wast = "38.0"
serde = "1"
tempfile = "3.4.0"

View File

@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::sync::{mpsc, Arc, Mutex};
use std::task::{Context, Poll};
use virtfs::{
use virtual_fs::{
host_fs, mem_fs, passthru_fs, tmp_fs, union_fs, AsyncRead, AsyncSeek, AsyncWrite,
AsyncWriteExt, FileSystem, Pipe, ReadBuf, RootFileSystemBuilder,
};
@ -20,22 +20,22 @@ use wast::parser::{self, Parse, ParseBuffer, Parser};
/// The kind of filesystem `WasiTest` is going to use.
#[derive(Debug)]
pub enum WasiFileSystemKind {
/// Instruct the test runner to use `virtfs::host_fs`.
/// Instruct the test runner to use `virtual_fs::host_fs`.
Host,
/// Instruct the test runner to use `virtfs::mem_fs`.
/// Instruct the test runner to use `virtual_fs::mem_fs`.
InMemory,
/// Instruct the test runner to use `virtfs::tmp_fs`
/// Instruct the test runner to use `virtual_fs::tmp_fs`
Tmp,
/// Instruct the test runner to use `virtfs::passtru_fs`
/// Instruct the test runner to use `virtual_fs::passtru_fs`
PassthruMemory,
/// Instruct the test runner to use `virtfs::union_fs<host_fs, mem_fs>`
/// Instruct the test runner to use `virtual_fs::union_fs<host_fs, mem_fs>`
UnionHostMemory,
/// Instruct the test runner to use the TempFs returned by `virtfs::builder::RootFileSystemBuilder`
/// Instruct the test runner to use the TempFs returned by `virtual_fs::builder::RootFileSystemBuilder`
RootFileSystemBuilder,
}
@ -690,7 +690,7 @@ impl AsyncRead for OutputCapturerer {
}
}
/// When using `virtfs::mem_fs`, we cannot rely on `BASE_TEST_DIR`
/// When using `virtual_fs::mem_fs`, we cannot rely on `BASE_TEST_DIR`
/// because the host filesystem cannot be used. Instead, we are
/// copying `BASE_TEST_DIR` to the `mem_fs`.
fn map_host_fs_to_mem_fs<'a>(