Rename aster-frame to ostd

This commit is contained in:
Jianfeng Jiang 2024-06-19 08:18:39 +00:00 committed by Tate, Hongliang Tian
parent fb59fa7a55
commit 59350a8578
300 changed files with 425 additions and 427 deletions

View File

@ -3,8 +3,8 @@ name: OSDK Test
on:
pull_request:
paths:
- framework/**
- osdk/**
- ostd/**
- tools/**
- Cargo.toml
push:

102
Cargo.lock generated
View File

@ -77,13 +77,13 @@ name = "aster-block"
version = "0.1.0"
dependencies = [
"align_ext",
"aster-frame",
"aster-util",
"bitflags 1.3.2",
"component",
"int-to-c-enum",
"lazy_static",
"log",
"ostd",
"pod",
"spin 0.9.8",
"static_assertions",
@ -93,63 +93,22 @@ dependencies = [
name = "aster-console"
version = "0.1.0"
dependencies = [
"aster-frame",
"aster-util",
"bitflags 1.3.2",
"component",
"log",
"ostd",
"spin 0.9.8",
]
[[package]]
name = "aster-frame"
version = "0.1.0"
dependencies = [
"acpi",
"align_ext",
"aml",
"array-init",
"aster-main",
"bit_field",
"bitflags 1.3.2",
"bitvec",
"buddy_system_allocator",
"cfg-if",
"gimli",
"iced-x86",
"id-alloc",
"inherit-methods-macro",
"int-to-c-enum",
"intrusive-collections",
"ktest",
"lazy_static",
"linux-boot-params",
"log",
"multiboot2",
"num",
"num-derive",
"num-traits",
"pod",
"rsdp",
"spin 0.9.8",
"static_assertions",
"tdx-guest",
"trapframe",
"unwinding",
"volatile",
"x86",
"x86_64",
"xarray",
]
[[package]]
name = "aster-framebuffer"
version = "0.1.0"
dependencies = [
"aster-frame",
"component",
"font8x8",
"log",
"ostd",
"spin 0.9.8",
]
@ -158,7 +117,6 @@ name = "aster-input"
version = "0.1.0"
dependencies = [
"ascii",
"aster-frame",
"aster-rights",
"aster-util",
"bitflags 1.3.2",
@ -166,6 +124,7 @@ dependencies = [
"int-to-c-enum",
"lazy_static",
"log",
"ostd",
"spin 0.9.8",
]
@ -183,7 +142,6 @@ name = "aster-network"
version = "0.1.0"
dependencies = [
"align_ext",
"aster-frame",
"aster-rights",
"aster-util",
"bitflags 1.3.2",
@ -192,6 +150,7 @@ dependencies = [
"int-to-c-enum",
"ktest",
"log",
"ostd",
"pod",
"ringbuf",
"smoltcp",
@ -206,7 +165,6 @@ dependencies = [
"ascii",
"aster-block",
"aster-console",
"aster-frame",
"aster-input",
"aster-network",
"aster-rights",
@ -237,6 +195,7 @@ dependencies = [
"libflate",
"log",
"lru",
"ostd",
"paste",
"pod",
"rand",
@ -276,10 +235,10 @@ dependencies = [
name = "aster-time"
version = "0.1.0"
dependencies = [
"aster-frame",
"aster-util",
"component",
"log",
"ostd",
"spin 0.9.8",
]
@ -287,11 +246,11 @@ dependencies = [
name = "aster-util"
version = "0.1.0"
dependencies = [
"aster-frame",
"aster-rights",
"aster-rights-proc",
"inherit-methods-macro",
"ktest",
"ostd",
"pod",
"typeflags-util",
]
@ -303,7 +262,6 @@ dependencies = [
"align_ext",
"aster-block",
"aster-console",
"aster-frame",
"aster-input",
"aster-network",
"aster-rights",
@ -315,6 +273,7 @@ dependencies = [
"id-alloc",
"int-to-c-enum",
"log",
"ostd",
"pod",
"smoltcp",
"spin 0.9.8",
@ -325,12 +284,12 @@ dependencies = [
name = "asterinas"
version = "0.4.0"
dependencies = [
"aster-frame",
"aster-framebuffer",
"aster-nix",
"aster-time",
"component",
"id-alloc",
"ostd",
"x86_64",
]
@ -1134,6 +1093,47 @@ version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "ostd"
version = "0.1.0"
dependencies = [
"acpi",
"align_ext",
"aml",
"array-init",
"aster-main",
"bit_field",
"bitflags 1.3.2",
"bitvec",
"buddy_system_allocator",
"cfg-if",
"gimli",
"iced-x86",
"id-alloc",
"inherit-methods-macro",
"int-to-c-enum",
"intrusive-collections",
"ktest",
"lazy_static",
"linux-boot-params",
"log",
"multiboot2",
"num",
"num-derive",
"num-traits",
"pod",
"rsdp",
"spin 0.9.8",
"static_assertions",
"tdx-guest",
"trapframe",
"unwinding",
"volatile",
"x86",
"x86_64",
"xarray",
]
[[package]]
name = "owo-colors"
version = "3.5.0"

View File

@ -1,15 +1,15 @@
[workspace]
resolver = "2"
members = [
"framework/aster-frame",
"framework/libs/align_ext",
"framework/libs/aster-main",
"framework/libs/id-alloc",
"framework/libs/linux-bzimage/builder",
"framework/libs/linux-bzimage/boot-params",
"framework/libs/linux-bzimage/setup",
"framework/libs/ktest",
"framework/libs/ktest-proc-macro",
"ostd",
"ostd/libs/align_ext",
"ostd/libs/aster-main",
"ostd/libs/id-alloc",
"ostd/libs/linux-bzimage/builder",
"ostd/libs/linux-bzimage/boot-params",
"ostd/libs/linux-bzimage/setup",
"ostd/libs/ktest",
"ostd/libs/ktest-proc-macro",
"kernel",
"kernel/aster-nix",
"kernel/comps/block",

View File

@ -85,13 +85,13 @@ export
# Basically, non-OSDK crates do not depend on Aster Frame and can be checked
# or tested without OSDK.
NON_OSDK_CRATES := \
framework/libs/align_ext \
framework/libs/aster-main \
framework/libs/id-alloc \
framework/libs/linux-bzimage/builder \
framework/libs/linux-bzimage/boot-params \
framework/libs/ktest \
framework/libs/ktest-proc-macro \
ostd/libs/align_ext \
ostd/libs/aster-main \
ostd/libs/id-alloc \
ostd/libs/linux-bzimage/builder \
ostd/libs/linux-bzimage/boot-params \
ostd/libs/ktest \
ostd/libs/ktest-proc-macro \
kernel/libs/cpio-decoder \
kernel/libs/int-to-c-enum \
kernel/libs/int-to-c-enum/derive \
@ -101,11 +101,11 @@ NON_OSDK_CRATES := \
kernel/libs/typeflags \
kernel/libs/typeflags-util
# In contrast, OSDK crates depend on Aster Frame (or being aster-frame itself)
# In contrast, OSDK crates depend on OSTD (or being `ostd` itself)
# and need to be built or tested with OSDK.
OSDK_CRATES := \
framework/aster-frame \
framework/libs/linux-bzimage/setup \
ostd \
ostd/libs/linux-bzimage/setup \
kernel \
kernel/aster-nix \
kernel/comps/block \
@ -179,7 +179,7 @@ test:
ktest: initramfs $(CARGO_OSDK)
@# Exclude linux-bzimage-setup from ktest since it's hard to be unit tested
@for dir in $(OSDK_CRATES); do \
[ $$dir = "framework/libs/linux-bzimage/setup" ] && continue; \
[ $$dir = "ostd/libs/linux-bzimage/setup" ] && continue; \
(cd $$dir && cargo osdk test) || exit 1; \
done

View File

@ -20,20 +20,20 @@ Asterinas Kernel implements Linux ABI in a safe and efficient way.
This means it can seamlessly replace Linux,
offering enhanced safety and security.
#### [Part 2: Asterinas Framework](framework/)
#### [Part 2: Asterinas OSTD](ostd/)
The Framework lays down a minimalistic, powerful, and solid foundation
Asterinas OSTD lays down a minimalistic, powerful, and solid foundation
for OS development.
It's akin to Rust's `std` crate
but crafted for the demands of _safe_ Rust OS development.
Asterinas Kernel is built on this very Framework.
Asterinas Kernel is built on this very OSTD.
#### [Part 3: Asterinas OSDK](osdk/guide/)
The OSDK is a command-line tool
that streamlines the workflow to
create, build, test, and run Rust OS projects
that are built upon Asterinas Framework.
that are built upon Asterinas OSTD.
Developed specifically for OS developers,
it extends Rust's Cargo tool to better suite their specific needs.
OSDK is instrumental in the development of Asterinas Kernel.

View File

@ -11,10 +11,10 @@
* [Linux Compatibility](kernel/linux-compatibility.md)
* [Roadmap](kernel/roadmap.md)
# Asterinas Framework
# Asterinas OSTD
* [An Overview of the Framework](framework/README.md)
* [Example: Writing a Kernel in 100 Lines of Safe Rust](framework/a-100-line-kernel.md)
* [An Overview of OSTD](ostd/README.md)
* [Example: Writing a Kernel in 100 Lines of Safe Rust](ostd/a-100-line-kernel.md)
* [Example: Writing a Driver in 100 Lines of Safe Rust]()
* [Soundness Analysis]()

View File

@ -26,7 +26,7 @@ make ktest
To test an individual crate in kernel mode, enter the directory of the crate and invoke `cargo osdk test`.
```bash
cd asterinas/framework/aster-frame
cd asterinas/ostd
cargo osdk test
```

View File

@ -75,7 +75,7 @@ as [zero-cost abstractions](https://monomorph.is/posts/zero-cost-abstractions/).
Fortunatelly, our efforts
to design and implement an OS framework meeting these standards
have borne fruit in the form of the [Asterinas Framework](../framework/).
have borne fruit in the form of the [Asterinas OSTD](../ostd/).
Using this framework as a foundation,
we have developed the Asterinas Kernel;
this framework also enables others to create their own framekernels,

View File

@ -77,11 +77,11 @@ and each test case is marked with `#[ktest]`.
The `Cargo.toml` file is the Rust project manifest.
In addition to the contents of a normal Rust project,
OSDK will add the dependencies of the Asterinas framework to the file.
OSDK will add the dependencies of the Asterinas OSTD to the file.
The dependency version may change over time.
```toml
[dependencies.aster_frame]
[dependencies.ostd]
git = "https://github.com/asterinas/asterinas"
branch = "main"
@ -116,4 +116,4 @@ The default manifest of a kernel project:
### `rust-toolchain.toml`
The Rust toolchain for the kernel.
It aligns with the toolchain of the Asterinas framework.
It aligns with the toolchain of the Asterinas OSTD.

View File

@ -1,4 +1,4 @@
# Asterinas Framework
# Asterinas OSTD
> Confucious remarked,
> "I could follow whatever my heart desired
@ -7,7 +7,7 @@
> 子曰:
> "从心所欲,不逾矩。"
With Asterinas Framework,
With Asterinas OSTD,
you don't have to learn the dark art of unsafe Rust programming
and risk shooting yourself in the foot.
You will be doing whatever your heart desired
@ -17,7 +17,7 @@ even if today marks your Day 1 as a Rust programmer.
## APIs
Asterinas Framework stands
Asterinas OSTD stands
as a powerful and solid foundation for safe kernel development,
providing high-level safe Rust APIs that are
@ -38,14 +38,14 @@ Most of these APIs fall into the following categories:
To explore how these APIs come into play,
see [the example of a 100-line kernel in safe Rust](a-100-line-kernel.md).
The framework APIs have been extensively documented.
The OSTD APIs have been extensively documented.
You can access the comprehensive API documentation for each release by visiting the [API docs](https://asterinas.github.io/api-docs).
Additionally, you can refer to the latest nightly version API documentation at [API docs nightly](https://asterinas.github.io/api-docs-nightly),
which remains in sync with the latest changes in the main branch.
## Four Requirements Satisfied
In designing and implementing Asterinas Framework,
In designing and implementing OSTD,
we have risen to meet the challenge of
fulfilling [the aforementioned four criteria as demanded by the framekernel architecture](../kernel/the-framekernel-architecture.md).
@ -55,19 +55,19 @@ file systems,
network protocols,
and device drivers (e.g., Virtio drivers)
have been implemented in safe Rust
by leveraging the Framework.
by leveraging OSTD.
Adopting a minimalist philosophy,
the Framework has a small codebase.
At its core lies the `aster-frame` crate,
OSTD has a small codebase.
At its core lies the `ostd` crate,
currently encompassing about 10K lines of code
---a figure that is even smaller than those of many microkernels.
As the Framework evolves,
As OSTD evolves,
its codebase will expand,
albeit at a relatively slow rate
in comparison to the OS services layered atop it.
The Framework's efficiency is measurable
OSTD's efficiency is measurable
through the performance metrics of its APIs
and the system calls of Asterinas Kernel.
No intrinsic limitations have been identified within Rust

View File

@ -1,7 +1,7 @@
# Example: Writing a Kernel in About 100 Lines of Safe Rust
To give you a sense of
how Asterinas Framework enables writing kernels in safe Rust,
how Asterinas OSTD enables writing kernels in safe Rust,
we will show a new kernel in about 100 lines of safe Rust.
Our new kernel will be able to run the following Hello World program.
@ -39,7 +39,7 @@ The user program above requires our kernel to support three main features:
A sample implementation of the kernel in safe Rust is given below.
Comments are added
to highlight how the APIs of Asterinas Framework enable safe kernel development.
to highlight how the APIs of Asterinas OSTD enable safe kernel development.
```rust
#![no_std]
@ -52,13 +52,13 @@ use core::str;
use alloc::sync::Arc;
use alloc::vec;
use aster_frame::cpu::UserContext;
use aster_frame::prelude::*;
use aster_frame::task::{Task, TaskOptions};
use aster_frame::user::{ReturnReason, UserMode, UserSpace};
use aster_frame::mm::{PageFlags, PAGE_SIZE, Vaddr, FrameAllocOptions, VmIo, VmMapOptions, VmSpace};
use ostd::cpu::UserContext;
use ostd::prelude::*;
use ostd::task::{Task, TaskOptions};
use ostd::user::{ReturnReason, UserMode, UserSpace};
use ostd::mm::{PageFlags, PAGE_SIZE, Vaddr, FrameAllocOptions, VmIo, VmMapOptions, VmSpace};
/// The kernel's boot and initialization process is managed by Asterinas Framework.
/// The kernel's boot and initialization process is managed by Asterinas OSTD.
/// After the process is done, the kernel's execution environment
/// (e.g., stack, heap, tasks) will be ready for use and the entry function
/// labeled as `#[aster_main]` will be called.
@ -130,9 +130,9 @@ fn create_user_task(user_space: Arc<UserSpace>) -> Arc<Task> {
}
}
// Kernel tasks are managed by the Framework,
// Kernel tasks are managed by OSTD,
// while scheduling algorithms for them can be
// determined by the users of the Framework.
// determined by the users of OSTD.
TaskOptions::new(user_task)
.user_space(Some(user_space))
.data(0)

View File

@ -1,29 +0,0 @@
# Asterinas Framework
Asterinas Framework is a Rust OS framework that facilitates the development of and innovation in OS kernels written in Rust.
## An overview
Asterinas Framework provides a solid foundation for Rust developers to build their own OS kernels. While Asterinas Framework origins from Asterinas, the first ever framekernel, Asterinas Framework is well suited for building OS kernels of any architecture, be it a framekernel, a monolithic kernel, or a microkernel.
Asterinas Framework offers the following key values.
1. **Lowering the entry bar for OS innovation.** Building an OS from scratch is not easy. Not to mention a novel one. Before adding any novel or interesting feature, an OS developer must first have something runnable, which must include basic functionalities for managing CPU, memory, and interrupts. Asterinas Framework has laid this groundwork so that OS developers do not have to deal with the most low-level, error-prone, architecture-specific aspects of OS development themselves.
2. **Enhancing the memory safety of Rust OSes.** Asterinas Framework encapsulates low-level, machine-oriented unsafe Rust code into high-level, machine-agnostic safe APIs. These APIs are carefully designed and implemented to be sound and minimal, ensuring the memory safety of any safe Rust callers. Our experience in building Asterinas has shown that Asterinas Framework is powerful enough to allow a feature-rich, Linux-compatible kernel to be completely written in safe Rust, including its device drivers.
3. **Promoting code reuse across Rust OS projects.** Shipped as crates, Rust code can be reused across projects---except when they are OSes. A crate that implements a feature or driver for OS A can hardly be reused by OS B because the crate must be [`no_std`](https://docs.rust-embedded.org/book/intro/no-std.html#summary) and depend on the infrastructure APIs provided by OS A, which are obviously different from that provided by OS B. This incompatibility problem can be resolved by Asterinas Framework as it can serve as a common ground across different Rust OS projects, as long as they are built upon Asterinas Framework.
4. **Boost productivity with user-mode development.** Traditionally, developing a kernel feature involves countless rounds of coding, failing, and rebooting on bare-metal or virtual machines, which is a painfully slow process. Asterinas Framework accelerates the process by allowing high-level OS features like file systems and network stacks to be quickly tested in user mode, making the experience of OS development as smooth as that of application development. To support user-mode development, Asterinas Framework is implemented for the Linux platform, in addition to bare-mental or virtual machine environments.
## Framework APIs
TODO
## Implementation status
TODO
## Roadmap and plan
TODO

View File

@ -4,8 +4,8 @@ version = "0.4.0"
edition = "2021"
[dependencies]
id-alloc = { path = "../framework/libs/id-alloc" }
aster-frame = { path = "../framework/aster-frame" }
id-alloc = { path = "../ostd/libs/id-alloc" }
ostd = { path = "../ostd" }
aster-nix = { path = "aster-nix" }
component = { path = "libs/comp-sys/component" }
@ -15,4 +15,4 @@ aster-time = { path = "comps/time" }
aster-framebuffer = { path = "comps/framebuffer" }
[features]
intel_tdx = ["aster-frame/intel_tdx", "aster-nix/intel_tdx"]
intel_tdx = ["ostd/intel_tdx", "aster-nix/intel_tdx"]

View File

@ -6,8 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aster-frame = { path = "../../framework/aster-frame" }
align_ext = { path = "../../framework/libs/align_ext" }
ostd = { path = "../../ostd" }
align_ext = { path = "../../ostd/libs/align_ext" }
pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" }
aster-input = { path = "../comps/input" }
aster-block = { path = "../comps/block" }
@ -21,7 +21,7 @@ typeflags = { path = "../libs/typeflags" }
typeflags-util = { path = "../libs/typeflags-util" }
aster-rights-proc = { path = "../libs/aster-rights-proc" }
aster-util = { path = "../libs/aster-util" }
id-alloc = { path = "../../framework/libs/id-alloc" }
id-alloc = { path = "../../ostd/libs/id-alloc" }
int-to-c-enum = { path = "../libs/int-to-c-enum" }
cpio-decoder = { path = "../libs/cpio-decoder" }
ascii = { version = "1.1", default-features = false, features = ["alloc"] }
@ -42,7 +42,7 @@ smoltcp = { version = "0.9.1", default-features = false, features = [
"socket-raw",
"socket-dhcpv4",
] }
ktest = { path = "../../framework/libs/ktest" }
ktest = { path = "../../ostd/libs/ktest" }
tdx-guest = { version = "0.1.0", optional = true }
# parse elf file

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::cpu::UserContext;
use ostd::cpu::UserContext;
use crate::cpu::LinuxAbi;

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::cpu::UserContext;
use ostd::cpu::UserContext;
use crate::process::signal::{sig_num::SigNum, SignalContext};

View File

@ -2,8 +2,8 @@
#![allow(dead_code)]
pub use aster_frame::arch::console;
use aster_frame::mm::VmReader;
pub use ostd::arch::console;
use ostd::mm::VmReader;
use spin::Once;
use crate::{

View File

@ -4,7 +4,7 @@
use alloc::format;
use aster_frame::trap::{disable_local, in_interrupt_context};
use ostd::trap::{disable_local, in_interrupt_context};
use ringbuf::{ring_buffer::RbBase, Rb, StaticRb};
use super::termio::{KernelTermios, WinSize, CC_C_CHAR};

View File

@ -2,7 +2,7 @@
#![allow(dead_code)]
use aster_frame::early_print;
use ostd::early_print;
use spin::Once;
use self::{driver::TtyDriver, line_discipline::LineDiscipline};

View File

@ -188,17 +188,17 @@ impl AsRef<Error> for Error {
}
}
impl From<aster_frame::Error> for Error {
fn from(frame_error: aster_frame::Error) -> Self {
impl From<ostd::Error> for Error {
fn from(frame_error: ostd::Error) -> Self {
match frame_error {
aster_frame::Error::AccessDenied => Error::new(Errno::EFAULT),
aster_frame::Error::NoMemory => Error::new(Errno::ENOMEM),
aster_frame::Error::InvalidArgs => Error::new(Errno::EINVAL),
aster_frame::Error::IoError => Error::new(Errno::EIO),
aster_frame::Error::NotEnoughResources => Error::new(Errno::EBUSY),
aster_frame::Error::PageFault => Error::new(Errno::EFAULT),
aster_frame::Error::Overflow => Error::new(Errno::EOVERFLOW),
aster_frame::Error::MapAlreadyMappedVaddr => Error::new(Errno::EINVAL),
ostd::Error::AccessDenied => Error::new(Errno::EFAULT),
ostd::Error::NoMemory => Error::new(Errno::ENOMEM),
ostd::Error::InvalidArgs => Error::new(Errno::EINVAL),
ostd::Error::IoError => Error::new(Errno::EIO),
ostd::Error::NotEnoughResources => Error::new(Errno::EBUSY),
ostd::Error::PageFault => Error::new(Errno::EFAULT),
ostd::Error::Overflow => Error::new(Errno::EOVERFLOW),
ostd::Error::MapAlreadyMappedVaddr => Error::new(Errno::EINVAL),
}
}
}
@ -288,16 +288,16 @@ impl From<cpio_decoder::error::Error> for Error {
}
}
impl From<Error> for aster_frame::Error {
impl From<Error> for ostd::Error {
fn from(error: Error) -> Self {
match error.errno {
Errno::EACCES => aster_frame::Error::AccessDenied,
Errno::EIO => aster_frame::Error::IoError,
Errno::ENOMEM => aster_frame::Error::NoMemory,
Errno::EFAULT => aster_frame::Error::PageFault,
Errno::EINVAL => aster_frame::Error::InvalidArgs,
Errno::EBUSY => aster_frame::Error::NotEnoughResources,
_ => aster_frame::Error::InvalidArgs,
Errno::EACCES => ostd::Error::AccessDenied,
Errno::EIO => ostd::Error::IoError,
Errno::ENOMEM => ostd::Error::NoMemory,
Errno::EFAULT => ostd::Error::PageFault,
Errno::EINVAL => ostd::Error::InvalidArgs,
Errno::EBUSY => ostd::Error::NotEnoughResources,
_ => ostd::Error::InvalidArgs,
}
}
}

View File

@ -2,8 +2,8 @@
use core::{fmt::Display, ops::Range};
use aster_frame::mm::VmIo;
use aster_rights::Full;
use ostd::mm::VmIo;
use super::{
constants::{EXFAT_FILE_NAME_LEN, MAX_NAME_LENGTH},

View File

@ -6,10 +6,10 @@
use core::{num::NonZeroUsize, ops::Range, sync::atomic::AtomicU64};
use aster_block::{bio::BioWaiter, id::BlockId, BlockDevice};
use aster_frame::mm::Frame;
pub(super) use aster_frame::mm::VmIo;
use hashbrown::HashMap;
use lru::LruCache;
use ostd::mm::Frame;
pub(super) use ostd::mm::VmIo;
use super::{
bitmap::ExfatBitmap,

View File

@ -12,8 +12,8 @@ use aster_block::{
id::{Bid, BlockId},
BLOCK_SIZE,
};
use aster_frame::mm::{Frame, FrameAllocOptions, VmIo};
use aster_rights::Full;
use ostd::mm::{Frame, FrameAllocOptions, VmIo};
use super::{
constants::*,

View File

@ -21,7 +21,7 @@ mod test {
bio::{BioEnqueueError, BioStatus, BioType, SubmittedBio},
BlockDevice,
};
use aster_frame::mm::{FrameAllocOptions, Segment, VmIo};
use ostd::mm::{FrameAllocOptions, Segment, VmIo};
use rand::{rngs::SmallRng, RngCore, SeedableRng};
use crate::{

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::sync::RwMutexReadGuard;
use ostd::sync::RwMutexReadGuard;
use crate::{
fs::{

View File

@ -11,11 +11,11 @@ pub(super) use aster_block::{
id::Bid,
BlockDevice, BLOCK_SIZE,
};
pub(super) use aster_frame::{
pub(super) use aster_rights::Full;
pub(super) use ostd::{
mm::{Frame, FrameAllocOptions, Segment, VmIo},
sync::{RwMutex, RwMutexReadGuard, RwMutexWriteGuard},
};
pub(super) use aster_rights::Full;
pub(super) use static_assertions::const_assert;
pub(super) use super::utils::{Dirty, IsPowerOf};

View File

@ -6,12 +6,12 @@ use core::{
};
use aster_block::bio::BioWaiter;
use aster_frame::{
use aster_rights::Full;
use aster_util::slot_vec::SlotVec;
use ostd::{
mm::{Frame, VmIo},
sync::RwMutexWriteGuard,
};
use aster_rights::Full;
use aster_util::slot_vec::SlotVec;
use super::*;
use crate::{

View File

@ -5,9 +5,9 @@
use core::ops::Range;
use aster_block::bio::{BioStatus, BioWaiter};
use aster_frame::mm::{Frame, FrameAllocOptions};
use aster_rights::Full;
use lru::LruCache;
use ostd::mm::{Frame, FrameAllocOptions};
use crate::{
prelude::*,

View File

@ -23,7 +23,7 @@
#![feature(trait_upcasting)]
#![register_tool(component_access_control)]
use aster_frame::{
use ostd::{
arch::qemu::{exit_qemu, QemuExitCode},
boot,
};
@ -91,7 +91,7 @@ fn init_thread() {
thread::work_queue::init();
// FIXME: Remove this if we move the step of mounting
// the filesystems to be done within the init process.
aster_frame::trap::enable_local();
ostd::trap::enable_local();
net::lazy_init();
fs::lazy_init();
// driver::pci::virtio::block::block_device_test();

View File

@ -3,8 +3,8 @@
use alloc::collections::btree_map::Entry;
use core::sync::atomic::{AtomicU64, Ordering};
use aster_frame::sync::WaitQueue;
use keyable_arc::KeyableWeak;
use ostd::sync::WaitQueue;
use smoltcp::{
iface::{SocketHandle, SocketSet},
phy::Device,

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::sync::WaitQueue;
use ostd::sync::WaitQueue;
use smoltcp::iface::SocketSet;
use self::common::IfaceCommon;

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::arch::timer::Jiffies;
use ostd::arch::timer::Jiffies;
pub(super) fn get_network_timestamp() -> smoltcp::time::Instant {
let millis = Jiffies::elapsed().as_duration().as_millis();

View File

@ -2,7 +2,7 @@
use core::time::Duration;
use aster_frame::{arch::timer::Jiffies, task::Priority};
use ostd::{arch::timer::Jiffies, task::Priority};
use super::Iface;
use crate::{

View File

@ -13,13 +13,13 @@ pub(crate) use alloc::{
};
pub(crate) use core::{any::Any, ffi::CStr, fmt::Debug};
pub(crate) use aster_frame::{
mm::{Vaddr, PAGE_SIZE},
sync::{Mutex, MutexGuard, RwLock, RwMutex, SpinLock, SpinLockGuard},
};
pub(crate) use bitflags::bitflags;
pub(crate) use int_to_c_enum::TryFromInt;
pub(crate) use log::{debug, error, info, log_enabled, trace, warn};
pub(crate) use ostd::{
mm::{Vaddr, PAGE_SIZE},
sync::{Mutex, MutexGuard, RwLock, RwMutex, SpinLock, SpinLockGuard},
};
pub(crate) use pod::Pod;
/// return current process

View File

@ -4,12 +4,12 @@
use core::sync::atomic::Ordering;
use aster_frame::{
use aster_rights::Full;
use ostd::{
cpu::UserContext,
mm::VmIo,
user::{UserContextApi, UserSpace},
};
use aster_rights::Full;
use super::{
credentials,

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::sync::{RwLockReadGuard, RwLockWriteGuard};
use ostd::sync::{RwLockReadGuard, RwLockWriteGuard};
use super::{group::AtomicGid, user::AtomicUid, Gid, Uid};
use crate::{

View File

@ -2,9 +2,9 @@
#![allow(dead_code)]
use aster_frame::sync::{RwLockReadGuard, RwLockWriteGuard};
use aster_rights::{Dup, Read, TRights, Write};
use aster_rights_proc::require;
use ostd::sync::{RwLockReadGuard, RwLockWriteGuard};
use super::{capabilities::CapSet, credentials_::Credentials_, Credentials, Gid, Uid};
use crate::prelude::*;

View File

@ -2,7 +2,7 @@
#![allow(dead_code)]
use aster_frame::user::UserSpace;
use ostd::user::UserSpace;
use super::PosixThread;
use crate::{

View File

@ -4,7 +4,7 @@
use core::sync::atomic::{AtomicBool, Ordering};
use aster_frame::cpu::num_cpus;
use ostd::cpu::num_cpus;
use spin::Once;
use crate::{

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::{
use ostd::{
cpu::UserContext,
user::{UserContextApi, UserSpace},
};

View File

@ -7,14 +7,14 @@ use alloc::{
};
use core::time::Duration;
use aster_frame::{
use id_alloc::IdAlloc;
use ostd::{
arch::{
timer::{self, TIMER_FREQ},
x86::trap::is_kernel_interrupted,
},
sync::Mutex,
};
use id_alloc::IdAlloc;
use super::Process;
use crate::{

View File

@ -19,8 +19,8 @@ use core::{
};
use align_ext::AlignExt;
use aster_frame::mm::{VmIo, MAX_USERSPACE_VADDR};
use aster_rights::{Full, Rights};
use ostd::mm::{VmIo, MAX_USERSPACE_VADDR};
use self::aux_vec::{AuxKey, AuxVec};
use crate::{

View File

@ -7,8 +7,8 @@
//! When create a process from elf file, we will use the elf_load_info to construct the VmSpace
use align_ext::AlignExt;
use aster_frame::mm::VmIo;
use aster_rights::{Full, Rights};
use ostd::mm::VmIo;
use xmas_elf::program::{self, ProgramHeader64};
use super::elf_file::Elf;

View File

@ -5,8 +5,8 @@
use core::mem::{self, size_of};
use aster_frame::cpu::GeneralRegs;
use aster_util::{read_union_fields, union_read_ptr::UnionReadPtr};
use ostd::cpu::GeneralRegs;
use super::sig_num::SigNum;
use crate::{

View File

@ -16,9 +16,9 @@ pub mod signals;
use core::{mem, sync::atomic::Ordering};
use align_ext::AlignExt;
use aster_frame::{cpu::UserContext, user::UserContextApi};
use c_types::{siginfo_t, ucontext_t};
pub use events::{SigEvents, SigEventsFilter};
use ostd::{cpu::UserContext, user::UserContextApi};
pub use pauser::Pauser;
pub use poll::{Pollee, Poller};
use sig_action::{SigAction, SigActionFlags, SigDefaultAction};

View File

@ -7,7 +7,7 @@ use core::{
time::Duration,
};
use aster_frame::sync::WaitQueue;
use ostd::sync::WaitQueue;
use super::{sig_mask::SigMask, SigEvents, SigEventsFilter};
use crate::{
@ -24,7 +24,7 @@ use crate::{
/// into one. Both putting the current thread to sleep and waking it up can be done through the
/// same `Pauser` object, using its `pause`- and `resume`-family methods.
///
/// [`Waiter`]: aster_frame::sync::Waiter
/// [`Waiter`]: ostd::sync::Waiter
///
/// # Example
///

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::cpu::{
use ostd::cpu::{
CpuException, CpuExceptionInfo, ALIGNMENT_CHECK, BOUND_RANGE_EXCEEDED, DIVIDE_BY_ZERO,
GENERAL_PROTECTION_FAULT, INVALID_OPCODE, PAGE_FAULT, SIMD_FLOATING_POINT_EXCEPTION,
X87_FLOATING_POINT_EXCEPTION,

View File

@ -6,7 +6,7 @@
use alloc::sync::Arc;
use core::time::Duration;
use aster_frame::sync::{MutexGuard, SpinLock, WaitQueue};
use ostd::sync::{MutexGuard, SpinLock, WaitQueue};
use crate::time::wait::WaitTimeout;
@ -51,7 +51,7 @@ impl<Guard> LockErr<Guard> {
///
/// ```rust
/// use alloc::sync::Arc;
/// use aster_frame::sync::Mutex;
/// use ostd::sync::Mutex;
/// use crate::{process::sync::Condvar, thread::{kernel_thread::KernelThreadExt, Thread}};
///
/// // Initializing a shared condition between threads
@ -264,7 +264,7 @@ impl Condvar {
#[cfg(ktest)]
mod test {
use aster_frame::sync::Mutex;
use ostd::sync::Mutex;
use super::*;
use crate::thread::{

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::task::{set_scheduler, Scheduler, Task, TaskAdapter};
use intrusive_collections::LinkedList;
use ostd::task::{set_scheduler, Scheduler, Task, TaskAdapter};
use crate::prelude::*;

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::cpu::UserContext;
use ostd::cpu::UserContext;
use super::SyscallReturn;
use crate::{cpu::LinuxAbi, prelude::*};

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::cpu::UserContext;
use ostd::cpu::UserContext;
use super::SyscallReturn;
use crate::{

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::{cpu::UserContext, user::UserContextApi};
use aster_rights::WriteOp;
use ostd::{cpu::UserContext, user::UserContextApi};
use super::{constants::*, SyscallReturn};
use crate::{

View File

@ -2,7 +2,7 @@
#![allow(unused_variables)]
use aster_frame::cpu::UserContext;
use ostd::cpu::UserContext;
use super::SyscallReturn;
use crate::{

View File

@ -2,8 +2,8 @@
//! Read the Cpu context content then dispatch syscall to corrsponding handler
//! The each sub module contains functions that handle real syscall logic.
use aster_frame::cpu::UserContext;
pub use clock_gettime::ClockId;
use ostd::cpu::UserContext;
use crate::{cpu::LinuxAbi, prelude::*};
@ -160,7 +160,7 @@ macro_rules! dispatch_fn_inner {
$crate::syscall::syscall_handler!($cnt, $handler, $args, &$context)
};
( $args: ident, $context: ident, $handler: ident ( args[ .. $cnt: tt ] , &mut context ) ) => {
// `$context` is already of type `&mut aster_frame::cpu::UserContext`,
// `$context` is already of type `&mut ostd::cpu::UserContext`,
// so no need to take `&mut` again
$crate::syscall::syscall_handler!($cnt, $handler, $args, $context)
};
@ -178,7 +178,7 @@ macro_rules! impl_syscall_nums_and_dispatch_fn {
pub fn syscall_dispatch(
syscall_number: u64,
args: [u64; 6],
context: &mut aster_frame::cpu::UserContext,
context: &mut ostd::cpu::UserContext,
) -> $crate::prelude::Result<$crate::syscall::SyscallReturn> {
match syscall_number {
$(

View File

@ -2,7 +2,7 @@
#![allow(unused_variables)]
use aster_frame::mm::VmIo;
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::{cpu::UserContext, user::UserContextApi};
use ostd::{cpu::UserContext, user::UserContextApi};
use super::SyscallReturn;
use crate::{

View File

@ -8,8 +8,8 @@ use core::{
sync::atomic::{AtomicBool, Ordering},
};
use aster_frame::{cpu_local, sync::SpinLock, trap::SoftIrqLine, CpuLocal};
use intrusive_collections::{intrusive_adapter, LinkedList, LinkedListAtomicLink};
use ostd::{cpu_local, sync::SpinLock, trap::SoftIrqLine, CpuLocal};
use crate::softirq_id::{TASKLESS_SOFTIRQ_ID, TASKLESS_URGENT_SOFTIRQ_ID};
@ -41,7 +41,7 @@ use crate::softirq_id::{TASKLESS_SOFTIRQ_ID, TASKLESS_URGENT_SOFTIRQ_ID};
///
/// Users can create a `Taskless` and schedule it at any place.
/// ```rust
/// #use aster_frame::softirq::Taskless;
/// #use ostd::softirq::Taskless;
///
/// #fn my_func() {}
///
@ -189,7 +189,7 @@ fn taskless_softirq_handler(
mod test {
use core::sync::atomic::AtomicUsize;
use aster_frame::trap::enable_local;
use ostd::trap::enable_local;
use super::*;

View File

@ -2,7 +2,7 @@
#![allow(unused_variables)]
use aster_frame::cpu::*;
use ostd::cpu::*;
use crate::{
prelude::*, process::signal::signals::fault::FaultSignal,

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::{
use ostd::{
cpu::CpuSet,
task::{Priority, TaskOptions},
};

View File

@ -4,7 +4,7 @@
use core::sync::atomic::{AtomicU32, Ordering};
use aster_frame::task::Task;
use ostd::task::Task;
use self::status::{AtomicThreadStatus, ThreadStatus};
use crate::prelude::*;

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::{
use ostd::{
task::{preempt, Task, TaskOptions},
user::{ReturnReason, UserContextApi, UserMode, UserSpace},
};

View File

@ -2,7 +2,7 @@
#![allow(dead_code)]
use aster_frame::cpu::CpuSet;
use ostd::cpu::CpuSet;
use spin::Once;
use work_item::WorkItem;
use worker_pool::WorkerPool;
@ -65,7 +65,7 @@ static WORKQUEUE_GLOBAL_HIGH_PRI: Once<Arc<WorkQueue>> = Once::new();
/// Certainly, users can also create a dedicated WorkQueue and WorkerPool.
///
/// ```rust
/// use aster_frame::cpu::CpuSet;
/// use ostd::cpu::CpuSet;
/// use crate::thread::work_queue::{WorkQueue, WorkerPool, WorkItem};
///
/// fn deferred_task(){

View File

@ -4,7 +4,7 @@
use core::sync::atomic::{AtomicBool, Ordering};
use aster_frame::cpu::CpuSet;
use ostd::cpu::CpuSet;
use crate::prelude::*;

View File

@ -2,7 +2,7 @@
#![allow(dead_code)]
use aster_frame::{cpu::CpuSet, task::Priority};
use ostd::{cpu::CpuSet, task::Priority};
use super::worker_pool::WorkerPool;
use crate::{

View File

@ -7,7 +7,7 @@ use core::{
time::Duration,
};
use aster_frame::{
use ostd::{
cpu::CpuSet,
sync::WaitQueue,
task::{add_task, Priority},

View File

@ -3,7 +3,7 @@
use alloc::sync::Arc;
use core::time::Duration;
use aster_frame::sync::SpinLock;
use ostd::sync::SpinLock;
use crate::time::Clock;

View File

@ -3,8 +3,8 @@
use alloc::sync::Arc;
use core::time::Duration;
use aster_frame::{arch::timer::Jiffies, cpu_local, sync::SpinLock, CpuLocal};
use aster_time::read_monotonic_time;
use ostd::{arch::timer::Jiffies, cpu_local, sync::SpinLock, CpuLocal};
use paste::paste;
use spin::Once;

View File

@ -2,8 +2,8 @@
use core::time::Duration;
use aster_frame::arch::timer::TIMER_FREQ;
use aster_time::NANOS_PER_SECOND;
use ostd::arch::timer::TIMER_FREQ;
pub mod timer;

View File

@ -11,7 +11,7 @@ use core::{
time::Duration,
};
use aster_frame::sync::SpinLock;
use ostd::sync::SpinLock;
use super::Clock;

View File

@ -2,7 +2,7 @@
use alloc::{boxed::Box, vec::Vec};
use aster_frame::{arch::timer, sync::RwLock, trap::SoftIrqLine};
use ostd::{arch::timer, sync::RwLock, trap::SoftIrqLine};
use crate::softirq_id::TIMER_SOFTIRQ_ID;

View File

@ -81,7 +81,7 @@ impl SystemTime {
}
}
/// convert aster_frame::time::Time to System time
/// convert ostd::time::Time to System time
fn convert_system_time(system_time: aster_time::SystemTime) -> Result<SystemTime> {
let month = match Month::try_from(system_time.month) {
Ok(month) => month,

View File

@ -2,7 +2,7 @@
use core::time::Duration;
use aster_frame::sync::{WaitQueue, Waiter};
use ostd::sync::{WaitQueue, Waiter};
use super::{clocks::JIFFIES_TIMER_MANAGER, timer::Timeout};

View File

@ -2,8 +2,8 @@
use core::mem;
use aster_frame::mm::VmIo;
use aster_rights::Full;
use ostd::mm::VmIo;
use crate::{prelude::*, vm::vmar::Vmar};
mod iovec;

View File

@ -2,8 +2,8 @@
use core::time::Duration;
use aster_frame::mm::VmIo;
use aster_rights::Full;
use ostd::mm::VmIo;
use crate::{
net::socket::{ip::stream::CongestionControl, LingerOption},

View File

@ -17,13 +17,13 @@
use alloc::{boxed::Box, sync::Arc};
use core::{mem::ManuallyDrop, time::Duration};
use aster_frame::{
mm::{Frame, VmIo, PAGE_SIZE},
sync::SpinLock,
};
use aster_rights::Rights;
use aster_time::{read_monotonic_time, Instant};
use aster_util::coeff::Coeff;
use ostd::{
mm::{Frame, VmIo, PAGE_SIZE},
sync::SpinLock,
};
use pod::Pod;
use spin::Once;

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::mm::PageFlags;
use aster_rights::Rights;
use bitflags::bitflags;
use ostd::mm::PageFlags;
bitflags! {
/// The memory access permissions of memory mappings.

View File

@ -2,8 +2,8 @@
use core::ops::Range;
use aster_frame::mm::VmIo;
use aster_rights::Rights;
use ostd::mm::VmIo;
use super::{
options::VmarChildOptions, vm_mapping::VmarMapOptions, VmPerms, Vmar, VmarRightsOp, Vmar_,
@ -159,13 +159,13 @@ impl Vmar<Rights> {
}
impl VmIo for Vmar<Rights> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> {
self.check_rights(Rights::READ)?;
self.0.read(offset, buf)?;
Ok(())
}
fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> {
fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> {
self.check_rights(Rights::WRITE)?;
self.0.write(offset, buf)?;
Ok(())

View File

@ -13,8 +13,8 @@ pub mod vm_mapping;
use core::{cmp::min, ops::Range};
use align_ext::AlignExt;
use aster_frame::mm::{VmSpace, MAX_USERSPACE_VADDR};
use aster_rights::Rights;
use ostd::mm::{VmSpace, MAX_USERSPACE_VADDR};
use self::{
interval::{Interval, IntervalSet},

View File

@ -2,7 +2,7 @@
//! Options for allocating child VMARs.
use aster_frame::{mm::PAGE_SIZE, Error, Result};
use ostd::{mm::PAGE_SIZE, Error, Result};
use super::Vmar;
@ -135,8 +135,8 @@ impl<R> VmarChildOptions<R> {
#[cfg(ktest)]
mod test {
use aster_frame::mm::VmIo;
use aster_rights::Full;
use ostd::mm::VmIo;
use super::*;
use crate::vm::{

View File

@ -2,9 +2,9 @@
use core::ops::Range;
use aster_frame::mm::VmIo;
use aster_rights::{Dup, Rights, TRightSet, TRights};
use aster_rights_proc::require;
use ostd::mm::VmIo;
use super::{
options::VmarChildOptions, vm_mapping::VmarMapOptions, VmPerms, Vmar, VmarRightsOp, Vmar_,
@ -180,13 +180,13 @@ impl<R: TRights> Vmar<TRightSet<R>> {
}
impl<R: TRights> VmIo for Vmar<TRightSet<R>> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> {
self.check_rights(Rights::READ)?;
self.0.read(offset, buf)?;
Ok(())
}
fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> {
fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> {
self.check_rights(Rights::WRITE)?;
self.0.write(offset, buf)?;
Ok(())

View File

@ -5,7 +5,7 @@
use core::ops::Range;
use aster_frame::mm::{Frame, FrameVec, PageFlags, VmIo, VmMapOptions, VmSpace};
use ostd::mm::{Frame, FrameVec, PageFlags, VmIo, VmMapOptions, VmSpace};
use super::{interval::Interval, is_intersected, Vmar, Vmar_};
use crate::{

View File

@ -2,8 +2,8 @@
use core::ops::Range;
use aster_frame::mm::{Frame, VmIo};
use aster_rights::{Rights, TRights};
use ostd::mm::{Frame, VmIo};
use super::{
options::{VmoCowChild, VmoSliceChild},
@ -151,13 +151,13 @@ impl Vmo<Rights> {
}
impl VmIo for Vmo<Rights> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> {
self.check_rights(Rights::READ)?;
self.0.read_bytes(offset, buf)?;
Ok(())
}
fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> {
fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> {
self.check_rights(Rights::WRITE)?;
self.0.write_bytes(offset, buf)?;
Ok(())

View File

@ -8,11 +8,11 @@
use core::ops::Range;
use align_ext::AlignExt;
use aster_frame::{
use aster_rights::Rights;
use ostd::{
collections::xarray::{CursorMut, XArray, XMark},
mm::{Frame, FrameAllocOptions, VmReader, VmWriter},
};
use aster_rights::Rights;
use crate::prelude::*;
@ -76,7 +76,7 @@ use self::options::ChildType;
/// # Implementation
///
/// `Vmo` provides high-level APIs for address space management by wrapping
/// around its low-level counterpart `aster_frame::vm::VmFrames`.
/// around its low-level counterpart `ostd::vm::VmFrames`.
/// Compared with `VmFrames`,
/// `Vmo` is easier to use (by offering more powerful APIs) and
/// harder to misuse (thanks to its nature of being capability).

View File

@ -7,12 +7,12 @@
use core::{marker::PhantomData, ops::Range};
use align_ext::AlignExt;
use aster_frame::{
use aster_rights::{Dup, Rights, TRightSet, TRights, Write};
use aster_rights_proc::require;
use ostd::{
collections::xarray::XArray,
mm::{Frame, FrameAllocOptions},
};
use aster_rights::{Dup, Rights, TRightSet, TRights, Write};
use aster_rights_proc::require;
use typeflags_util::{SetExtend, SetExtendOp};
use super::{Pager, Pages, Vmo, VmoFlags, VmoMark, VmoRightsOp};
@ -476,8 +476,8 @@ impl VmoChildType for VmoCowChild {}
#[cfg(ktest)]
mod test {
use aster_frame::mm::VmIo;
use aster_rights::Full;
use ostd::mm::VmIo;
use super::*;

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::mm::Frame;
use ostd::mm::Frame;
use crate::prelude::*;

View File

@ -2,9 +2,9 @@
use core::ops::Range;
use aster_frame::mm::{Frame, VmIo};
use aster_rights::{Dup, Rights, TRightSet, TRights, Write};
use aster_rights_proc::require;
use ostd::mm::{Frame, VmIo};
use super::{
options::{VmoCowChild, VmoSliceChild},
@ -145,13 +145,13 @@ impl<R: TRights> Vmo<TRightSet<R>> {
}
impl<R: TRights> VmIo for Vmo<TRightSet<R>> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> {
self.check_rights(Rights::READ)?;
self.0.read_bytes(offset, buf)?;
Ok(())
}
fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> {
fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> {
self.check_rights(Rights::WRITE)?;
self.0.write_bytes(offset, buf)?;
Ok(())

View File

@ -9,8 +9,8 @@ edition = "2021"
bitflags = "1.3"
spin = "0.9.4"
pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" }
aster-frame = { path = "../../../framework/aster-frame" }
align_ext = { path = "../../../framework/libs/align_ext" }
ostd = { path = "../../../ostd" }
align_ext = { path = "../../../ostd/libs/align_ext" }
aster-util = { path = "../../libs/aster-util" }
int-to-c-enum = { path = "../../libs/int-to-c-enum" }
component = { path = "../../libs/comp-sys/component" }

View File

@ -1,11 +1,11 @@
// SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use aster_frame::{
use int_to_c_enum::TryFromInt;
use ostd::{
mm::{Frame, Segment, VmReader, VmWriter},
sync::WaitQueue,
};
use int_to_c_enum::TryFromInt;
use super::{id::Sid, BlockDevice};
use crate::prelude::*;
@ -140,9 +140,9 @@ pub enum BioEnqueueError {
TooBig,
}
impl From<BioEnqueueError> for aster_frame::Error {
impl From<BioEnqueueError> for ostd::Error {
fn from(_error: BioEnqueueError) -> Self {
aster_frame::Error::NotEnoughResources
ostd::Error::NotEnoughResources
}
}

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::mm::{Frame, FrameAllocOptions, Segment, VmIo};
use ostd::mm::{Frame, FrameAllocOptions, Segment, VmIo};
use super::{
bio::{Bio, BioEnqueueError, BioSegment, BioStatus, BioType, BioWaiter, SubmittedBio},
@ -75,9 +75,9 @@ impl dyn BlockDevice {
impl VmIo for dyn BlockDevice {
/// Reads consecutive bytes of several sectors in size.
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> {
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> {
if offset % SECTOR_SIZE != 0 || buf.len() % SECTOR_SIZE != 0 {
return Err(aster_frame::Error::InvalidArgs);
return Err(ostd::Error::InvalidArgs);
}
if buf.is_empty() {
return Ok(());
@ -111,14 +111,14 @@ impl VmIo for dyn BlockDevice {
let _ = bio_segment.reader().read(&mut buf.into());
Ok(())
}
_ => Err(aster_frame::Error::IoError),
_ => Err(ostd::Error::IoError),
}
}
/// Writes consecutive bytes of several sectors in size.
fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> {
fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> {
if offset % SECTOR_SIZE != 0 || buf.len() % SECTOR_SIZE != 0 {
return Err(aster_frame::Error::InvalidArgs);
return Err(ostd::Error::InvalidArgs);
}
if buf.is_empty() {
return Ok(());
@ -150,16 +150,16 @@ impl VmIo for dyn BlockDevice {
let status = bio.submit_sync(self)?;
match status {
BioStatus::Complete => Ok(()),
_ => Err(aster_frame::Error::IoError),
_ => Err(ostd::Error::IoError),
}
}
}
impl dyn BlockDevice {
/// Asynchronously writes consecutive bytes of several sectors in size.
pub fn write_bytes_async(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<BioWaiter> {
pub fn write_bytes_async(&self, offset: usize, buf: &[u8]) -> ostd::Result<BioWaiter> {
if offset % SECTOR_SIZE != 0 || buf.len() % SECTOR_SIZE != 0 {
return Err(aster_frame::Error::InvalidArgs);
return Err(ostd::Error::InvalidArgs);
}
if buf.is_empty() {
return Ok(BioWaiter::new());

View File

@ -41,8 +41,8 @@ mod impl_block_device;
mod prelude;
pub mod request_queue;
use aster_frame::sync::SpinLock;
use component::{init_component, ComponentInitError};
use ostd::sync::SpinLock;
use spin::Once;
use self::{
@ -50,7 +50,7 @@ use self::{
prelude::*,
};
pub const BLOCK_SIZE: usize = aster_frame::mm::PAGE_SIZE;
pub const BLOCK_SIZE: usize = ostd::mm::PAGE_SIZE;
pub const SECTOR_SIZE: usize = 512;
pub trait BlockDevice: Send + Sync + Any + Debug {

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::sync::{Mutex, WaitQueue};
use ostd::sync::{Mutex, WaitQueue};
use super::{
bio::{BioEnqueueError, BioType, SubmittedBio},

View File

@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
bitflags = "1.3"
spin = "0.9.4"
aster-frame = { path = "../../../framework/aster-frame" }
ostd = { path = "../../../ostd" }
aster-util = { path = "../../libs/aster-util" }
component = { path = "../../libs/comp-sys/component" }
log = "0.4"

View File

@ -10,8 +10,8 @@ extern crate alloc;
use alloc::{collections::BTreeMap, fmt::Debug, string::String, sync::Arc, vec::Vec};
use core::any::Any;
use aster_frame::{mm::VmReader, sync::SpinLock};
use component::{init_component, ComponentInitError};
use ostd::{mm::VmReader, sync::SpinLock};
use spin::Once;
pub type ConsoleCallback = dyn Fn(VmReader) + Send + Sync;

View File

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aster-frame = { path = "../../../framework/aster-frame" }
ostd = { path = "../../../ostd" }
component = { path = "../../libs/comp-sys/component" }
log = "0.4"
spin = "0.9.4"

View File

@ -13,14 +13,14 @@ use core::{
ops::{Index, IndexMut},
};
use aster_frame::{
use component::{init_component, ComponentInitError};
use font8x8::UnicodeFonts;
use ostd::{
boot,
io_mem::IoMem,
mm::{VmIo, PAGE_SIZE},
sync::SpinLock,
};
use component::{init_component, ComponentInitError};
use font8x8::UnicodeFonts;
use spin::Once;
#[init_component]
@ -39,7 +39,7 @@ pub(crate) fn init() {
let mut writer = {
let framebuffer = boot::framebuffer_arg();
let mut size = 0;
for i in aster_frame::mm::FRAMEBUFFER_REGIONS.get().unwrap().iter() {
for i in ostd::mm::FRAMEBUFFER_REGIONS.get().unwrap().iter() {
size = i.len();
}

View File

@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
bitflags = "1.3"
spin = "0.9.4"
aster-frame = { path = "../../../framework/aster-frame" }
ostd = { path = "../../../ostd" }
aster-util = { path = "../../libs/aster-util" }
aster-rights = { path = "../../libs/aster-rights" }
component = { path = "../../libs/comp-sys/component" }

View File

@ -12,9 +12,9 @@ pub mod key;
use alloc::{collections::BTreeMap, string::String, sync::Arc, vec::Vec};
use core::{any::Any, fmt::Debug};
use aster_frame::sync::SpinLock;
use component::{init_component, ComponentInitError};
use key::{Key, KeyStatus};
use ostd::sync::SpinLock;
use spin::Once;
#[derive(Debug, Clone, Copy)]

View File

@ -6,16 +6,16 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
align_ext = { path = "../../../framework/libs/align_ext" }
aster-frame = { path = "../../../framework/aster-frame" }
align_ext = { path = "../../../ostd/libs/align_ext" }
aster-util = { path = "../../libs/aster-util" }
aster-rights = { path = "../../libs/aster-rights" }
bitflags = "1.3"
bitvec = { version = "1.0.1", default-features = false, features = ["alloc"]}
component = { path = "../../libs/comp-sys/component" }
int-to-c-enum = { path = "../../libs/int-to-c-enum" }
ktest = { path = "../../../framework/libs/ktest" }
ktest = { path = "../../../ostd/libs/ktest" }
log = "0.4"
ostd = { path = "../../../ostd" }
pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" }
ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] }
smoltcp = { version = "0.9.1", default-features = false, features = ["alloc", "log", "medium-ethernet", "medium-ip", "proto-dhcpv4", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw", "socket-dhcpv4"] }

View File

@ -3,7 +3,7 @@
use alloc::{collections::LinkedList, sync::Arc};
use align_ext::AlignExt;
use aster_frame::{
use ostd::{
mm::{
Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmReader, VmWriter, PAGE_SIZE,
},

View File

@ -8,14 +8,14 @@ use alloc::{
};
use core::ops::Range;
use aster_frame::{
use bitvec::{array::BitArray, prelude::Lsb0};
use ktest::ktest;
use ostd::{
mm::{
Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmReader, VmWriter, PAGE_SIZE,
},
sync::{RwLock, SpinLock},
};
use bitvec::{array::BitArray, prelude::Lsb0};
use ktest::ktest;
/// `DmaPool` is responsible for allocating small streaming DMA segments
/// (equal to or smaller than PAGE_SIZE),
@ -95,7 +95,7 @@ impl DmaPool {
}
/// Allocates a `DmaSegment` from the pool
pub fn alloc_segment(self: &Arc<Self>) -> Result<DmaSegment, aster_frame::Error> {
pub fn alloc_segment(self: &Arc<Self>) -> Result<DmaSegment, ostd::Error> {
// Lock order: pool.avail_pages -> pool.all_pages
// pool.avail_pages -> page.allocated_segments
let mut avail_pages = self.avail_pages.lock_irq_disabled();
@ -150,12 +150,12 @@ impl DmaPage {
direction: DmaDirection,
is_cache_coherent: bool,
pool: Weak<DmaPool>,
) -> Result<Self, aster_frame::Error> {
) -> Result<Self, ostd::Error> {
let dma_stream = {
let vm_segment = FrameAllocOptions::new(1).alloc_contiguous()?;
DmaStream::map(vm_segment, direction, is_cache_coherent)
.map_err(|_| aster_frame::Error::AccessDenied)?
.map_err(|_| ostd::Error::AccessDenied)?
};
Ok(Self {
@ -234,17 +234,17 @@ impl DmaSegment {
self.size
}
pub fn reader(&self) -> Result<VmReader<'_>, aster_frame::Error> {
pub fn reader(&self) -> Result<VmReader<'_>, ostd::Error> {
let offset = self.start_addr - self.dma_stream.daddr();
Ok(self.dma_stream.reader()?.skip(offset).limit(self.size))
}
pub fn writer(&self) -> Result<VmWriter<'_>, aster_frame::Error> {
pub fn writer(&self) -> Result<VmWriter<'_>, ostd::Error> {
let offset = self.start_addr - self.dma_stream.daddr();
Ok(self.dma_stream.writer()?.skip(offset).limit(self.size))
}
pub fn sync(&self, byte_range: Range<usize>) -> Result<(), aster_frame::Error> {
pub fn sync(&self, byte_range: Range<usize>) -> Result<(), ostd::Error> {
let offset = self.daddr() - self.dma_stream.daddr();
let range = byte_range.start + offset..byte_range.end + offset;
self.dma_stream.sync(range)

Some files were not shown because too many files have changed in this diff Show More