From af9e2a17d430efa1558afa49b6c1cce1f4dfdc0f Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Mon, 6 Jul 2026 14:02:10 +0800 Subject: [PATCH 1/8] Remove `ax-feat` crate and redistribute features across runtime, API, and user library layers --- Cargo.lock | 35 +- Cargo.toml | 1 - .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../ffplay/build-x86_64-unknown-none.toml | 2 +- .../gcc/build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../git/build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../qt-calc/build-x86_64-unknown-none.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../git/build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../top/build-riscv64gc-unknown-none-elf.toml | 4 +- apps/starry/wayland/README.md | 2 +- apps/starry/wayland/README_CN.md | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- ...ld-loongarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 4 +- .../wayland/build-x86_64-unknown-none.toml | 4 +- docs/docs/architecture/arceos.md | 8 +- docs/docs/architecture/driver/features.md | 2 +- docs/docs/architecture/driver/migration.md | 2 +- docs/docs/architecture/platform/contract.md | 2 +- docs/docs/build/arceos/build.md | 4 +- .../docs/components/crates/arceos-affinity.md | 4 +- docs/docs/components/crates/arceos-api.md | 18 +- .../docs/components/crates/arceos-priority.md | 6 +- docs/docs/components/crates/arceos-yield.md | 4 +- docs/docs/components/crates/ax-alloc.md | 2 +- docs/docs/components/crates/ax-api.md | 6 +- docs/docs/components/crates/ax-display.md | 4 +- docs/docs/components/crates/ax-dma.md | 4 +- docs/docs/components/crates/ax-feat.md | 142 --- docs/docs/components/crates/ax-fs-ng.md | 6 +- docs/docs/components/crates/ax-fs.md | 18 +- docs/docs/components/crates/ax-input.md | 4 +- docs/docs/components/crates/ax-ipi.md | 4 +- docs/docs/components/crates/ax-libc.md | 4 +- docs/docs/components/crates/ax-log.md | 2 +- docs/docs/components/crates/ax-net.md | 2 +- docs/docs/components/crates/ax-posix-api.md | 4 +- docs/docs/components/crates/ax-runtime.md | 4 +- docs/docs/components/crates/ax-sched.md | 2 +- docs/docs/components/crates/ax-std.md | 4 +- docs/docs/components/crates/ax-sync.md | 2 +- docs/docs/components/crates/ax-task.md | 10 +- docs/docs/components/crates/axbuild.md | 6 +- docs/docs/components/crates/rsext4.md | 18 +- docs/docs/components/crates/starry-kernel.md | 4 +- docs/docs/components/crates/starryos-test.md | 4 +- docs/docs/components/crates/starryos.md | 8 +- docs/docs/components/layers.md | 54 +- docs/docs/components/overview.md | 2 +- docs/docs/debug/check-mechanisms-summary.md | 8 +- docs/docs/debug/lock-usage-followups.md | 2 +- docs/docs/debug/might-sleep-followups.md | 2 +- docs/docs/debug/task-stack-guard-page.md | 10 +- docs/docs/development/arceos.md | 18 +- docs/docs/development/components.md | 8 +- docs/docs/development/starryos.md | 4 +- docs/docs/introduction/overview.md | 6 +- docs/spin-migration-tracking.md | 2 +- drivers/ax-driver/Cargo.toml | 2 +- drivers/ax-driver/src/net/mod.rs | 2 +- os/StarryOS/Makefile | 2 +- os/StarryOS/configs/board/qemu-riscv64.toml | 4 +- os/StarryOS/configs/board/visionfive2.toml | 2 +- os/StarryOS/docs/kmod-axbuild-migration.md | 2 +- os/StarryOS/kernel/Cargo.toml | 54 +- .../src/pseudofs/lockdep-tmpfs-analysis.md | 4 +- os/StarryOS/lkm/README.md | 6 +- os/StarryOS/lkm/hello/Cargo.toml | 10 +- os/StarryOS/lkm/kprobe_test/Cargo.toml | 10 +- os/StarryOS/starryos/Cargo.toml | 10 +- os/arceos/api/arceos_api/Cargo.toml | 24 +- os/arceos/api/arceos_api/src/lib.rs | 2 +- os/arceos/api/arceos_api/src/macros.rs | 6 +- os/arceos/api/arceos_posix_api/Cargo.toml | 15 +- os/arceos/api/axfeat/CHANGELOG.md | 106 --- os/arceos/api/axfeat/Cargo.toml | 122 --- os/arceos/api/axfeat/src/lib.rs | 30 - os/arceos/doc/build.md | 8 +- os/arceos/doc/figures/ArceOS.svg | 2 +- os/arceos/modules/axfs-ng/Cargo.toml | 2 - os/arceos/modules/axfs-ng/src/file/handle.rs | 13 +- .../axfs-ng/src/fs/ext4/rsext4/inode.rs | 8 +- .../modules/axfs-ng/src/fs/ext4/rsext4/mod.rs | 8 +- os/arceos/modules/axruntime/Cargo.toml | 38 +- os/arceos/modules/axruntime/src/lib.rs | 5 +- os/arceos/modules/axtask/Cargo.toml | 7 +- os/arceos/modules/axtask/README.md | 6 +- os/arceos/modules/axtask/src/api.rs | 4 +- os/arceos/modules/axtask/src/lib.rs | 9 +- os/arceos/modules/axtask/src/run_queue.rs | 1 - os/arceos/modules/axtask/src/task.rs | 30 +- os/arceos/modules/axtask/src/tests.rs | 2 +- os/arceos/scripts/make/build.mk | 6 +- os/arceos/scripts/make/cargo.mk | 2 +- os/arceos/scripts/make/features.mk | 22 +- os/arceos/ulib/axlibc/Cargo.toml | 24 +- os/arceos/ulib/axstd/Cargo.toml | 68 +- os/arceos/ulib/axstd/src/lib.rs | 11 +- os/axvisor/Cargo.toml | 2 +- os/axvisor/doc/shell.md | 2 +- p.md | 839 ++++++++++++++++++ scripts/axbuild/src/arceos/build/tests.rs | 14 +- scripts/axbuild/src/arceos/cbuild/features.rs | 39 +- scripts/axbuild/src/arceos/cbuild/tests.rs | 4 +- scripts/axbuild/src/arceos/test/mod.rs | 4 +- scripts/axbuild/src/arceos/test/rust_qemu.rs | 4 +- scripts/axbuild/src/axvisor/build/features.rs | 2 - scripts/axbuild/src/build/info.rs | 33 +- scripts/axbuild/src/build/platform.rs | 70 +- scripts/axbuild/src/build/std_build.rs | 2 +- scripts/axbuild/src/build/tests/info.rs | 1 - scripts/axbuild/src/build/tests/metadata.rs | 12 +- scripts/axbuild/src/build/tests/platform.rs | 2 +- scripts/axbuild/src/starry/build.rs | 6 +- scripts/axbuild/src/starry/rootfs.rs | 2 +- .../src/starry/test/tests/qemu_run_tests.rs | 2 +- scripts/axbuild/src/test/std.rs | 27 +- scripts/test/std_crates.csv | 1 - test-suit/arceos/rust/Cargo.toml | 6 +- test-suit/arceos/rust/src/lib.rs | 25 +- test-suit/arceos/rust/src/task/mod.rs | 2 +- test-suit/arceos/rust/src/task/priority.rs | 2 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- .../build-aarch64-unknown-none-softfloat.toml | 4 +- .../build-riscv64gc-unknown-none-elf.toml | 2 +- 190 files changed, 1455 insertions(+), 1101 deletions(-) delete mode 100644 docs/docs/components/crates/ax-feat.md delete mode 100644 os/arceos/api/axfeat/CHANGELOG.md delete mode 100644 os/arceos/api/axfeat/Cargo.toml delete mode 100644 os/arceos/api/axfeat/src/lib.rs create mode 100644 p.md diff --git a/Cargo.lock b/Cargo.lock index eadfae326b..3ae9f2ad4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -550,7 +550,6 @@ dependencies = [ "ax-display", "ax-dma", "ax-errno 0.6.1", - "ax-feat", "ax-fs-ng", "ax-hal", "ax-io", @@ -731,26 +730,6 @@ dependencies = [ "strum 0.27.2", ] -[[package]] -name = "ax-feat" -version = "0.5.24" -dependencies = [ - "ax-alloc", - "ax-display", - "ax-driver", - "ax-fs-ng", - "ax-hal", - "ax-input", - "ax-ipi", - "ax-kspin", - "ax-log", - "ax-net", - "ax-runtime", - "ax-sync", - "ax-task", - "axbacktrace", -] - [[package]] name = "ax-fs-ng" version = "0.7.0" @@ -858,10 +837,11 @@ version = "0.5.23" dependencies = [ "ax-driver", "ax-errno 0.6.1", - "ax-feat", "ax-hal", "ax-io", + "ax-kspin", "ax-posix-api", + "ax-runtime", "bindgen 0.72.1", ] @@ -1024,7 +1004,6 @@ version = "0.5.24" dependencies = [ "ax-alloc", "ax-errno 0.6.1", - "ax-feat", "ax-fs-ng", "ax-hal", "ax-io", @@ -1105,13 +1084,14 @@ dependencies = [ "ax-api", "ax-driver", "ax-errno 0.6.1", - "ax-feat", "ax-hal", "ax-io", "ax-kspin", "ax-lazyinit", "ax-posix-api", "ax-runtime", + "ax-task", + "axbacktrace", "libc", "lock_api", "spin", @@ -3777,8 +3757,8 @@ name = "hello" version = "0.5.12" dependencies = [ "ax-driver", - "ax-feat", "ax-hal", + "ax-runtime", "ax-std", "axplat-dyn", "kmod-tools", @@ -4599,9 +4579,9 @@ name = "kprobe_test" version = "0.5.12" dependencies = [ "ax-driver", - "ax-feat", "ax-hal", "ax-log", + "ax-runtime", "ax-std", "axplat-dyn", "kmod-tools", @@ -7639,7 +7619,6 @@ dependencies = [ "ax-dma", "ax-driver", "ax-errno 0.6.1", - "ax-feat", "ax-fs-ng", "ax-hal", "ax-input", @@ -7766,8 +7745,8 @@ version = "0.5.20" dependencies = [ "anyhow", "ax-driver", - "ax-feat", "ax-hal", + "ax-runtime", "ax-std", "axbuild", "axplat-dyn", diff --git a/Cargo.toml b/Cargo.toml index dc195add8d..08b0d32375 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -147,7 +147,6 @@ ax-dma = { version = "0.6.7", path = "os/arceos/modules/axdma" } ax-driver = { version = "0.10.0", path = "drivers/ax-driver" } virtio-drivers = { version = "0.13.0", default-features = false } ax-errno = { version = "0.6.1", path = "components/axerrno" } -ax-feat = { version = "0.5.24", path = "os/arceos/api/axfeat" } ax-fs-ng = { version = "0.7.0", path = "os/arceos/modules/axfs-ng" } ax-hal = { version = "0.5.23", path = "os/arceos/modules/axhal" } irq-framework = { version = "0.3.0", path = "components/irq-framework" } diff --git a/apps/starry/apache/build-riscv64gc-unknown-none-elf.toml b/apps/starry/apache/build-riscv64gc-unknown-none-elf.toml index abbd35a966..134ba1f2e9 100644 --- a/apps/starry/apache/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/apache/build-riscv64gc-unknown-none-elf.toml @@ -2,7 +2,7 @@ target = "riscv64gc-unknown-none-elf" env = { AX_IP = "10.0.2.15", AX_GW = "10.0.2.2" } log = "Warn" features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/rtc", "ax-driver/serial", "ax-driver/virtio-blk", diff --git a/apps/starry/diffutils/build-riscv64gc-unknown-none-elf.toml b/apps/starry/diffutils/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/diffutils/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/diffutils/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/ebpf/build-riscv64gc-unknown-none-elf.toml b/apps/starry/ebpf/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/ebpf/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/ebpf/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/ffplay/build-x86_64-unknown-none.toml b/apps/starry/ffplay/build-x86_64-unknown-none.toml index 6a37fb365f..a72d0f1540 100644 --- a/apps/starry/ffplay/build-x86_64-unknown-none.toml +++ b/apps/starry/ffplay/build-x86_64-unknown-none.toml @@ -2,7 +2,7 @@ target = "x86_64-unknown-none" env = { AX_IP = "10.0.2.15", AX_GW = "10.0.2.2" } log = "Warn" features = [ - "ax-feat/display", + "ax-runtime/display", "axplat-dyn/efi", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/gcc/build-riscv64gc-unknown-none-elf.toml b/apps/starry/gcc/build-riscv64gc-unknown-none-elf.toml index bc50e20fcb..ced9bad45b 100644 --- a/apps/starry/gcc/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/gcc/build-riscv64gc-unknown-none-elf.toml @@ -1,8 +1,8 @@ target = "riscv64gc-unknown-none-elf" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/gdb-smoke/build-riscv64gc-unknown-none-elf.toml b/apps/starry/gdb-smoke/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/gdb-smoke/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/gdb-smoke/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/git-ssh/build-riscv64gc-unknown-none-elf.toml b/apps/starry/git-ssh/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/git-ssh/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/git-ssh/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/git/build-riscv64gc-unknown-none-elf.toml b/apps/starry/git/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/git/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/git/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/go-lang/build-aarch64-unknown-none-softfloat.toml b/apps/starry/go-lang/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/go-lang/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/go-lang/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/go-lang/build-riscv64gc-unknown-none-elf.toml b/apps/starry/go-lang/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/go-lang/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/go-lang/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/hdl-lang/build-aarch64-unknown-none-softfloat.toml b/apps/starry/hdl-lang/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/hdl-lang/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/hdl-lang/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/hdl-lang/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/hdl-lang/build-loongarch64-unknown-none-softfloat.toml index 3eaedeb664..8255ad83f9 100644 --- a/apps/starry/hdl-lang/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/hdl-lang/build-loongarch64-unknown-none-softfloat.toml @@ -2,8 +2,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ "axplat-dyn/efi", - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/hdl-lang/build-riscv64gc-unknown-none-elf.toml b/apps/starry/hdl-lang/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/hdl-lang/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/hdl-lang/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/java-jse/build-aarch64-unknown-none-softfloat.toml b/apps/starry/java-jse/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/java-jse/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/java-jse/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/java-jse/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/java-jse/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/java-jse/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/java-jse/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/java-jse/build-riscv64gc-unknown-none-elf.toml b/apps/starry/java-jse/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/java-jse/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/java-jse/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/java-lang/build-aarch64-unknown-none-softfloat.toml b/apps/starry/java-lang/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/java-lang/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/java-lang/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/java-lang/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/java-lang/build-loongarch64-unknown-none-softfloat.toml index 3eaedeb664..8255ad83f9 100644 --- a/apps/starry/java-lang/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/java-lang/build-loongarch64-unknown-none-softfloat.toml @@ -2,8 +2,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ "axplat-dyn/efi", - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/java-lang/build-riscv64gc-unknown-none-elf.toml b/apps/starry/java-lang/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/java-lang/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/java-lang/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/java-web/build-aarch64-unknown-none-softfloat.toml b/apps/starry/java-web/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/java-web/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/java-web/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/java-web/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/java-web/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/java-web/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/java-web/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/java-web/build-riscv64gc-unknown-none-elf.toml b/apps/starry/java-web/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/java-web/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/java-web/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/llama-cpp/build-riscv64gc-unknown-none-elf.toml b/apps/starry/llama-cpp/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/llama-cpp/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/llama-cpp/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/mariadb/build-riscv64gc-unknown-none-elf.toml b/apps/starry/mariadb/build-riscv64gc-unknown-none-elf.toml index b29f512a4f..37acbc7184 100644 --- a/apps/starry/mariadb/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/mariadb/build-riscv64gc-unknown-none-elf.toml @@ -1,8 +1,8 @@ target = "riscv64gc-unknown-none-elf" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/nginx/build-riscv64gc-unknown-none-elf.toml b/apps/starry/nginx/build-riscv64gc-unknown-none-elf.toml index 261f418c20..2600918c20 100644 --- a/apps/starry/nginx/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/nginx/build-riscv64gc-unknown-none-elf.toml @@ -1,7 +1,7 @@ target = "riscv64gc-unknown-none-elf" log = "Warn" features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/node-lang/build-aarch64-unknown-none-softfloat.toml b/apps/starry/node-lang/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/node-lang/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/node-lang/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/node-lang/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/node-lang/build-loongarch64-unknown-none-softfloat.toml index 3eaedeb664..8255ad83f9 100644 --- a/apps/starry/node-lang/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/node-lang/build-loongarch64-unknown-none-softfloat.toml @@ -2,8 +2,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ "axplat-dyn/efi", - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/node-lang/build-riscv64gc-unknown-none-elf.toml b/apps/starry/node-lang/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/node-lang/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/node-lang/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/node-lib/build-aarch64-unknown-none-softfloat.toml b/apps/starry/node-lib/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/node-lib/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/node-lib/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/node-lib/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/node-lib/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/node-lib/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/node-lib/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/node-lib/build-riscv64gc-unknown-none-elf.toml b/apps/starry/node-lib/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/node-lib/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/node-lib/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/node-web/build-aarch64-unknown-none-softfloat.toml b/apps/starry/node-web/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/node-web/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/node-web/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/node-web/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/node-web/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/node-web/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/node-web/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/node-web/build-riscv64gc-unknown-none-elf.toml b/apps/starry/node-web/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/node-web/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/node-web/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/openrc/build-riscv64gc-unknown-none-elf.toml b/apps/starry/openrc/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/openrc/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/openrc/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/openssh/build-riscv64gc-unknown-none-elf.toml b/apps/starry/openssh/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/openssh/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/openssh/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/postgresql/build-aarch64-unknown-none-softfloat.toml b/apps/starry/postgresql/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/postgresql/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/postgresql/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/postgresql/build-riscv64gc-unknown-none-elf.toml b/apps/starry/postgresql/build-riscv64gc-unknown-none-elf.toml index 968389ef9a..358741352a 100644 --- a/apps/starry/postgresql/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/postgresql/build-riscv64gc-unknown-none-elf.toml @@ -1,5 +1,5 @@ features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/py-sci/build-aarch64-unknown-none-softfloat.toml b/apps/starry/py-sci/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/py-sci/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/py-sci/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/py-sci/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/py-sci/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/py-sci/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/py-sci/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/py-sci/build-riscv64gc-unknown-none-elf.toml b/apps/starry/py-sci/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/py-sci/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/py-sci/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/py-tui/build-aarch64-unknown-none-softfloat.toml b/apps/starry/py-tui/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/py-tui/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/py-tui/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/py-tui/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/py-tui/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/py-tui/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/py-tui/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/py-tui/build-riscv64gc-unknown-none-elf.toml b/apps/starry/py-tui/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/py-tui/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/py-tui/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/python-lang/build-aarch64-unknown-none-softfloat.toml b/apps/starry/python-lang/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/python-lang/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/python-lang/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/python-lang/build-riscv64gc-unknown-none-elf.toml b/apps/starry/python-lang/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/python-lang/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/python-lang/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/python-net/build-aarch64-unknown-none-softfloat.toml b/apps/starry/python-net/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/python-net/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/python-net/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/python-net/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/python-net/build-loongarch64-unknown-none-softfloat.toml index 1787fbb30e..b118a81f50 100644 --- a/apps/starry/python-net/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/python-net/build-loongarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "loongarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/python-net/build-riscv64gc-unknown-none-elf.toml b/apps/starry/python-net/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/python-net/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/python-net/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/qemu/build-aarch64-unknown-none-softfloat.toml b/apps/starry/qemu/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/qemu/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/qemu/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/qemu/build-riscv64gc-unknown-none-elf.toml b/apps/starry/qemu/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/qemu/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/qemu/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/qemu/memtrack-backtrace/build-aarch64-unknown-none-softfloat.toml b/apps/starry/qemu/memtrack-backtrace/build-aarch64-unknown-none-softfloat.toml index f6bd588bb6..bc197f458a 100644 --- a/apps/starry/qemu/memtrack-backtrace/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/qemu/memtrack-backtrace/build-aarch64-unknown-none-softfloat.toml @@ -1,7 +1,7 @@ env = { BACKTRACE = "y" } features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/qemu/memtrack-backtrace/build-riscv64gc-unknown-none-elf.toml b/apps/starry/qemu/memtrack-backtrace/build-riscv64gc-unknown-none-elf.toml index 968281ecd8..1a6fa64519 100644 --- a/apps/starry/qemu/memtrack-backtrace/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/qemu/memtrack-backtrace/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ env = { BACKTRACE = "y" } features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/qemu/nvme/build-riscv64gc-unknown-none-elf.toml b/apps/starry/qemu/nvme/build-riscv64gc-unknown-none-elf.toml index f0781cfd59..3fcb7028d9 100644 --- a/apps/starry/qemu/nvme/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/qemu/nvme/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/nvme", "ax-driver/virtio-gpu", diff --git a/apps/starry/qt-calc/build-x86_64-unknown-none.toml b/apps/starry/qt-calc/build-x86_64-unknown-none.toml index 363367cf22..12a8f20b02 100644 --- a/apps/starry/qt-calc/build-x86_64-unknown-none.toml +++ b/apps/starry/qt-calc/build-x86_64-unknown-none.toml @@ -2,8 +2,8 @@ target = "x86_64-unknown-none" env = {} log = "Warn" features = [ - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/rtc", + "ax-runtime/display", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-gpu", diff --git a/apps/starry/redis/build-riscv64gc-unknown-none-elf.toml b/apps/starry/redis/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/redis/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/redis/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/static-pie-test/build-riscv64gc-unknown-none-elf.toml b/apps/starry/static-pie-test/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/static-pie-test/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/static-pie-test/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/git-https/build-aarch64-unknown-none-softfloat.toml b/apps/starry/stress/git-https/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/stress/git-https/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/stress/git-https/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/stress/git-https/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/git-https/build-riscv64gc-unknown-none-elf.toml index 7f8820d785..69a8ff0bc4 100644 --- a/apps/starry/stress/git-https/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/git-https/build-riscv64gc-unknown-none-elf.toml @@ -1,5 +1,5 @@ features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/git-remote/build-aarch64-unknown-none-softfloat.toml b/apps/starry/stress/git-remote/build-aarch64-unknown-none-softfloat.toml index 6bb466c3a3..2877f55ba6 100644 --- a/apps/starry/stress/git-remote/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/stress/git-remote/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/git-remote/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/git-remote/build-riscv64gc-unknown-none-elf.toml index 22558d5741..52be63aa17 100644 --- a/apps/starry/stress/git-remote/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/git-remote/build-riscv64gc-unknown-none-elf.toml @@ -1,5 +1,5 @@ features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/rtc", "ax-driver/serial", "ax-driver/virtio-blk", diff --git a/apps/starry/stress/git-rename/build-aarch64-unknown-none-softfloat.toml b/apps/starry/stress/git-rename/build-aarch64-unknown-none-softfloat.toml index 17af0fa9fd..c6c491d228 100644 --- a/apps/starry/stress/git-rename/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/stress/git-rename/build-aarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "aarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/stress/git-rename/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/git-rename/build-riscv64gc-unknown-none-elf.toml index b29f512a4f..37acbc7184 100644 --- a/apps/starry/stress/git-rename/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/git-rename/build-riscv64gc-unknown-none-elf.toml @@ -1,8 +1,8 @@ target = "riscv64gc-unknown-none-elf" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/git/build-aarch64-unknown-none-softfloat.toml b/apps/starry/stress/git/build-aarch64-unknown-none-softfloat.toml index 17af0fa9fd..c6c491d228 100644 --- a/apps/starry/stress/git/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/stress/git/build-aarch64-unknown-none-softfloat.toml @@ -1,8 +1,8 @@ target = "aarch64-unknown-none-softfloat" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/stress/git/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/git/build-riscv64gc-unknown-none-elf.toml index b29f512a4f..37acbc7184 100644 --- a/apps/starry/stress/git/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/git/build-riscv64gc-unknown-none-elf.toml @@ -1,8 +1,8 @@ target = "riscv64gc-unknown-none-elf" log = "Warn" features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/sqlite3-deep/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/sqlite3-deep/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/stress/sqlite3-deep/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/sqlite3-deep/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/sqlite3-smoke/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/sqlite3-smoke/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/stress/sqlite3-smoke/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/sqlite3-smoke/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/stress/stress-ng-0/build-aarch64-unknown-none-softfloat.toml b/apps/starry/stress/stress-ng-0/build-aarch64-unknown-none-softfloat.toml index dd9dd08903..ced8f2e4a3 100644 --- a/apps/starry/stress/stress-ng-0/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/stress/stress-ng-0/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/virtio-blk", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/apps/starry/stress/stress-ng-0/build-riscv64gc-unknown-none-elf.toml b/apps/starry/stress/stress-ng-0/build-riscv64gc-unknown-none-elf.toml index 968389ef9a..358741352a 100644 --- a/apps/starry/stress/stress-ng-0/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/stress/stress-ng-0/build-riscv64gc-unknown-none-elf.toml @@ -1,5 +1,5 @@ features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/top/build-riscv64gc-unknown-none-elf.toml b/apps/starry/top/build-riscv64gc-unknown-none-elf.toml index 61c1214bfa..75531a504f 100644 --- a/apps/starry/top/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/top/build-riscv64gc-unknown-none-elf.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/apps/starry/wayland/README.md b/apps/starry/wayland/README.md index e75b2eb7a2..76ada0eaf3 100644 --- a/apps/starry/wayland/README.md +++ b/apps/starry/wayland/README.md @@ -307,7 +307,7 @@ This app requires: - `memfd_create` and file-descriptor passing over Unix sockets for Wayland SHM. - `eventfd` for the compositor event loop. - udev seed data under `/run/udev/data/` for libinput device discovery. -- `starry-kernel/input` and `ax-feat/display` in the app build config. +- `starry-kernel/input` and `ax-runtime/display` in the app build config. The optional manual package-install flow additionally needs a kernel/QEMU launch with working guest networking if the packages are not already present in the diff --git a/apps/starry/wayland/README_CN.md b/apps/starry/wayland/README_CN.md index e3c90c0c9e..64bb56d7fc 100644 --- a/apps/starry/wayland/README_CN.md +++ b/apps/starry/wayland/README_CN.md @@ -288,7 +288,7 @@ Cocoa 抢占终端焦点。 - Wayland SHM 所需的 `memfd_create` 和 Unix socket fd 传递。 - 合成器事件循环使用的 `eventfd`。 - libinput 设备发现所需的 `/run/udev/data/` udev seed。 -- app build config 中启用 `starry-kernel/input` 和 `ax-feat/display`。 +- app build config 中启用 `starry-kernel/input` 和 `ax-runtime/display`。 如果复制出的 rootfs 中还没有这些用户态包,可选的手动安装包流程还需要启用了可用 客体网络的内核/QEMU 启动方式。 diff --git a/apps/starry/wayland/build-aarch64-unknown-none-softfloat.toml b/apps/starry/wayland/build-aarch64-unknown-none-softfloat.toml index 1f634f4a75..d293cf0d92 100644 --- a/apps/starry/wayland/build-aarch64-unknown-none-softfloat.toml +++ b/apps/starry/wayland/build-aarch64-unknown-none-softfloat.toml @@ -2,8 +2,8 @@ target = "aarch64-unknown-none-softfloat" env = {} log = "Warn" features = [ - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/rtc", + "ax-runtime/display", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-gpu", diff --git a/apps/starry/wayland/build-loongarch64-unknown-none-softfloat.toml b/apps/starry/wayland/build-loongarch64-unknown-none-softfloat.toml index 5291d6adbd..71d9d58be2 100644 --- a/apps/starry/wayland/build-loongarch64-unknown-none-softfloat.toml +++ b/apps/starry/wayland/build-loongarch64-unknown-none-softfloat.toml @@ -3,8 +3,8 @@ env = {} log = "Warn" features = [ "axplat-dyn/efi", - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/rtc", + "ax-runtime/display", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-gpu", diff --git a/apps/starry/wayland/build-riscv64gc-unknown-none-elf.toml b/apps/starry/wayland/build-riscv64gc-unknown-none-elf.toml index f4064f4798..4912eff7b7 100644 --- a/apps/starry/wayland/build-riscv64gc-unknown-none-elf.toml +++ b/apps/starry/wayland/build-riscv64gc-unknown-none-elf.toml @@ -2,8 +2,8 @@ target = "riscv64gc-unknown-none-elf" env = {} log = "Warn" features = [ - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/rtc", + "ax-runtime/display", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-gpu", diff --git a/apps/starry/wayland/build-x86_64-unknown-none.toml b/apps/starry/wayland/build-x86_64-unknown-none.toml index 3f32cdb4fb..3d45f3ee32 100644 --- a/apps/starry/wayland/build-x86_64-unknown-none.toml +++ b/apps/starry/wayland/build-x86_64-unknown-none.toml @@ -2,8 +2,8 @@ target = "x86_64-unknown-none" env = {} log = "Warn" features = [ - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/rtc", + "ax-runtime/display", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-gpu", diff --git a/docs/docs/architecture/arceos.md b/docs/docs/architecture/arceos.md index d619bee50a..03ea65191d 100644 --- a/docs/docs/architecture/arceos.md +++ b/docs/docs/architecture/arceos.md @@ -31,7 +31,7 @@ flowchart LR platformLayer["PlatformLayer: axplat-* + platforms/*"] requiredModules["RequiredModules: ax-runtime ax-hal ax-log"] optionalModules["OptionalModules: ax-alloc ax-mm ax-task ax-sync ax-driver ax-fs ax-net ..."] - publicApi["PublicApi: ax-feat ax-api ax-posix-api"] + publicApi["PublicApi: ax-runtime ax-api ax-posix-api"] userLib["UserLib: ax-std ax-libc"] appsAndTests["AppsAndTests: apps/arceos/* + test-suit/arceos/*"] upperSystems["UpperSystems: StarryOS Axvisor"] @@ -126,12 +126,12 @@ ArceOS 的设计围绕三个核心机制展开:Feature 驱动的编译期装 ### Feature 驱动的系统装配 -ArceOS 的装配逻辑分布在应用依赖、`ax-std/ax-feat` feature 以及 `ax-runtime` 的 feature 依赖图中。 +ArceOS 的装配逻辑分布在应用依赖、`ax-std/ax-runtime` feature 以及 `ax-runtime` 的 feature 依赖图中。 ```mermaid flowchart TD appRequest["AppRequest: 应用 Cargo.toml 申请 feature"] - axstdAxfeat["ax-std or ax-feat: 暴露统一 feature 开关"] + axstdAxfeat["ax-std or ax-runtime: 暴露统一 feature 开关"] runtimeGate["ax-runtime: 根据 feature 选择模块"] memPath["MemoryPath: alloc paging -> ax-alloc ax-mm"] taskPath["TaskPath: multitask smp -> ax-task ax-sync"] @@ -201,7 +201,7 @@ sequenceDiagram ### 任务与调度模型 -`ax-task` 是 ArceOS 并发模型的核心。`multitask` 打开前后,模块会走完全不同的实现路径;调度算法由 `sched-fifo`、`sched-rr`、`sched-cfs` 等 feature 选择。 +`ax-task` 是 ArceOS 并发模型的核心。`multitask` 打开前后,模块会走完全不同的实现路径;调度算法由 `multitask`、`rr`、`cfs` 等 feature 选择。 ```mermaid stateDiagram-v2 diff --git a/docs/docs/architecture/driver/features.md b/docs/docs/architecture/driver/features.md index 240b8ee807..5432312902 100644 --- a/docs/docs/architecture/driver/features.md +++ b/docs/docs/architecture/driver/features.md @@ -61,7 +61,7 @@ VirtIO feature 组合能力边界和 PCI transport: | `fxmac` | `fxmac_rs` | | `intel-net` | `eth-intel` | | `realtek-rtl8125` | `realtek-rtl8125` | -| `aic8800-wifi` | `aic8800` + `sdhci-cv1800` + `sdio-host` | +| `aic8800` | `aic8800` + `sdhci-cv1800` + `sdio-host` | | `rknpu` | `rockchip-npu` | | `rga` | `rockchip-rga` | | `jpeg` | `rockchip-jpeg` | diff --git a/docs/docs/architecture/driver/migration.md b/docs/docs/architecture/driver/migration.md index 6540716f8a..9f38406cd2 100644 --- a/docs/docs/architecture/driver/migration.md +++ b/docs/docs/architecture/driver/migration.md @@ -46,7 +46,7 @@ sidebar_label: "迁移与验收" ### Phase 7: feature 映射切换 -- `ax-feat` 中旧 `ax-driver/virtio-*`、`driver-*`、`bus-*` 映射到 rdrive probe feature。 +- `ax-runtime` 中旧 `ax-driver/virtio-*`、`driver-*`、`bus-*` 映射到 rdrive probe feature。 - legacy `ax-driver` feature 只保留给未迁移代码,不作为新宿主路径入口。 ## 验收标准 diff --git a/docs/docs/architecture/platform/contract.md b/docs/docs/architecture/platform/contract.md index b1f15a39df..7047092194 100644 --- a/docs/docs/architecture/platform/contract.md +++ b/docs/docs/architecture/platform/contract.md @@ -197,7 +197,7 @@ AX_PLATFORM_CRATE=axplat_myplat cargo check -p ax-hal --features axplat-myplat | 使用层 | 示例 feature | | --- | --- | | 直接 HAL | `ax-hal/axplat-myplat` | -| ArceOS feature 聚合 | `ax-feat/axplat-myplat` | +| ArceOS feature 聚合 | `ax-runtime/axplat-myplat` | | Rust std 应用 | `ax-std/axplat-myplat` | | C / libc 应用 | `ax-libc/axplat-myplat` | diff --git a/docs/docs/build/arceos/build.md b/docs/docs/build/arceos/build.md index 45057831cd..27acf27c63 100644 --- a/docs/docs/build/arceos/build.md +++ b/docs/docs/build/arceos/build.md @@ -40,10 +40,10 @@ ArceOS 的 Build Info 位于 `tmp/axbuild/config//build-.toml` `BuildInfo::resolve_features()` 执行 ArceOS 特有的 feature 处理: -- **前缀族检测**:通过分析包的 Cargo.toml 依赖确定使用 `ax-std/` 还是 `ax-feat/` 前缀 +- **前缀族检测**:通过分析包的 Cargo.toml 依赖确定使用 `ax-std/` 还是 `ax-runtime/` 前缀 - **旧平台项过滤**:移除 `plat-dyn`、`defplat`、`myplat` 等旧平台选择 feature;动态平台由当前构建路径固定提供 - **SMP feature 注入**:`max_cpu_num > 1` 时注入 `{prefix}/smp` -- **遗留别名归一化**:`axstd` → `ax-std`、`axfeat` → `ax-feat` +- **遗留别名归一化**:`axstd` → `ax-std`、`feature` → `ax-runtime` ### 6-7. Cargo 配置组装与执行 diff --git a/docs/docs/components/crates/arceos-affinity.md b/docs/docs/components/crates/arceos-affinity.md index deb01c163e..f849614e66 100644 --- a/docs/docs/components/crates/arceos-affinity.md +++ b/docs/docs/components/crates/arceos-affinity.md @@ -42,8 +42,8 @@ flowchart LR ### 1.3 feature 与调度器关系 `Cargo.toml` 中的: -- `sched-rr` -- `sched-cfs` +- `rr` +- `cfs` 会透传到 `ax-std` 对应的调度器 feature。这个 crate 本身并不强依赖某一种调度算法,但它确实依赖: diff --git a/docs/docs/components/crates/arceos-api.md b/docs/docs/components/crates/arceos-api.md index c51aef38a1..d8bbaf624d 100644 --- a/docs/docs/components/crates/arceos-api.md +++ b/docs/docs/components/crates/arceos-api.md @@ -14,7 +14,7 @@ - 它不是运行时本体,不负责初始化系统,也不直接实现调度、内存、网络或文件系统算法。 - 它是一层 **薄门面**:对外给出稳定、按域划分的 `ax_*` API,对内把实现集中到 `imp/`。 -- 它与 `ax-feat` 配合,通过 feature 控制哪些 API 域进入最终镜像。 +- 它与 `ax-runtime` 配合,通过 feature 控制哪些 API 域进入最终镜像。 - 它既是 `ax-std` 的重要下层依赖,也是 ArceOS 模块能力暴露给更上层时最推荐的接入边界。 因此,理解 `ax-api` 的关键不在复杂数据结构,而在“API 定义如何生成”“API 可见性如何由 feature 控制”“API 最终映射到哪些模块”。 @@ -43,13 +43,13 @@ - `lib.rs` 决定对外暴露什么。 - `imp/*` 决定每个 API 实际调用哪个底层模块。 -### 1.4 `dummy-if-not-enabled` 的特殊语义 +### 1.4 `stubs` 的特殊语义 这是 `ax-api` 非常重要的一个 feature: - 正常情况下,未打开某能力 feature 时,对应 API 根本不会被编译进 crate。 -- 如果同时打开 `dummy-if-not-enabled`,则未启用能力的 API 也会生成,但函数体会走 `unimplemented!()`,类型则可能退化为空占位 struct。 +- 如果同时打开 `stubs`,则未启用能力的 API 也会生成,但函数体会走 `unimplemented!()`,类型则可能退化为空占位 struct。 -这意味着 `dummy-if-not-enabled` 不是“开启某种退化实现”,而是“强行保留符号表形状,运行时再失败”。文档和调用方都必须清楚这一点,否则很容易把“编译通过”误判成“功能可用”。 +这意味着 `stubs` 不是“开启某种退化实现”,而是“强行保留符号表形状,运行时再失败”。文档和调用方都必须清楚这一点,否则很容易把“编译通过”误判成“功能可用”。 ### 1.5 关键公开类型与句柄 - `AxError` / `AxResult`:统一错误类型与返回值约定。 @@ -124,7 +124,7 @@ graph LR ``` ### 直接依赖 -- 核心基础:`ax-errno`、`ax-feat`、`ax-hal`、`axio`、`ax-log`、`ax-runtime`、`ax-sync`。 +- 核心基础:`ax-errno`、`ax-runtime`、`ax-hal`、`axio`、`ax-log`、`ax-runtime`、`ax-sync`。 - 可选能力:`ax-alloc`、`ax-dma`、`ax-task`、`ax-fs`、`ax-net`、`ax-display`、`ax-driver`、`ax-ipi`、`ax-mm`。 ### 主要消费者 @@ -147,7 +147,7 @@ ax-api = { workspace = true, features = ["alloc", "multitask", "fs", "net"] } 1. 上层应优先使用 `ax-api` 暴露的稳定接口,不要一开始就直接依赖多个 `ax*` 内核模块。 2. 新增 API 时,先在 `lib.rs` 中定义门面,再把具体实现落到 `imp/`,不要反过来让 `imp` 直接成为公开边界。 3. 若某能力必须受 feature 控制,应同时更新 `Cargo.toml`、`lib.rs` 中的宏调用,以及 `imp/` 子模块实现。 -4. `dummy-if-not-enabled` 仅适用于需要保留符号形状的场景,不能把它当成真正的降级实现。 +4. `stubs` 仅适用于需要保留符号形状的场景,不能把它当成真正的降级实现。 ### 4.3 关键开发建议 - 把 `modules` 视为最后兜底手段,而不是常规入口。 @@ -160,13 +160,13 @@ ax-api = { workspace = true, features = ["alloc", "multitask", "fs", "net"] } ### 单元测试 - `define_api!` / `define_api_type!` 在不同 feature 组合下的符号生成行为。 -- `dummy-if-not-enabled` 路径是否按预期生成占位函数/类型。 +- `stubs` 路径是否按预期生成占位函数/类型。 - 任务、DMA、文件系统和网络句柄等薄包装是否保持稳定语义。 ### 集成测试 - 通过 `ax-std` 或最小 ArceOS 应用验证时间、I/O、任务、文件系统、网络等门面 API 的实际可用性。 - 覆盖不同 feature 组合下的编译与运行路径,尤其是 `multitask`、`fs`、`net`、`dma`。 -- 对 `dummy-if-not-enabled`,至少要验证调用方不会误把占位 API 当成可运行实现。 +- 对 `stubs`,至少要验证调用方不会误把占位 API 当成可运行实现。 ### 覆盖率 - 对 `ax-api`,比运行时覆盖率更重要的是“门面完整性覆盖率”。 @@ -175,7 +175,7 @@ ax-api = { workspace = true, features = ["alloc", "multitask", "fs", "net"] } ## 跨项目定位 ### ArceOS -`ax-api` 是 ArceOS 官方的公共 API 门面层。它与 `ax-feat` 协作,把一组离散的底层模块整理成稳定接口,是 `ax-std` 等上层库最重要的下层边界之一。 +`ax-api` 是 ArceOS 官方的公共 API 门面层。它与 `ax-runtime` 协作,把一组离散的底层模块整理成稳定接口,是 `ax-std` 等上层库最重要的下层边界之一。 ### StarryOS StarryOS 内核本体通常直接依赖更底层模块,而不是依赖 `ax-api`。因此在 StarryOS 中,它更像“可选的统一上层库接口层”,而不是内核核心依赖。 diff --git a/docs/docs/components/crates/arceos-priority.md b/docs/docs/components/crates/arceos-priority.md index 43182ee9c1..45be1e2573 100644 --- a/docs/docs/components/crates/arceos-priority.md +++ b/docs/docs/components/crates/arceos-priority.md @@ -38,7 +38,7 @@ flowchart LR ### 1.3 为什么顺序断言被限定得很窄 源码只在下面这个条件下做完成顺序断言: -- `cfg!(feature = "sched-cfs")` +- `cfg!(feature = "cfs")` - `available_parallelism() == 1` 这非常重要。它说明当前作者并没有声称“所有环境下优先级都会表现成固定顺序”,而只是说: @@ -85,7 +85,7 @@ graph LR ### 直接依赖 - `ax-std(alloc, multitask)`:需要堆对象、线程和 `join`。 -- `sched-rr` / `sched-cfs`:通过 feature 透传到底层调度器。 +- `rr` / `cfs`:通过 feature 透传到底层调度器。 ### 间接依赖 - `ax_api::task::ax_set_current_priority` @@ -117,7 +117,7 @@ cargo arceos test qemu --target riscv64gc-unknown-none-elf 如果你要真正验证“高优先级更早完成”的行为,建议额外准备: 1. 单核 QEMU 配置 -2. 显式打开 `sched-cfs` +2. 显式打开 `cfs` 3. 保持当前工作负载规模稳定 否则默认 4 核配置下,顺序本来就不应被写死。 diff --git a/docs/docs/components/crates/arceos-yield.md b/docs/docs/components/crates/arceos-yield.md index fc0dbc5a03..32afe677f6 100644 --- a/docs/docs/components/crates/arceos-yield.md +++ b/docs/docs/components/crates/arceos-yield.md @@ -37,8 +37,8 @@ flowchart LR ### 1.3 feature 条件为什么重要 源码里有两个很关键的条件: -- `#[cfg(all(not(feature = "sched-rr"), not(feature = "sched-cfs")))]` -- `if cfg!(not(feature = "sched-cfs")) && available_parallelism() == 1` +- `#[cfg(all(not(feature = "rr"), not(feature = "cfs")))]` +- `if cfg!(not(feature = "cfs")) && available_parallelism() == 1` 这意味着: diff --git a/docs/docs/components/crates/ax-alloc.md b/docs/docs/components/crates/ax-alloc.md index ae3796d641..2b1baed89e 100644 --- a/docs/docs/components/crates/ax-alloc.md +++ b/docs/docs/components/crates/ax-alloc.md @@ -124,7 +124,7 @@ ax-alloc = { workspace = true } 1. 修改 `global_init()` 或扩堆逻辑时,要同时检查默认路径与 `hv` 路径是否保持语义一致。 2. 修改 `UsageKind` 或统计规则时,要避免默认两级分配里的双重记账。 3. 若调整 `GlobalPage`,必须坚持它只是“分配到的连续页块”所有权对象,不能把映射、cache 属性或 IOMMU 语义塞进来。 -4. 若新增 feature,需要同步检查 `ax-feat` 与 `ax-runtime` 的 feature 传播是否正确。 +4. 若新增 feature,需要同步检查 `ax-runtime` 与 `ax-runtime` 的 feature 传播是否正确。 ### 4.3 开发建议 - “算法选择”优先放在 `ax-allocator` 层,`ax-alloc` 更适合做全局装配。 diff --git a/docs/docs/components/crates/ax-api.md b/docs/docs/components/crates/ax-api.md index 12c1a7d779..ab64c99fbc 100644 --- a/docs/docs/components/crates/ax-api.md +++ b/docs/docs/components/crates/ax-api.md @@ -12,7 +12,7 @@ - 目录角色:ArceOS 公共 API/feature 聚合层 - crate 形态:库 crate - 工作区位置:子工作区 `os/arceos` -- feature 视角:主要通过 `alloc`、`display`、`dma`、`dummy-if-not-enabled`、`fs`、`ipi`、`irq`、`multitask`、`net`、`paging` 控制编译期能力装配。 +- feature 视角:主要通过 `alloc`、`display`、`dma`、`stubs`、`fs`、`ipi`、`irq`、`multitask`、`net`、`paging` 控制编译期能力装配。 - 关键数据结构:可直接观察到的关键数据结构/对象包括 `AxTimeValue`、`DMAInfo`、`AxTaskHandle`、`AxWaitQueueHandle`。 ### 模块结构 @@ -37,7 +37,7 @@ graph LR current --> ax_dma["ax-dma"] current --> ax-driver["ax-driver"] current --> ax_errno["ax-errno"] - current --> ax-feat["ax-feat"] + current --> ax-runtime["ax-runtime"] current --> ax-fs["ax-fs"] ax_std["ax-std"] --> current ``` @@ -48,7 +48,7 @@ graph LR - `ax-dma` - `ax-driver` - `ax-errno` -- `ax-feat` +- `ax-runtime` - `ax-fs` - `ax-hal` - `axio` diff --git a/docs/docs/components/crates/ax-display.md b/docs/docs/components/crates/ax-display.md index 21c8806b7e..ba051a5486 100644 --- a/docs/docs/components/crates/ax-display.md +++ b/docs/docs/components/crates/ax-display.md @@ -35,7 +35,7 @@ graph LR current --> ax-sync["ax-sync"] current --> ax_lazyinit["ax-lazyinit"] ax_api["ax-api"] --> current - ax_feat["ax-feat"] --> current + arceos_feature["ax-runtime"] --> current ax_runtime["ax-runtime"] --> current starry_kernel["starry-kernel"] --> current ``` @@ -58,7 +58,7 @@ graph LR ### 3.3 被依赖情况 - `ax-api` -- `ax-feat` +- `ax-runtime` - `ax-runtime` - `starry-kernel` diff --git a/docs/docs/components/crates/ax-dma.md b/docs/docs/components/crates/ax-dma.md index a875ebfb93..ddbcfe2353 100644 --- a/docs/docs/components/crates/ax-dma.md +++ b/docs/docs/components/crates/ax-dma.md @@ -105,11 +105,11 @@ 这说明 `ax-dma` 不只是驱动内部工具,也被设计成可向更高层 API 暴露的系统能力。 -### 2.3 与 `ax-runtime` / `ax-feat` 的关系 +### 2.3 与 `ax-runtime` / `ax-runtime` 的关系 需要区分两个概念: - `ax-runtime` 的 `dma` feature 只是 `["paging"]`,它并不直接依赖 `ax-dma` crate。 -- `ax-feat` 的 `dma` feature 表示整机要具备 DMA 所需的内存和分页能力。 +- `ax-runtime` 的 `dma` feature 表示整机要具备 DMA 所需的内存和分页能力。 也就是说,`ax-dma` 更像一个“可被 API 或驱动选用的具体实现模块”,而不是 runtime 自动初始化出来的独立子系统。 diff --git a/docs/docs/components/crates/ax-feat.md b/docs/docs/components/crates/ax-feat.md deleted file mode 100644 index 3b9a34bd25..0000000000 --- a/docs/docs/components/crates/ax-feat.md +++ /dev/null @@ -1,142 +0,0 @@ -# `ax-feat` - -> 路径:`os/arceos/api/axfeat` -> 类型:库 crate -> 分层:ArceOS 层 / ArceOS 公共 API/feature 聚合层 -> 版本:`0.5.0` -> 文档依据:当前仓库源码、`Cargo.toml` 与 未检测到 crate 层 README - -`ax-feat` 的核心定位是:Top-level feature selection for ArceOS - -## 架构设计 -- 目录角色:ArceOS 公共 API/feature 聚合层 -- crate 形态:库 crate -- 工作区位置:子工作区 `os/arceos` -- feature 视角:主要通过 `alloc`、`alloc-buddy`、`alloc-level-1`、`alloc-slab`、`alloc-tlsf`、`bus-mmio`、`bus-pci`、`display`、`dma` 等能力 feature 控制编译期能力装配;平台实现固定由 `axplat-dyn` 运行时发现。 -- 关键数据结构:该 crate 暴露的数据结构较少,关键复杂度主要体现在模块协作、trait 约束或初始化时序。 - -### 模块结构 -- 当前 crate 未显式声明多个顶层 `mod`,复杂度更可能集中在单文件入口、宏展开或下层子 crate。 - -### 核心机制 -- 该 crate 以 Cargo feature 编排和能力选择为主,核心价值在编译期装配而非运行时复杂算法。 - -## 核心功能 -- 功能定位:Top-level feature selection for ArceOS -- 对外接口:该 crate 的公开符号较少,更多承担内部桥接、配置注入或编排职责。 -- 典型使用场景:主要作为仓库中的专用支撑 crate 被上层组件调用。 -- 关键调用链示例:该 crate 没有单一固定的初始化链,通常由上层调用者按 feature/trait 组合接入。 - -## 依赖关系 -```mermaid -graph LR - current["ax-feat"] - current --> ax-alloc["ax-alloc"] - current --> axbacktrace["axbacktrace"] - current --> ax-display["ax-display"] - current --> ax-driver["ax-driver"] - current --> ax-fs["ax-fs"] - current --> axfs_ng["ax-fs-ng"] - current --> ax-hal["ax-hal"] - ax_api["ax-api"] --> current - ax_libc["ax-libc"] --> current - ax_posix_api["ax-posix-api"] --> current - ax_std["ax-std"] --> current - starry_kernel["starry-kernel"] --> current - starryos["starryos"] --> current - starryos_test["starryos-test"] --> current -``` - -### 直接依赖 -- `ax-alloc` -- `axbacktrace` -- `ax-display` -- `ax-driver` -- `ax-fs` -- `ax-fs-ng` -- `ax-hal` -- `ax-input` -- `ax-ipi` -- `ax-log` -- `ax-net` -- 另外还有 `4` 个同类项未在此展开 - -### 间接依赖 -- `ax-arm-pl031` -- `axaddrspace` -- `ax-allocator` -- `ax-cpu` -- `ax-dma` -- `rdrive` -- `rdif-block` -- `rdif-display` -- `rdif-input` -- 另外还有 `48` 个同类项未在此展开 - -### 3.3 被依赖情况 -- `ax-api` -- `ax-libc` -- `ax-posix-api` -- `ax-std` -- `starry-kernel` -- `starryos` -- `starryos-test` - -### 被依赖情况 -- `arceos-affinity` -- `arceos-display` -- `arceos-exception` -- `arceos-fs-shell` -- `arceos-irq` -- `arceos-memtest` -- `arceos-net-echoserver` -- `arceos-net-httpclient` -- `arceos-net-httpserver` -- `arceos-net-udpserver` -- `arceos-parallel` -- `arceos-priority` -- 另外还有 `10` 个同类项未在此展开 - -### 外部依赖 -- 当前依赖集合几乎完全来自仓库内本地 crate。 - -## 开发指南 -### 接入方式 -```toml -[dependencies] -ax-feat = { workspace = true } - -# 如果在仓库外独立验证,也可以显式绑定本地路径: -# ax-feat = { path = "os/arceos/api/axfeat" } -``` - -### 初始化 -1. 在 `Cargo.toml` 中接入该 crate,并根据需要开启相关 feature。 -2. 若 crate 暴露初始化入口,优先调用 `init`/`new`/`build`/`start` 类函数建立上下文。 -3. 在最小消费者路径上验证公开 API、错误分支与资源回收行为。 - -### API 使用 -- 该 crate 更偏编排、配置或内部 glue 逻辑,关键使用点通常体现在 feature、命令或入口函数上。 - -## 测试 -### 测试覆盖 -- 当前 crate 目录中未发现显式 `tests/`/`benches/`/`fuzz/` 入口,更可能依赖上层系统集成测试或跨 crate 回归。 - -### 单元测试 -- 建议覆盖公开 API、状态转换和异常分支。 - -### 集成测试 -- 建议补充最小消费者路径,验证该 crate 在真实调用链中可用。 - -### 覆盖率 -- 覆盖率建议:公开 API、边界条件和关键错误处理路径需要显式覆盖。 - -## 跨项目定位 -### ArceOS -`ax-feat` 直接位于 `os/arceos/` 目录树中,是 ArceOS 工程本体的一部分,承担 ArceOS 公共 API/feature 聚合层。 - -### StarryOS -`ax-feat` 不在 StarryOS 目录内部,但被 `starry-kernel`、`starryos`、`starryos-test` 等 StarryOS crate 直接依赖,说明它是该系统的共享构件或底层服务。 - -### Axvisor -`ax-feat` 主要通过 `axvisor` 等上层 crate 被 Axvisor 间接复用,通常处于更底层的公共依赖层。 diff --git a/docs/docs/components/crates/ax-fs-ng.md b/docs/docs/components/crates/ax-fs-ng.md index 85c94c4bc7..739a2cb1b5 100644 --- a/docs/docs/components/crates/ax-fs-ng.md +++ b/docs/docs/components/crates/ax-fs-ng.md @@ -40,7 +40,7 @@ graph LR current --> axio["ax-io"] current --> axpoll["axpoll"] current --> ax-sync["ax-sync"] - ax_feat["ax-feat"] --> current + arceos_feature["ax-runtime"] --> current ax_net["ax-net"] --> current ax_runtime["ax-runtime"] --> current starry_kernel["starry-kernel"] --> current @@ -70,7 +70,7 @@ graph LR - 另外还有 `37` 个同类项未在此展开 ### 3.3 被依赖情况 -- `ax-feat` +- `ax-runtime` - `ax-net` - `ax-runtime` - `starry-kernel` @@ -100,7 +100,7 @@ graph LR - `lwext4_rust` - `slab` - `spin` -- `starry-fatfs` +- `starry-fat` ## 开发指南 ### 接入方式 diff --git a/docs/docs/components/crates/ax-fs.md b/docs/docs/components/crates/ax-fs.md index d1ec4f570b..ad432af8ae 100644 --- a/docs/docs/components/crates/ax-fs.md +++ b/docs/docs/components/crates/ax-fs.md @@ -4,7 +4,7 @@ > 类型:库 crate > 分层:ArceOS 层 / ArceOS 内核模块 > 版本:`0.3.0-preview.3` -> 文档依据:`Cargo.toml`、`src/lib.rs`、`src/root.rs`、`src/partition.rs`、`src/dev.rs`、`src/fops.rs`、`src/fs/fatfs.rs`、`src/fs/ext4fs.rs`、`src/mounts.rs`、`os/arceos/modules/axruntime/src/lib.rs`、`os/arceos/api/ax-api/src/imp/fs.rs`、`os/arceos/api/arceos_posix_api/src/imp/fs.rs` +> 文档依据:`Cargo.toml`、`src/lib.rs`、`src/root.rs`、`src/partition.rs`、`src/dev.rs`、`src/fops.rs`、`src/fs/fat.rs`、`src/fs/ext4.rs`、`src/mounts.rs`、`os/arceos/modules/axruntime/src/lib.rs`、`os/arceos/api/ax-api/src/imp/fs.rs`、`os/arceos/api/arceos_posix_api/src/imp/fs.rs` `ax-fs` 是当前仓库中“旧文件系统栈”的系统装配器。它本身并不是一个具体文件系统实现,而是把块设备访问、分区扫描、FAT/ext4 适配、`ramfs`/`devfs` 以及根目录挂载树组合在一起,再向 ArceOS 运行时、`ax-api` 和 `ax-posix-api` 暴露一套统一的文件接口。 @@ -23,8 +23,8 @@ - `src/dev.rs`:把 `AxBlockDevice` 包装成带游标的 `Disk`,再切出 `Partition` 视图。整个旧栈默认以 512B block 为基本访问粒度。 - `src/partition.rs`:解析 GPT 分区表,检测 FAT/ext4 魔数,提取 `UUID`/`PARTUUID`,并根据检测结果创建具体文件系统实例。 - `src/root.rs`:定义 `RootDirectory`、挂载点表、全局当前目录,以及 `lookup`/`create`/`remove`/`rename` 等根级路径路由逻辑。 -- `src/fs/fatfs.rs`:把 `axfatfs` 适配为 `ax_fs_vfs::VfsOps`/`VfsNodeOps`。 -- `src/fs/ext4fs.rs`:把 `rsext4` 适配为 `ax_fs_vfs::VfsOps`/`VfsNodeOps`。 +- `src/fs/fat.rs`:把 `axfat` 适配为 `ax_fs_vfs::VfsOps`/`VfsNodeOps`。 +- `src/fs/ext4.rs`:把 `rsext4` 适配为 `ax_fs_vfs::VfsOps`/`VfsNodeOps`。 - `src/fs/mod.rs`:暴露旧栈下的具体文件系统实现,并直接复用 `axfs_devfs`、`axfs_ramfs`。 - `src/mounts.rs`:创建基于 `ramfs` 的 `/proc`、`/sys` 伪目录树。 - `src/fops.rs`:定义 `File`、`Directory`、`OpenOptions`,并在打开后绑定读写执行能力。 @@ -55,7 +55,7 @@ flowchart TD 4. `/proc` 与 `/sys` 不是独立的动态内核文件系统,而是启动时填充好的 `ramfs` 树。 ### 1.4 与相邻 crate 的边界 -- `ax-fs` 是聚合层,不是叶子文件系统。真正的叶子实现是 `axfs_ramfs`、`axfs_devfs`、`axfatfs` 适配层以及 `rsext4` 适配层。 +- `ax-fs` 是聚合层,不是叶子文件系统。真正的叶子实现是 `axfs_ramfs`、`axfs_devfs`、`axfat` 适配层以及 `rsext4` 适配层。 - `ax-fs` 自己维护挂载点表和根目录拼接逻辑;`axfs_vfs` 并不提供挂载图管理能力。 - `ax-fs` 的当前工作目录是 `ROOT_DIR`/`CURRENT_DIR` 这组全局静态对象,而不是任务局部对象。这一点与 `ax-fs-ng` 的 `FS_CONTEXT` 有本质差异。 - `root.rs` 顶部已经明确写出 TODO:当挂载点存在包含关系时,这套路由逻辑并不“工作得很好”。因此它更适合简单的根目录拼装,而不是复杂命名空间系统。 @@ -76,7 +76,7 @@ flowchart TD `fops::File`/`Directory` 打开时会根据 `OpenOptions` 生成 `Cap`,并与 `VfsNodeAttr::perm()` 进行比对。也就是说,旧栈里的权限控制更接近“打开时绑定能力”,而不是完整的 Unix `uid/gid/mode` 模型。 #### ext4/FAT 接入方式 -- FAT 路径通过 `PartitionWrapper` 把分区包装成 `axfatfs` 所需的 `Read`/`Write`/`Seek` 设备,再适配到 `VfsNodeOps`。 +- FAT 路径通过 `PartitionWrapper` 把分区包装成 `axfat` 所需的 `Read`/`Write`/`Seek` 设备,再适配到 `VfsNodeOps`。 - ext4 路径通过 `Jbd2Dev` 挂载 `rsext4`,由 `Ext4FileSystem{,Partition}` 包装成旧 `VfsOps`。 #### 伪文件系统内容 @@ -103,7 +103,7 @@ graph LR axfs_vfs["ax-fs-vfs"] --> current axfs_ramfs["ax-fs-ramfs"] --> current axfs_devfs["ax-fs-devfs"] --> current - axfatfs["axfatfs"] --> current + axfat["axfat"] --> current rsext4["rsext4"] --> current current --> ax-runtime["ax-runtime(fs)"] current --> ax-api["ax-api"] @@ -114,7 +114,7 @@ graph LR - `ax-driver`:提供块设备来源。 - `axfs_vfs`:旧栈统一 trait 契约。 - `axfs_ramfs`、`axfs_devfs`:旧栈中的内存文件系统与设备文件系统。 -- `axfatfs`、`rsext4`:分别承担 FAT 与 ext4 的实际格式实现。 +- `axfat`、`rsext4`:分别承担 FAT 与 ext4 的实际格式实现。 ### 主要消费者 - `ax-runtime`:在 `fs` feature 下初始化整个旧文件系统子系统。 @@ -133,12 +133,12 @@ graph LR ax-fs = { workspace = true } ``` -对大多数 ArceOS 使用者来说,更常见的接入点其实是 `ax-feat`、`ax-runtime`、`ax-api` 或 `ax-posix-api`,而不是直接把 `ax-fs` 当独立库调用。 +对大多数 ArceOS 使用者来说,更常见的接入点其实是 `ax-runtime`、`ax-runtime`、`ax-api` 或 `ax-posix-api`,而不是直接把 `ax-fs` 当独立库调用。 ### 4.2 改动约束 1. 任何对 `init_filesystems()`、`parse_root_spec()`、`find_root_partition()` 的修改,都应被视为启动路径变更。 2. 任何对 `RootDirectory` 路由逻辑的修改,都必须同时验证 `lookup`、`read_dir`、`remove_dir` 与 `rename` 的挂载边界行为。 -3. 任何对 `ext4fs.rs`/`fatfs.rs` 的修改,都要同步考虑旧 `axfs_vfs` trait 语义,而不是只看底层库自身接口。 +3. 任何对 `ext4.rs`/`fat.rs` 的修改,都要同步考虑旧 `axfs_vfs` trait 语义,而不是只看底层库自身接口。 4. 如果要增加新的伪文件系统节点,请明确它是“静态兼容性文件”还是“真正会动态更新的接口”,不要混淆两者。 ### 4.3 扩展建议 diff --git a/docs/docs/components/crates/ax-input.md b/docs/docs/components/crates/ax-input.md index 81e0f1d524..ee99f3986a 100644 --- a/docs/docs/components/crates/ax-input.md +++ b/docs/docs/components/crates/ax-input.md @@ -34,7 +34,7 @@ graph LR current --> ax-driver["ax-driver"] current --> ax-sync["ax-sync"] current --> ax_lazyinit["ax-lazyinit"] - ax_feat["ax-feat"] --> current + arceos_feature["ax-runtime"] --> current ax_runtime["ax-runtime"] --> current starry_kernel["starry-kernel"] --> current ``` @@ -56,7 +56,7 @@ graph LR - 另外还有 `41` 个同类项未在此展开 ### 3.3 被依赖情况 -- `ax-feat` +- `ax-runtime` - `ax-runtime` - `starry-kernel` diff --git a/docs/docs/components/crates/ax-ipi.md b/docs/docs/components/crates/ax-ipi.md index 49ddbf0964..105de72dde 100644 --- a/docs/docs/components/crates/ax-ipi.md +++ b/docs/docs/components/crates/ax-ipi.md @@ -66,7 +66,7 @@ flowchart TD ### 使用场景 - `init()`:由 `ax-runtime/src/mp.rs` 在次核 bring-up 路径中调用,为当前 CPU 建立 IPI 队列。 - `ipi_handler()`:由 `ax-runtime/src/lib.rs` 的 IRQ 处理路径调用。 -- `run_on_cpu()` / `run_on_each_cpu()`:是这个 crate 的核心公开 API,也是 `ax-api` / `ax-feat` 暴露 IPI 能力的底层基础。 +- `run_on_cpu()` / `run_on_each_cpu()`:是这个 crate 的核心公开 API,也是 `ax-api` / `ax-runtime` 暴露 IPI 能力的底层基础。 ### 边界说明 - 它不是 SMP 启动器;启动 CPU 的逻辑在 `ax_runtime::start_secondary_cpus()`。 @@ -78,7 +78,7 @@ flowchart TD graph LR ax-hal["ax-hal (ipi)"] --> ax-ipi["ax-ipi"] - `ax-runtime`:负责在启动链中初始化队列,并在 IRQ 处理里调用 `ipi_handler()`。 -- `ax-api` / `ax-feat`:把 IPI 能力向上层 feature 与 API 暴露。 +- `ax-api` / `ax-runtime`:把 IPI 能力向上层 feature 与 API 暴露。 ## 开发指南 ### 接入方式 diff --git a/docs/docs/components/crates/ax-libc.md b/docs/docs/components/crates/ax-libc.md index 640f6750a6..a943d042a1 100644 --- a/docs/docs/components/crates/ax-libc.md +++ b/docs/docs/components/crates/ax-libc.md @@ -40,14 +40,14 @@ graph LR current["ax-libc"] current --> ax-posix-api["ax-posix-api"] current --> ax_errno["ax-errno"] - current --> ax-feat["ax-feat"] + current --> ax-runtime["ax-runtime"] current --> axio["ax-io"] ``` ### 直接依赖 - `ax-posix-api` - `ax-errno` -- `ax-feat` +- `ax-runtime` - `axio` ### 间接依赖 diff --git a/docs/docs/components/crates/ax-log.md b/docs/docs/components/crates/ax-log.md index 68bd1d2ded..c0bb4feb47 100644 --- a/docs/docs/components/crates/ax-log.md +++ b/docs/docs/components/crates/ax-log.md @@ -85,7 +85,7 @@ graph LR ax-log --> ax-runtime["ax-runtime"] ax-log --> ax-api["ax-api"] ax-log --> arceos_posix["ax-posix-api"] - ax-log --> ax-feat["ax-feat"] + ax-log --> ax-runtime["ax-runtime"] ax-log --> starry_kernel["starry-kernel"] ``` diff --git a/docs/docs/components/crates/ax-net.md b/docs/docs/components/crates/ax-net.md index 3cfe1de473..94fccecaae 100644 --- a/docs/docs/components/crates/ax-net.md +++ b/docs/docs/components/crates/ax-net.md @@ -77,7 +77,7 @@ socket 入口: 主要消费者: - `ax-runtime`:网络和 vsock 初始化。 -- `ax-feat`:`net` / `vsock` feature 装配。 +- `ax-runtime`:`net` / `vsock` feature 装配。 - `ax-api`、`ax-posix-api`:ArceOS 网络 API 和 POSIX socket 路径。 - `ax-std`、`ax-libc`:通过上层 API 间接消费网络能力。 - `starry-kernel`:Linux syscall socket 底层实现。 diff --git a/docs/docs/components/crates/ax-posix-api.md b/docs/docs/components/crates/ax-posix-api.md index a033367091..863738e5ac 100644 --- a/docs/docs/components/crates/ax-posix-api.md +++ b/docs/docs/components/crates/ax-posix-api.md @@ -35,7 +35,7 @@ graph LR current["ax-posix-api"] current --> ax-alloc["ax-alloc"] current --> ax_errno["ax-errno"] - current --> ax-feat["ax-feat"] + current --> ax-runtime["ax-runtime"] current --> ax-fs["ax-fs"] current --> ax-hal["ax-hal"] current --> axio["ax-io"] @@ -46,7 +46,7 @@ graph LR ### 直接依赖 - `ax-alloc` - `ax-errno` -- `ax-feat` +- `ax-runtime` - `ax-fs` - `ax-hal` - `axio` diff --git a/docs/docs/components/crates/ax-runtime.md b/docs/docs/components/crates/ax-runtime.md index d28966ff26..ee7c79a9ad 100644 --- a/docs/docs/components/crates/ax-runtime.md +++ b/docs/docs/components/crates/ax-runtime.md @@ -41,7 +41,7 @@ graph LR current --> axfs_ng["ax-fs-ng"] current --> ax-hal["ax-hal"] ax_api["ax-api"] --> current - ax_feat["ax-feat"] --> current + arceos_feature["ax-runtime"] --> current ax_posix_api["ax-posix-api"] --> current starry_kernel["starry-kernel"] --> current ``` @@ -74,7 +74,7 @@ graph LR ### 3.3 被依赖情况 - `ax-api` -- `ax-feat` +- `ax-runtime` - `ax-posix-api` - `starry-kernel` diff --git a/docs/docs/components/crates/ax-sched.md b/docs/docs/components/crates/ax-sched.md index e57e84847a..bd9352132d 100644 --- a/docs/docs/components/crates/ax-sched.md +++ b/docs/docs/components/crates/ax-sched.md @@ -109,7 +109,7 @@ ax-sched = { workspace = true } - CFS 的 vruntime 排序与 `nice` 映射。 ### 集成测试 -- 在 `ax-task` 中分别打开 `sched-fifo`、`sched-rr`、`sched-cfs`,验证系统级调度行为不回归。 +- 在 `ax-task` 中分别打开 `multitask`、`rr`、`cfs`,验证系统级调度行为不回归。 - 检查 `set_priority()` 在上层 API 中的外显行为是否与所选调度器一致。 ### 覆盖率 diff --git a/docs/docs/components/crates/ax-std.md b/docs/docs/components/crates/ax-std.md index 5e794c6798..5eb17d43aa 100644 --- a/docs/docs/components/crates/ax-std.md +++ b/docs/docs/components/crates/ax-std.md @@ -41,7 +41,7 @@ graph LR current["ax-std"] current --> ax-api["ax-api"] current --> ax_errno["ax-errno"] - current --> ax-feat["ax-feat"] + current --> ax-runtime["ax-runtime"] current --> axio["ax-io"] current --> ax_kspin["ax-kspin"] current --> ax_lazyinit["ax-lazyinit"] @@ -58,7 +58,7 @@ graph LR ### 直接依赖 - `ax-api` - `ax-errno` -- `ax-feat` +- `ax-runtime` - `axio` - `ax-kspin` - `ax-lazyinit` diff --git a/docs/docs/components/crates/ax-sync.md b/docs/docs/components/crates/ax-sync.md index 36b5203919..fe911b1acd 100644 --- a/docs/docs/components/crates/ax-sync.md +++ b/docs/docs/components/crates/ax-sync.md @@ -179,7 +179,7 @@ ax-sync = { workspace = true, features = ["multitask"] } ## 跨项目定位 ### ArceOS -`ax-sync` 是 ArceOS 内核模块共享的统一同步层。它通过 `multitask` feature 与 `ax-task`、`ax-runtime`、`ax-feat` 联动,确保“调度器语义”和“锁语义”一起切换。 +`ax-sync` 是 ArceOS 内核模块共享的统一同步层。它通过 `multitask` feature 与 `ax-task`、`ax-runtime`、`ax-runtime` 联动,确保“调度器语义”和“锁语义”一起切换。 ### StarryOS StarryOS 大量复用 `ax-sync::Mutex` 作为内核内部同步原语之一。因此在 StarryOS 中,`ax-sync` 扮演的是“兼容内核与 ArceOS 模块共享的基础锁层”。 diff --git a/docs/docs/components/crates/ax-task.md b/docs/docs/components/crates/ax-task.md index e661f52d6a..789504c320 100644 --- a/docs/docs/components/crates/ax-task.md +++ b/docs/docs/components/crates/ax-task.md @@ -13,7 +13,7 @@ `ax-task` 的设计目标不是提供“单一线程库”,而是构造一个可裁剪的内核任务运行时: - 通过 `multitask` feature 在“真正多任务调度器”和“单任务桩实现”之间切换。 -- 通过 `sched-fifo`、`sched-rr`、`sched-cfs` 在同一套 API 下选择不同调度策略。 +- 通过 `multitask`、`rr`、`cfs` 在同一套 API 下选择不同调度策略。 - 通过 `irq`、`preempt`、`smp`、`tls`、`task-ext` 决定任务系统究竟具备多少内核能力。 因此,`ax-task` 是一个强 feature 驱动的状态机模块,而不是简单的 API 封装。 @@ -44,9 +44,9 @@ ### 1.4 调度器抽象与算法实现 `ax-task` 并不自己实现完整调度算法,而是通过 `api.rs` 中的类型别名把 `TaskInner` 适配到 `axsched`: -- `sched-fifo`:`FifoScheduler` + `FifoTask`,协作式调度。 -- `sched-rr`:`RRScheduler` + `RRTask`,带时间片,依赖 `preempt`。 -- `sched-cfs`:`CFScheduler` + `CFSTask`,公平调度,同样依赖 `preempt`。 +- `multitask`:`FifoScheduler` + `FifoTask`,协作式调度。 +- `rr`:`RRScheduler` + `RRTask`,带时间片,依赖 `preempt`。 +- `cfs`:`CFScheduler` + `CFSTask`,公平调度,同样依赖 `preempt`。 这层设计的关键好处是: @@ -146,7 +146,7 @@ ax-task = { workspace = true } 常见 feature 组合: - `multitask`:启用完整任务管理。 -- `sched-fifo` / `sched-rr` / `sched-cfs`:选择调度器。 +- `multitask` / `rr` / `cfs`:选择调度器。 - `preempt`:允许基于 timer tick 的抢占。 - `irq`:启用 sleep/timeout 等基于中断的时间能力。 - `smp`:启用多核运行队列与任务迁移。 diff --git a/docs/docs/components/crates/axbuild.md b/docs/docs/components/crates/axbuild.md index c4993a8644..be91ae4de8 100644 --- a/docs/docs/components/crates/axbuild.md +++ b/docs/docs/components/crates/axbuild.md @@ -25,7 +25,7 @@ flowchart TD A["ArceosConfig / Override"] --> B["resolve_effective_smp + resolve_platform"] B --> C["准备动态平台 target / linker 参数"] - C --> D["FeatureResolver 计算 ax_features / lib_features"] + C --> D["FeatureResolver 计算 arceos_features / lib_features"] D --> E["ostool::build_cargo_spec"] E --> F["ostool 执行 cargo build / qemu"] ``` @@ -43,10 +43,10 @@ flowchart TD `axbuild` 并不是简单把用户输入的 feature 原样透传给 Cargo,而是做了分层解析: - 旧别名和已移除的平台选择项会先被归一化或过滤。 -- 普通能力 feature,例如 `fs`、`net`、`multitask`,会根据应用实际依赖选择 `ax-std/`、`ax-feat/` 或 `ax-libc/` 前缀。 +- 普通能力 feature,例如 `fs`、`net`、`multitask`,会根据应用实际依赖选择 `ax-std/`、`ax-runtime/` 或 `ax-libc/` 前缀。 - `max_cpu_num > 1` 时才注入对应前缀的 `smp`。 -`detect_ax_feature_prefix_family()` 甚至会通过 `cargo metadata` 检查应用是否直接依赖 `ax-std` 或 `ax-feat`。这一步体现了 `axbuild` 对真实调用关系的感知,而不是纯字符串拼接。 +`detect_std_feature_prefix_family()` 甚至会通过 `cargo metadata` 检查应用是否直接依赖 `ax-std` 或 `ax-runtime`。这一步体现了 `axbuild` 对真实调用关系的感知,而不是纯字符串拼接。 ### 1.4 宿主环境与目标环境的边界 `src/arceos/ostool.rs` 显式构造了目标构建所需的宿主环境变量: diff --git a/docs/docs/components/crates/rsext4.md b/docs/docs/components/crates/rsext4.md index 5552a6557c..d8d0eb334c 100644 --- a/docs/docs/components/crates/rsext4.md +++ b/docs/docs/components/crates/rsext4.md @@ -4,7 +4,7 @@ > 类型:库 + 演示二进制 crate > 分层:组件层 / 可复用基础组件 > 版本:`0.1.0` -> 文档依据:`Cargo.toml`、`README.md`、`src/lib.rs`、`src/ext4_backend/ext4.rs`、`src/ext4_backend/api.rs`、`src/ext4_backend/blockdev.rs`、`src/ext4_backend/jbd2/jbd2.rs`、`src/ext4_backend/datablock_cache.rs`、`src/ext4_backend/inodetable_cache.rs`、`src/ext4_backend/bitmap_cache.rs`、`src/testfs/test_example.rs`、`src/main.rs`、`os/arceos/modules/axfs/src/fs/ext4fs.rs` +> 文档依据:`Cargo.toml`、`README.md`、`src/lib.rs`、`src/ext4_backend/ext4.rs`、`src/ext4_backend/api.rs`、`src/ext4_backend/blockdev.rs`、`src/ext4_backend/jbd2/jbd2.rs`、`src/ext4_backend/datablock_cache.rs`、`src/ext4_backend/inodetable_cache.rs`、`src/ext4_backend/bitmap_cache.rs`、`src/testfs/test_example.rs`、`src/main.rs`、`os/arceos/modules/axfs/src/fs/ext4.rs` `rsext4` 是当前仓库里的独立 ext4 引擎。它自己定义块设备接口、挂载与卸载流程、目录/文件 API、JBD2 日志代理、多级缓存和若干 host 侧验证程序;在这棵代码树里,它主要作为旧 `ax-fs` 的 ext4 叶子后端被消费,而不是作为系统的 VFS 层或名字空间层存在。 @@ -14,7 +14,7 @@ - 它直接面向 ext4 语义和块设备,而不是面向统一 VFS trait。 - 它对外导出的接口既有高层 API(`mount`、`open`、`read_at`、`mkdir` 等),也有大量后端内部模块,属于“引擎 + 宽导出 API”的风格。 -- 在当前仓库里,旧 `ax_fs::fs::ext4fs` 通过适配层把它包装成 `ax_fs_vfs::VfsOps`;新 `ax-fs-ng` 的 ext4 路径则改用了 `lwext4_rust`,不再依赖它。 +- 在当前仓库里,旧 `ax_fs::fs::ext4` 通过适配层把它包装成 `ax_fs_vfs::VfsOps`;新 `ax-fs-ng` 的 ext4 路径则改用了 `lwext4_rust`,不再依赖它。 ### 模块结构 - `src/ext4_backend/blockdev.rs`:定义 `BlockDevice` trait、`BlockDev` 缓冲封装以及 `Jbd2Dev`。 @@ -36,12 +36,12 @@ flowchart TD D --> E["bitmap/inode/data caches"] D --> F["dir.rs / file.rs 操作"] F --> G["api.rs 高层封装"] - G --> H["旧 ax_fs::fs::ext4fs 适配层"] + G --> H["旧 ax_fs::fs::ext4 适配层"] ``` ### 1.4 关键机制 #### 固定 4 KiB ext4 block -`config.rs` 把 ext4 block size 固定为 `4096`,而 `BlockDevice::block_size()` 默认值是 `512`。因此像旧 `ax_fs::fs::ext4fs` 这种外层适配器必须负责把 512B block 设备转换成 `rsext4` 眼中的 4 KiB block 设备。 +`config.rs` 把 ext4 block size 固定为 `4096`,而 `BlockDevice::block_size()` 默认值是 `512`。因此像旧 `ax_fs::fs::ext4` 这种外层适配器必须负责把 512B block 设备转换成 `rsext4` 眼中的 4 KiB block 设备。 #### 多级缓存 默认 feature `USE_MULTILEVEL_CACHE` 开启时: @@ -114,7 +114,7 @@ graph LR lazy_static["lazy_static(spin_no_std)"] --> current log["log"] --> current - current --> axfs_ext4["ax_fs::fs::ext4fs 适配层"] + current --> axfs_ext4["ax_fs::fs::ext4 适配层"] current --> host_demo["src/main.rs / testfs host 回归"] ``` @@ -124,12 +124,12 @@ graph LR - `log`:调试与事务日志输出。 ### 主要消费者 -- 旧 `ax_fs::fs::ext4fs`:当前仓库里的主要生产消费者。 +- 旧 `ax_fs::fs::ext4`:当前仓库里的主要生产消费者。 - `src/main.rs`:host 侧文件镜像驱动的演示与回归程序。 ### 3.3 与相邻 crate 的关系 - `rsext4` 只解决 ext4,不解决统一文件系统接口。 -- `ax_fs::fs::ext4fs` 负责把它翻译成旧 `axfs_vfs` 所需的节点语义。 +- `ax_fs::fs::ext4` 负责把它翻译成旧 `axfs_vfs` 所需的节点语义。 - 新 `ax-fs-ng` ext4 路径已转向 `lwext4_rust`。 ## 开发指南 @@ -167,7 +167,7 @@ rsext4 = { workspace = true } - JBD2 descriptor / commit / replay 的结构与顺序。 ### 集成测试 -- 旧 `ax_fs::fs::ext4fs` 适配层与 `rsext4` 的联调。 +- 旧 `ax_fs::fs::ext4` 适配层与 `rsext4` 的联调。 - 512B 底层块设备经过 4 KiB block 适配后的读写正确性。 - journal 打开后的断电回放。 @@ -179,7 +179,7 @@ rsext4 = { workspace = true } ## 跨项目定位 ### ArceOS -在 ArceOS 旧文件系统栈里,`rsext4` 是 ext4 叶子格式引擎。它通过 `ax_fs::fs::ext4fs` 间接进入系统,而不是直接成为统一文件 API。 +在 ArceOS 旧文件系统栈里,`rsext4` 是 ext4 叶子格式引擎。它通过 `ax_fs::fs::ext4` 间接进入系统,而不是直接成为统一文件 API。 ### StarryOS 当前仓库里的 StarryOS 主线已经转向 `ax-fs-ng` + `lwext4_rust` 组合,没有直接依赖 `rsext4`。因此它对 StarryOS 更像历史并行路线,而不是当前主干依赖。 diff --git a/docs/docs/components/crates/starry-kernel.md b/docs/docs/components/crates/starry-kernel.md index 3897ba8491..b47027b4e1 100644 --- a/docs/docs/components/crates/starry-kernel.md +++ b/docs/docs/components/crates/starry-kernel.md @@ -115,7 +115,7 @@ starry_kernel::syscall::handle_syscall(&mut uctx); ## 依赖关系 ```mermaid graph LR - ax-feat["ax-feat"] --> starry["starry-kernel"] + ax-runtime["ax-runtime"] --> starry["starry-kernel"] ax-hal["ax-hal"] --> starry ax-task["ax-task"] --> starry ax-mm["ax-mm"] --> starry @@ -130,7 +130,7 @@ graph LR ``` ### 直接依赖 -- `ax-feat`:把 `uspace`、`multitask`、`sched-rr`、`fs-ng-ext4`、`net` 等能力一次性装配到内核。 +- `ax-runtime`:把 `uspace`、`multitask`、`rr`、`fs-ng-ext4`、`net` 等能力一次性装配到内核。 - `ax-hal`:用户态上下文、页表、trap、时间与控制台基础能力。 - `ax-task`:底层线程调度、`TaskExt` 和阻塞/唤醒机制。 - `ax-fs-ng`、`axfs-ng-vfs`:文件系统与路径解析。 diff --git a/docs/docs/components/crates/starryos-test.md b/docs/docs/components/crates/starryos-test.md index 9194b5fe17..0e62cfc220 100644 --- a/docs/docs/components/crates/starryos-test.md +++ b/docs/docs/components/crates/starryos-test.md @@ -103,12 +103,12 @@ cargo xtask starry run --arch riscv64 --package starryos-test ## 依赖关系 ```mermaid graph LR - ax-feat["ax-feat"] --> test["starryos-test"] + ax-runtime["ax-runtime"] --> test["starryos-test"] kernel["starry-kernel"] --> test ``` ### 直接依赖 -- `ax-feat`:提供底层平台、驱动和运行时装配。 +- `ax-runtime`:提供底层平台、驱动和运行时装配。 - `starry-kernel`:真正执行系统 bring-up。 ### 3.2 关键外部驱动者 diff --git a/docs/docs/components/crates/starryos.md b/docs/docs/components/crates/starryos.md index 119210103c..8bbcd417be 100644 --- a/docs/docs/components/crates/starryos.md +++ b/docs/docs/components/crates/starryos.md @@ -6,7 +6,7 @@ > 版本:`0.2.0-preview.2` > 文档依据:`Cargo.toml`、`src/main.rs`、`src/init.sh`、`.qemu.toml`、`os/StarryOS/README.md`、`os/StarryOS/kernel/src/entry.rs`、`xtask/src/starry/{build.rs,run.rs}` -`starryos` 是 StarryOS 的默认启动镜像包。它不实现 syscall、进程管理或虚拟内存,而是负责把 `ax-feat` 能力组合、运行配置、`starry-kernel` 和默认 init 命令线装配成一个可启动、可进入交互 shell 的系统镜像。 +`starryos` 是 StarryOS 的默认启动镜像包。它不实现 syscall、进程管理或虚拟内存,而是负责把 `ax-runtime` 能力组合、运行配置、`starry-kernel` 和默认 init 命令线装配成一个可启动、可进入交互 shell 的系统镜像。 换句话说,`starryos` 负责的是“把内核打包成一个能启动的 StarryOS 镜像”,而不是“内核本体”。真正的系统核心仍在 `starry-kernel`。 @@ -100,12 +100,12 @@ cargo xtask starry run --arch riscv64 --package starryos ## 依赖关系 ```mermaid graph LR - ax-feat["ax-feat"] --> starryos["starryos"] + ax-runtime["ax-runtime"] --> starryos["starryos"] kernel["starry-kernel"] --> starryos ``` ### 直接依赖 -- `ax-feat`:把底层 ArceOS 运行时和驱动能力 feature 接到镜像入口包上。 +- `ax-runtime`:把底层 ArceOS 运行时和驱动能力 feature 接到镜像入口包上。 - `starry-kernel`:真正的内核实现,`starryos` 只在 `main()` 里调用其入口。 ### 3.2 关键运行时外部条件 @@ -153,7 +153,7 @@ cargo xtask starry run --arch riscv64 --package starryos ## 跨项目定位 ### ArceOS -`starryos` 建立在 ArceOS 的 `ax-feat`/平台/运行时能力之上,但不是 ArceOS 本体的一部分。它消费的是 ArceOS 的底座能力。 +`starryos` 建立在 ArceOS 的 `ax-runtime`/平台/运行时能力之上,但不是 ArceOS 本体的一部分。它消费的是 ArceOS 的底座能力。 ### StarryOS 这是 StarryOS 的默认启动镜像入口。用户平时执行 `cargo xtask starry run --package starryos`,真正启动的就是这个包。 diff --git a/docs/docs/components/layers.md b/docs/docs/components/layers.md index d7dfd1acb0..c6bed2bc27 100644 --- a/docs/docs/components/layers.md +++ b/docs/docs/components/layers.md @@ -19,7 +19,7 @@ flowchart TB L14["层级 14
堆叠层(依赖更底层 crate)
`ax-api`、`ax-posix-api`、`starry-kernel`"] classDef ls14 fill:#b2ebf2,stroke:#00838f,stroke-width:2px,color:#000 class L14 ls14 - L13["层级 13
堆叠层(依赖更底层 crate)
`ax-feat`"] + L13["层级 13
堆叠层(依赖更底层 crate)
`ax-runtime`"] classDef ls13 fill:#ffcdd2,stroke:#c62828,stroke-width:2px,color:#000 class L13 ls13 L12["层级 12
堆叠层(依赖更底层 crate)
`ax-runtime`"] @@ -169,7 +169,7 @@ flowchart TB | 10 | 堆叠层 | ArceOS 层 | `ax-input` | `0.5.0` | `os/arceos/modules/axinput` | | 11 | 堆叠层 | 组件层 | `ax-net` | `0.7.1` | `net/ax-net` | | 12 | 堆叠层 | ArceOS 层 | `ax-runtime` | `0.5.0` | `os/arceos/modules/axruntime` | -| 13 | 堆叠层 | ArceOS 层 | `ax-feat` | `0.5.0` | `os/arceos/api/axfeat` | +| 13 | 堆叠层 | ArceOS 层 | `ax-runtime` | `0.5.0` | `os/arceos/api/feature` | | 14 | 堆叠层 | ArceOS 层 | `ax-api` | `0.5.0` | `os/arceos/api/arceos_api` | | 14 | 堆叠层 | ArceOS 层 | `ax-posix-api` | `0.5.0` | `os/arceos/api/arceos_posix_api` | | 14 | 堆叠层 | StarryOS 层 | `starry-kernel` | `0.4.0` | `os/StarryOS/kernel` | @@ -216,7 +216,7 @@ flowchart TB | 10 | 5 | `ax-display` `ax-fs` `ax-fs-ng` `ax-input` `ax-net` | | 11 | 1 | `ax-net` | | 12 | 1 | `ax-runtime` | -| 13 | 1 | `ax-feat` | +| 13 | 1 | `ax-runtime` | | 14 | 3 | `ax-api` `ax-posix-api` `starry-kernel` | | 15 | 4 | `ax-libc` `ax-std` `starryos` `starryos-test` | | 16 | 21 | `arceos-affinity` `arceos-display` `arceos-exception` `arceos-fs-shell` `arceos-irq` `arceos-memtest` `arceos-net-echoserver` `arceos-net-httpclient` `arceos-net-httpserver` `arceos-net-udpserver` `arceos-parallel` `arceos-priority` `arceos-sleep` `arceos-tls` `arceos-wait-queue` `arceos-yield` `arceos-helloworld` `arceos-httpclient` `arceos-httpserver` `arceos-shell` `axvisor` | @@ -247,10 +247,10 @@ flowchart TB | `arceos-yield` | 16 | 系统级测试与回归入口 | `ax-std` | — | | `arm_vcpu` | 6 | Aarch64 VCPU implementation for Arceos Hypervisor | `ax-errno` `ax-percpu` `axaddrspace` `axdevice_base` `axvisor_api` | `axvm` | | `arm_vgic` | 5 | ARM Virtual Generic Interrupt Controller (VGIC) i… | `aarch64_sysreg` `ax-errno` `ax-memory-addr` `axaddrspace` `axdevice_base` `axvisor_api` | `axdevice` `axvm` | -| `ax-alloc` | 3 | ArceOS global memory allocator | `ax-allocator` `ax-errno` `ax-kspin` `ax-memory-addr` `ax-percpu` `axbacktrace` | `ax-api` `ax-dma` `ax-driver` `ax-feat` `ax-fs-ng` `ax-hal` `ax-mm` `ax-posix-api` `ax-runtime` `axplat-dyn` `starry-kernel` | +| `ax-alloc` | 3 | ArceOS global memory allocator | `ax-allocator` `ax-errno` `ax-kspin` `ax-memory-addr` `ax-percpu` `axbacktrace` | `ax-api` `ax-dma` `ax-driver` `ax-runtime` `ax-fs-ng` `ax-hal` `ax-mm` `ax-posix-api` `ax-runtime` `axplat-dyn` `starry-kernel` | | `ax-allocator` | 1 | Various allocator algorithms in a unified interfa… | `ax-errno` `bitmap-allocator` | `ax-alloc` `ax-dma` | -| `ax-api` | 14 | Public APIs and types for ArceOS modules | `ax-alloc` `ax-display` `ax-dma` `ax-driver` `ax-errno` `ax-feat` `ax-fs` `ax-hal` `ax-io` `ax-ipi` `ax-log` `ax-mm` `ax-net` `ax-runtime` `ax-sync` `ax-task` | `ax-std` | -| | 2 | Platform-specific constants and parameters for Ar… | | `ax-api` `ax-dma` `ax-driver` `ax-feat` `ax-hal` `ax-ipi` `ax-net` `ax-posix-api` `ax-runtime` `ax-task` `axvisor` `starry-kernel` | +| `ax-api` | 14 | Public APIs and types for ArceOS modules | `ax-alloc` `ax-display` `ax-dma` `ax-driver` `ax-errno` `ax-runtime` `ax-fs` `ax-hal` `ax-io` `ax-ipi` `ax-log` `ax-mm` `ax-net` `ax-runtime` `ax-sync` `ax-task` | `ax-std` | +| | 2 | Platform-specific constants and parameters for Ar… | | `ax-api` `ax-dma` `ax-driver` `ax-runtime` `ax-hal` `ax-ipi` `ax-net` `ax-posix-api` `ax-runtime` `ax-task` `axvisor` `starry-kernel` | | | 0 | A TOML-based configuration generation tool for Ar… | — | | | | 1 | Procedural macros for converting TOML format conf… | | `axplat-dyn` | | `ax-cpu` | 3 | Privileged instruction and structure abstractions… | `ax-lazyinit` `ax-memory-addr` `ax-page-table-entry` `ax-page-table-multiarch` `ax-percpu` `axbacktrace` | `ax-hal` `axplat-dyn` `starry-signal` | @@ -258,50 +258,50 @@ flowchart TB | `ax-crate-interface` | 0 | Provides a way to define an interface (trait) in … | — | `arceos-fs-shell` `ax-driver` `ax-kernel-guard` `ax-log` `ax-plat` `ax-plat-macros` `ax-runtime` `ax-task` `axvisor` `axvisor_api` `define-simple-traits` `define-weak-traits` `fxmac_rs` `impl-simple-traits` `impl-weak-partial` `impl-weak-traits` `riscv_vcpu` `test-simple` `test-weak` `test-weak-partial` `x86_vcpu` | | `ax-ctor-bare` | 1 | Register constructor functions for Rust at compli… | `ax-ctor-bare-macros` | `ax-runtime` | | `ax-ctor-bare-macros` | 0 | Macros for registering constructor functions for … | — | `ax-ctor-bare` | -| `ax-display` | 10 | ArceOS graphics module | `ax-driver` `ax-lazyinit` `ax-sync` | `ax-api` `ax-feat` `ax-runtime` `starry-kernel` | +| `ax-display` | 10 | ArceOS graphics module | `ax-driver` `ax-lazyinit` `ax-sync` | `ax-api` `ax-runtime` `ax-runtime` `starry-kernel` | | `ax-dma` | 8 | ArceOS global DMA allocator | `ax-alloc` `ax-allocator` `ax-hal` `ax-kspin` `ax-memory-addr` `ax-mm` | `ax-api` `ax-driver` | -| `ax-driver` | 9 | ArceOS device drivers | `anyhow` `ax-alloc` `ax-crate-interface` `ax-dma` `ax-errno` `ax-kernel-guard` `ax-kspin` `axklib` `dma-api` `mmio-api` `rdrive` `rd-net` `rdif-*` `virtio-drivers` | `ax-api` `ax-display` `ax-feat` `ax-fs` `ax-fs-ng` `ax-input` `ax-net` `ax-net` `ax-runtime` `starry-kernel` | +| `ax-driver` | 9 | ArceOS device drivers | `anyhow` `ax-alloc` `ax-crate-interface` `ax-dma` `ax-errno` `ax-kernel-guard` `ax-kspin` `axklib` `dma-api` `mmio-api` `rdrive` `rd-net` `rdif-*` `virtio-drivers` | `ax-api` `ax-display` `ax-runtime` `ax-fs` `ax-fs-ng` `ax-input` `ax-net` `ax-net` `ax-runtime` `starry-kernel` | | `ax-errno` | 0 | Generic error code representation. | — | `arm_vcpu` `arm_vgic` `ax-alloc` `ax-allocator` `ax-api` `ax-driver` `ax-fs` `ax-fs-ng` `ax-fs-vfs` `ax-io` `ax-libc` `ax-memory-set` `ax-mm` `ax-net` `ax-net` `ax-page-table-multiarch` `ax-posix-api` `ax-std` `ax-task` `axaddrspace` `axdevice` `axdevice_base` `axfs-ng-vfs` `axhvc` `axklib` `axplat-dyn` `axvisor` `axvm` `axvmconfig` `riscv_vcpu` `riscv_vplic` `starry-kernel` `starry-vm` `x86_vcpu` `x86_vlapic` | -| `ax-feat` | 13 | Top-level feature selection for ArceOS | `ax-alloc` `ax-display` `ax-driver` `ax-fs` `ax-fs-ng` `ax-hal` `ax-input` `ax-ipi` `ax-kspin` `ax-log` `ax-net` `ax-runtime` `ax-sync` `ax-task` `axbacktrace` | `ax-api` `ax-libc` `ax-posix-api` `ax-std` `starry-kernel` `starryos` `starryos-test` | -| `ax-fs` | 10 | ArceOS filesystem module | `ax-driver` `ax-errno` `ax-fs-devfs` `ax-fs-ramfs` `ax-fs-vfs` `ax-hal` `ax-io` `ax-lazyinit` `rsext4` | `ax-api` `ax-feat` `ax-posix-api` `ax-runtime` | +| `ax-runtime` | 13 | Top-level feature selection for ArceOS | `ax-alloc` `ax-display` `ax-driver` `ax-fs` `ax-fs-ng` `ax-hal` `ax-input` `ax-ipi` `ax-kspin` `ax-log` `ax-net` `ax-runtime` `ax-sync` `ax-task` `axbacktrace` | `ax-api` `ax-libc` `ax-posix-api` `ax-std` `starry-kernel` `starryos` `starryos-test` | +| `ax-fs` | 10 | ArceOS filesystem module | `ax-driver` `ax-errno` `ax-fs-devfs` `ax-fs-ramfs` `ax-fs-vfs` `ax-hal` `ax-io` `ax-lazyinit` `rsext4` | `ax-api` `ax-runtime` `ax-posix-api` `ax-runtime` | | `ax-fs-devfs` | 2 | Device filesystem used by ArceOS | `ax-fs-vfs` | `ax-fs` | -| `ax-fs-ng` | 10 | ArceOS filesystem module | `ax-alloc` `ax-driver` `ax-errno` `ax-hal` `ax-io` `ax-kspin` `ax-sync` `axfs-ng-vfs` `axpoll` `scope-local` | `ax-feat` `ax-net` `ax-runtime` `starry-kernel` | +| `ax-fs-ng` | 10 | ArceOS filesystem module | `ax-alloc` `ax-driver` `ax-errno` `ax-hal` `ax-io` `ax-kspin` `ax-sync` `axfs-ng-vfs` `axpoll` `scope-local` | `ax-runtime` `ax-net` `ax-runtime` `starry-kernel` | | `ax-fs-ramfs` | 2 | RAM filesystem used by ArceOS | `ax-fs-vfs` | `arceos-fs-shell` `ax-fs` | | `ax-fs-vfs` | 1 | Virtual filesystem interfaces used by ArceOS | `ax-errno` | `arceos-fs-shell` `ax-fs` `ax-fs-devfs` `ax-fs-ramfs` | -| `ax-hal` | 6 | ArceOS hardware abstraction layer, provides unifi… | `ax-alloc` `ax-cpu` `ax-kernel-guard` `ax-memory-addr` `ax-page-table-multiarch` `ax-percpu` `ax-plat` `axplat-dyn` | `ax-api` `ax-dma` `ax-driver` `ax-feat` `ax-fs` `ax-fs-ng` `ax-ipi` `ax-mm` `ax-net` `ax-net` `ax-posix-api` `ax-runtime` `ax-task` `axvisor` `starry-kernel` | +| `ax-hal` | 6 | ArceOS hardware abstraction layer, provides unifi… | `ax-alloc` `ax-cpu` `ax-kernel-guard` `ax-memory-addr` `ax-page-table-multiarch` `ax-percpu` `ax-plat` `axplat-dyn` | `ax-api` `ax-dma` `ax-driver` `ax-runtime` `ax-fs` `ax-fs-ng` `ax-ipi` `ax-mm` `ax-net` `ax-net` `ax-posix-api` `ax-runtime` `ax-task` `axvisor` `starry-kernel` | | `arceos-helloworld` | 16 | ArceOS 示例程序 | `ax-std` | — | | `arceos-httpclient` | 16 | ArceOS 示例程序 | `ax-std` | — | | `arceos-httpserver` | 16 | Simple HTTP server. Benchmark with Apache HTTP se… | `ax-std` | — | -| `ax-input` | 10 | Input device management for ArceOS | `ax-driver` `ax-lazyinit` `ax-sync` | `ax-feat` `ax-runtime` `starry-kernel` | +| `ax-input` | 10 | Input device management for ArceOS | `ax-driver` `ax-lazyinit` `ax-sync` | `ax-runtime` `ax-runtime` `starry-kernel` | | `ax-io` | 1 | `std::io` for `no_std` environment | `ax-errno` | `ax-api` `ax-fs` `ax-fs-ng` `ax-libc` `ax-net` `ax-net` `ax-posix-api` `ax-std` `starry-kernel` | -| `ax-ipi` | 7 | ArceOS IPI management module | `ax-hal` `ax-kspin` `ax-lazyinit` `ax-percpu` | `ax-api` `ax-feat` `ax-runtime` | +| `ax-ipi` | 7 | ArceOS IPI management module | `ax-hal` `ax-kspin` `ax-lazyinit` `ax-percpu` | `ax-api` `ax-runtime` `ax-runtime` | | `ax-kernel-guard` | 1 | RAII wrappers to create a critical section with l… | `ax-crate-interface` | `ax-hal` `ax-kspin` `ax-percpu` `ax-task` `axvisor` `starry-kernel` | -| `ax-kspin` | 2 | Spinlocks used for kernel space that can disable … | `ax-kernel-guard` | `ax-alloc` `ax-dma` `ax-feat` `ax-fs-ng` `ax-ipi` `ax-log` `ax-mm` `ax-plat` `ax-std` `ax-sync` `ax-task` `axvisor` `starry-kernel` `starry-process` `starry-signal` | +| `ax-kspin` | 2 | Spinlocks used for kernel space that can disable … | `ax-kernel-guard` | `ax-alloc` `ax-dma` `ax-runtime` `ax-fs-ng` `ax-ipi` `ax-log` `ax-mm` `ax-plat` `ax-std` `ax-sync` `ax-task` `axvisor` `starry-kernel` `starry-process` `starry-signal` | | `ax-lazyinit` | 0 | Initialize a static value lazily. | — | `ax-cpu` `ax-display` `ax-fs` `ax-input` `ax-ipi` `ax-mm` `ax-net` `ax-std` `ax-task` `axaddrspace` `axvisor` `starry-process` | -| `ax-libc` | 15 | ArceOS user program library for C apps | `ax-errno` `ax-feat` `ax-io` `ax-posix-api` | — | +| `ax-libc` | 15 | ArceOS user program library for C apps | `ax-errno` `ax-runtime` `ax-io` `ax-posix-api` | — | | `ax-linked-list-r4l` | 0 | Linked lists that supports arbitrary removal in c… | — | `ax-sched` | -| `ax-log` | 3 | Macros for multi-level formatted logging used by … | `ax-crate-interface` `ax-kspin` | `ax-api` `ax-feat` `ax-posix-api` `ax-runtime` `starry-kernel` | +| `ax-log` | 3 | Macros for multi-level formatted logging used by … | `ax-crate-interface` `ax-kspin` | `ax-api` `ax-runtime` `ax-posix-api` `ax-runtime` `starry-kernel` | | `ax-memory-addr` | 0 | Wrappers and helper functions for physical and vi… | — | `arm_vgic` `ax-alloc` `ax-cpu` `ax-dma` `ax-hal` `ax-memory-set` `ax-mm` `ax-page-table-entry` `ax-page-table-multiarch` `ax-plat` `ax-task` `axaddrspace` `axdevice` `axklib` `axplat-dyn` `axvisor` `axvisor_api` `axvm` `riscv_vcpu` `starry-kernel` `x86_vcpu` `x86_vlapic` | | `ax-memory-set` | 1 | Data structures and operations for managing memor… | `ax-errno` `ax-memory-addr` | `ax-mm` `axaddrspace` `starry-kernel` | | `ax-mm` | 7 | ArceOS virtual memory management module | `ax-alloc` `ax-errno` `ax-hal` `ax-kspin` `ax-lazyinit` `ax-memory-addr` `ax-memory-set` `ax-page-table-multiarch` | `ax-api` `ax-dma` `ax-runtime` `starry-kernel` | -| `ax-net` | 11 | Unified network stack | `ax-errno` `ax-fs-ng` `ax-hal` `ax-io` `ax-sync` `ax-task` `axfs-ng-vfs` `axpoll` `rd-net` `smoltcp` | `ax-api` `ax-feat` `ax-posix-api` `ax-runtime` `starry-kernel` | +| `ax-net` | 11 | Unified network stack | `ax-errno` `ax-fs-ng` `ax-hal` `ax-io` `ax-sync` `ax-task` `axfs-ng-vfs` `axpoll` `rd-net` `smoltcp` | `ax-api` `ax-runtime` `ax-posix-api` `ax-runtime` `starry-kernel` | | `ax-page-table-entry` | 1 | Page table entry definition for various hardware … | `ax-memory-addr` | `ax-cpu` `ax-page-table-multiarch` `axaddrspace` `axvisor` `axvm` `riscv_vcpu` `x86_vcpu` | | `ax-page-table-multiarch` | 2 | Generic page table structures for various hardwar… | `ax-errno` `ax-memory-addr` `ax-page-table-entry` | `ax-cpu` `ax-hal` `ax-mm` `axaddrspace` `axvisor` `axvm` `starry-kernel` | | `ax-percpu` | 2 | Define and access per-CPU data structures | `ax-kernel-guard` `ax-percpu-macros` | `arm_vcpu` `ax-alloc` `ax-cpu` `ax-hal` `ax-ipi` `ax-plat` `ax-runtime` `ax-task` `axplat-dyn` `axvisor` `axvm` `scope-local` `starry-kernel` | | `ax-percpu-macros` | 0 | Macros to define and access a per-CPU data struct… | — | `ax-percpu` | | `ax-plat` | 3 | This crate provides a unified abstraction layer f… | `ax-crate-interface` `ax-kspin` `ax-memory-addr` `ax-percpu` `ax-plat-macros` | `ax-hal` `ax-runtime` `axplat-dyn` | | `ax-plat-macros` | 1 | Procedural macros for the `axplat` crate | `ax-crate-interface` | `ax-plat` | -| `ax-posix-api` | 14 | POSIX-compatible APIs for ArceOS modules | `ax-alloc` `ax-errno` `ax-feat` `ax-fs` `ax-hal` `ax-io` `ax-log` `ax-net` `ax-runtime` `ax-sync` `ax-task` `scope-local` | `ax-libc` | +| `ax-posix-api` | 14 | POSIX-compatible APIs for ArceOS modules | `ax-alloc` `ax-errno` `ax-runtime` `ax-fs` `ax-hal` `ax-io` `ax-log` `ax-net` `ax-runtime` `ax-sync` `ax-task` `scope-local` | `ax-libc` | | `ax-riscv-plic` | 0 | RISC-V platform-level interrupt controller (PLIC)… | — | — | -| `ax-runtime` | 12 | Runtime library of ArceOS | `ax-alloc` `ax-crate-interface` `ax-ctor-bare` `ax-display` `ax-driver` `ax-fs` `ax-fs-ng` `ax-hal` `ax-input` `ax-ipi` `ax-log` `ax-mm` `ax-net` `ax-net` `ax-percpu` `ax-plat` `ax-task` `axbacktrace` `axklib` | `ax-api` `ax-feat` `ax-posix-api` `starry-kernel` | +| `ax-runtime` | 12 | Runtime library of ArceOS | `ax-alloc` `ax-crate-interface` `ax-ctor-bare` `ax-display` `ax-driver` `ax-fs` `ax-fs-ng` `ax-hal` `ax-input` `ax-ipi` `ax-log` `ax-mm` `ax-net` `ax-net` `ax-percpu` `ax-plat` `ax-task` `axbacktrace` `axklib` | `ax-api` `ax-runtime` `ax-posix-api` `starry-kernel` | | `ax-sched` | 1 | Various scheduler algorithms in a unified interfa… | `ax-linked-list-r4l` | `ax-task` | | `arceos-shell` | 16 | ArceOS 示例程序 | `ax-std` | — | -| `ax-std` | 15 | ArceOS user library with an interface similar to … | `ax-api` `ax-errno` `ax-feat` `ax-io` `ax-kspin` `ax-lazyinit` | `arceos-affinity` `arceos-display` `arceos-exception` `arceos-fs-shell` `arceos-irq` `arceos-memtest` `arceos-net-echoserver` `arceos-net-httpclient` `arceos-net-httpserver` `arceos-net-udpserver` `arceos-parallel` `arceos-priority` `arceos-sleep` `arceos-tls` `arceos-wait-queue` `arceos-yield` `arceos-helloworld` `arceos-httpclient` `arceos-httpserver` `arceos-shell` `axvisor` | -| `ax-sync` | 8 | ArceOS synchronization primitives | `ax-kspin` `ax-task` | `ax-api` `ax-display` `ax-feat` `ax-fs-ng` `ax-input` `ax-net` `ax-net` `ax-posix-api` `starry-kernel` | -| `ax-task` | 7 | ArceOS task management module | `ax-cpumask` `ax-crate-interface` `ax-errno` `ax-hal` `ax-kernel-guard` `ax-kspin` `ax-lazyinit` `ax-memory-addr` `ax-percpu` `ax-sched` `ax-timer-list` `axpoll` | `ax-api` `ax-feat` `ax-net` `ax-net` `ax-posix-api` `ax-runtime` `ax-sync` `starry-kernel` | +| `ax-std` | 15 | ArceOS user library with an interface similar to … | `ax-api` `ax-errno` `ax-runtime` `ax-io` `ax-kspin` `ax-lazyinit` | `arceos-affinity` `arceos-display` `arceos-exception` `arceos-fs-shell` `arceos-irq` `arceos-memtest` `arceos-net-echoserver` `arceos-net-httpclient` `arceos-net-httpserver` `arceos-net-udpserver` `arceos-parallel` `arceos-priority` `arceos-sleep` `arceos-tls` `arceos-wait-queue` `arceos-yield` `arceos-helloworld` `arceos-httpclient` `arceos-httpserver` `arceos-shell` `axvisor` | +| `ax-sync` | 8 | ArceOS synchronization primitives | `ax-kspin` `ax-task` | `ax-api` `ax-display` `ax-runtime` `ax-fs-ng` `ax-input` `ax-net` `ax-net` `ax-posix-api` `starry-kernel` | +| `ax-task` | 7 | ArceOS task management module | `ax-cpumask` `ax-crate-interface` `ax-errno` `ax-hal` `ax-kernel-guard` `ax-kspin` `ax-lazyinit` `ax-memory-addr` `ax-percpu` `ax-sched` `ax-timer-list` `axpoll` | `ax-api` `ax-runtime` `ax-net` `ax-net` `ax-posix-api` `ax-runtime` `ax-sync` `starry-kernel` | | `ax-timer-list` | 0 | A list of timed events that will be triggered seq… | — | `ax-task` `axvisor` | | `axaddrspace` | 3 | ArceOS-Hypervisor guest address space management … | `ax-errno` `ax-lazyinit` `ax-memory-addr` `ax-memory-set` `ax-page-table-entry` `ax-page-table-multiarch` | `arm_vcpu` `arm_vgic` `axdevice` `axdevice_base` `axvisor` `axvisor_api` `axvm` `riscv_vcpu` `riscv_vplic` `x86_vcpu` `x86_vlapic` | -| `axbacktrace` | 0 | Backtrace for ArceOS | — | `ax-alloc` `ax-cpu` `ax-feat` `ax-runtime` `starry-kernel` | +| `axbacktrace` | 0 | Backtrace for ArceOS | — | `ax-alloc` `ax-cpu` `ax-runtime` `ax-runtime` `starry-kernel` | | `axbuild` | 2 | An OS build lib toolkit used by arceos | `axvmconfig` | `axvisor` `starryos` `tg-xtask` | | `axdevice` | 6 | A reusable, OS-agnostic device abstraction layer … | `arm_vgic` `ax-errno` `ax-memory-addr` `axaddrspace` `axdevice_base` `axvmconfig` `riscv_vplic` | `axvisor` `axvm` | | `axdevice_base` | 4 | Basic traits and structures for emulated devices … | `ax-errno` `axaddrspace` `axvmconfig` | `arm_vcpu` `arm_vgic` `axdevice` `axvisor` `axvm` `riscv_vplic` `x86_vcpu` `x86_vlapic` | @@ -332,12 +332,12 @@ flowchart TB | `scope-local` | 3 | Scope local storage | `ax-percpu` | `ax-fs-ng` `ax-posix-api` `starry-kernel` | | `smoltcp` | 0 | A TCP/IP stack designed for bare-metal, real-time… | — | `ax-net` `ax-net` `smoltcp-fuzz` | | `smoltcp-fuzz` | 1 | 可复用基础组件 | `smoltcp` | — | -| `starry-kernel` | 14 | A Linux-compatible OS kernel built on ArceOS unik… | `ax-alloc` `ax-display` `ax-driver` `ax-errno` `ax-feat` `ax-fs-ng` `ax-hal` `ax-input` `ax-io` `ax-kernel-guard` `ax-kspin` `ax-log` `ax-memory-addr` `ax-memory-set` `ax-mm` `ax-net` `ax-page-table-multiarch` `ax-percpu` `ax-runtime` `ax-sync` `ax-task` `axbacktrace` `axfs-ng-vfs` `axpoll` `scope-local` `starry-process` `starry-signal` `starry-vm` | `starryos` `starryos-test` | +| `starry-kernel` | 14 | A Linux-compatible OS kernel built on ArceOS unik… | `ax-alloc` `ax-display` `ax-driver` `ax-errno` `ax-runtime` `ax-fs-ng` `ax-hal` `ax-input` `ax-io` `ax-kernel-guard` `ax-kspin` `ax-log` `ax-memory-addr` `ax-memory-set` `ax-mm` `ax-net` `ax-page-table-multiarch` `ax-percpu` `ax-runtime` `ax-sync` `ax-task` `axbacktrace` `axfs-ng-vfs` `axpoll` `scope-local` `starry-process` `starry-signal` `starry-vm` | `starryos` `starryos-test` | | `starry-process` | 3 | Process management for Starry OS | `ax-kspin` `ax-lazyinit` | `starry-kernel` | | `starry-signal` | 4 | Signal management library for Starry OS | `ax-cpu` `ax-kspin` `starry-vm` | `starry-kernel` | | `starry-vm` | 1 | Virtual memory management library for Starry OS | `ax-errno` | `starry-kernel` `starry-signal` | -| `starryos` | 15 | A Linux-compatible OS kernel built on ArceOS unik… | `ax-feat` `axbuild` `starry-kernel` | — | -| `starryos-test` | 15 | A Linux-compatible OS kernel built on ArceOS unik… | `ax-feat` `starry-kernel` | — | +| `starryos` | 15 | A Linux-compatible OS kernel built on ArceOS unik… | `ax-runtime` `axbuild` `starry-kernel` | — | +| `starryos-test` | 15 | A Linux-compatible OS kernel built on ArceOS unik… | `ax-runtime` `starry-kernel` | — | | `test-simple` | 3 | Integration tests for simple traits (without weak… | `ax-crate-interface` `define-simple-traits` `impl-simple-traits` | — | | `test-weak` | 3 | Integration tests for weak_default traits with FU… | `ax-crate-interface` `define-weak-traits` `impl-weak-traits` | — | | `test-weak-partial` | 3 | Integration tests for weak_default traits with PA… | `ax-crate-interface` `define-weak-traits` `impl-weak-partial` | — | diff --git a/docs/docs/components/overview.md b/docs/docs/components/overview.md index 0c6acbd7d5..7786df5584 100644 --- a/docs/docs/components/overview.md +++ b/docs/docs/components/overview.md @@ -118,7 +118,7 @@ flowchart TB | `ax-dma` | ArceOS 层 | `os/arceos/modules/axdma` | 7 | 2 | [查看](crates/ax-dma) | | `ax-driver` | ArceOS 层 | `drivers/ax-driver` | 15 | 10 | [查看](../architecture/driver/overview) | | `ax-errno` | 组件层 | `components/axerrno` | 0 | 36 | [查看](crates/ax-errno) | -| `ax-feat` | ArceOS 层 | `os/arceos/api/axfeat` | 16 | 7 | [查看](crates/ax-feat) | +| `ax-runtime` | ArceOS 层 | `os/arceos/api/feature` | 16 | 7 | [查看](crates/ax-runtime) | | `ax-fs` | ArceOS 层 | `os/arceos/modules/axfs` | 10 | 4 | [查看](crates/ax-fs) | | `ax-fs-devfs` | 组件层 | `components/axfs_crates/axfs_devfs` | 1 | 1 | [查看](crates/ax-fs-devfs) | | `ax-fs-ng` | ArceOS 层 | `os/arceos/modules/axfs-ng` | 10 | 4 | [查看](crates/ax-fs-ng) | diff --git a/docs/docs/debug/check-mechanisms-summary.md b/docs/docs/debug/check-mechanisms-summary.md index 9e60cf4e72..fd8818a102 100644 --- a/docs/docs/debug/check-mechanisms-summary.md +++ b/docs/docs/debug/check-mechanisms-summary.md @@ -99,11 +99,11 @@ cargo xtask sync-lint task stack canary 用来发现任务栈溢出或栈底被破坏。 -启用 `stack-canary` 后,任务栈底会写入固定 magic 值。每次任务切换时,调度器检查上一个任务的 canary 是否仍完整;如果 magic 被覆盖,说明栈可能已经越界或被破坏,系统会 panic 并打印任务名、栈范围和期望 magic。 +启用 `stack canary` 后,任务栈底会写入固定 magic 值。每次任务切换时,调度器检查上一个任务的 canary 是否仍完整;如果 magic 被覆盖,说明栈可能已经越界或被破坏,系统会 panic 并打印任务名、栈范围和期望 magic。 -当前 `ax-task` 的 `multitask` feature 会启用 `stack-canary`。`stack-guard-page` 是额外的硬件页表保护机制:动态任务栈创建时会在栈底保留一页 guard page,并在栈向下越界触达该页时触发 page fault 诊断。 +当前 `ax-task` 的 `multitask` feature 会启用 `stack canary`。`stack-guard-page` 是额外的硬件页表保护机制:动态任务栈创建时会在栈底保留一页 guard page,并在栈向下越界触达该页时触发 page fault 诊断。 -`stack-guard-page` 当前是 opt-in hardening feature,默认构建和普通回归测试不会启用。ArceOS Rust 应用通常通过 `ax-std/stack-guard-page` 手动启用;StarryOS 应通过 `starry-kernel/stack-guard-page` 启用,以同时打开 Starry fault handler 中的 guard page 诊断路径和底层 `ax-feat/stack-guard-page`。项目 xtask/axbuild 流程可使用 `FEATURES=...` 注入这些 feature。 +`stack-guard-page` 当前是 opt-in hardening feature,默认构建和普通回归测试不会启用。ArceOS Rust 应用通常通过 `ax-std/stack-guard-page` 手动启用;StarryOS 应通过 `starry-kernel/stack-guard-page` 启用,以同时打开 Starry fault handler 中的 guard page 诊断路径和底层 `ax-runtime/stack-guard-page`。项目 xtask/axbuild 流程可使用 `FEATURES=...` 注入这些 feature。 canary 覆盖范围包括: @@ -118,7 +118,7 @@ boot/current 栈,也不覆盖未来可能引入的独立 IRQ stack、exception 或 overflow stack。这个边界与动态平台无直接绑定:动态任务栈覆盖,borrowed 栈暂不覆盖。 Linux 的栈保护包含两层不同机制。`STACK_END_MAGIC` 用于检查任务栈底是否 -被覆盖,作用与当前 `stack-canary` 接近;`CONFIG_STACKPROTECTOR` / +被覆盖,作用与当前 `stack canary` 接近;`CONFIG_STACKPROTECTOR` / `CONFIG_STACKPROTECTOR_STRONG` 则依赖编译器在函数栈帧中插入 canary, 函数返回前比较保存值和运行时 guard,失败时调用 `__stack_chk_fail()`。 后者可以发现尚未一路覆盖到任务栈底的函数局部栈溢出,是当前机制尚未覆盖 diff --git a/docs/docs/debug/lock-usage-followups.md b/docs/docs/debug/lock-usage-followups.md index 24aad56cfb..60e7ccf310 100644 --- a/docs/docs/debug/lock-usage-followups.md +++ b/docs/docs/debug/lock-usage-followups.md @@ -43,7 +43,7 @@ sidebar_label: "锁使用问题跟踪" | 区域 | 当前状态 | 风险 | 后续方向 | | --- | --- | --- | --- | -| `os/arceos/modules/axfs-ng/src/fs/fat/fs.rs` | FAT 主文件系统状态使用 `SpinNoIrq`。 | `read_at`、`write_at`、`append`、`set_len`、`sync` 和目录操作会在持锁期间进入 `fatfs`,再到块设备 `read_block` / `write_block` / `flush`。这是粗文件系统锁包住 I/O 的典型问题。 | 继续保持为已知技术债。后续应拆分 FAT 内部状态锁,避免持自旋锁进入块 I/O 和外部 sink callback;或者在 sleepable 任务上下文中使用 sleepable 锁。 | +| `os/arceos/modules/axfs-ng/src/fs/fat/fs.rs` | FAT 主文件系统状态使用 `SpinNoIrq`。 | `read_at`、`write_at`、`append`、`set_len`、`sync` 和目录操作会在持锁期间进入 `fat`,再到块设备 `read_block` / `write_block` / `flush`。这是粗文件系统锁包住 I/O 的典型问题。 | 继续保持为已知技术债。后续应拆分 FAT 内部状态锁,避免持自旋锁进入块 I/O 和外部 sink callback;或者在 sleepable 任务上下文中使用 sleepable 锁。 | | `os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/fs.rs` | rsext4 主状态使用 `SpinNoIrq`。 | `sync_to_disk`、读写、truncate、create、unlink、rename 等路径可能持锁执行 cache、journal、allocation 和 block-device 操作。 | 不应再机械换成其他自旋锁。需要设计 ext4 粗锁拆分、I/O 外移或早期 rootfs 工作上下文调整。 | | `os/arceos/modules/axfs-ng/src/fs/ext4/lwext4/fs.rs` | lwext4 文件系统对象使用 `SpinNoIrq`。 | 多个 VFS 操作持锁进入 `lwext4_rust`,`flush()` 也直接在锁内调用后端 flush。 | 与 rsext4 一起复查 ext4 系列锁策略,避免长期在原子上下文包住文件系统实现。 | | `components/axfs-ng-vfs/src/node/dir.rs` | dentry cache 使用 `SpinNoIrq`,当前已缩小锁范围。 | 旧问题是 cache guard 下调用 filesystem `lookup`、`create`、`unlink`、`open_file` 等后端操作。当前已调整为 VFS cache 锁内只访问 cache map,后端操作在锁外执行。 | 保持当前边界。新增 dentry cache 路径时禁止在 cache guard 内调用后端 FS、socket、设备或用户态相关回调。 | diff --git a/docs/docs/debug/might-sleep-followups.md b/docs/docs/debug/might-sleep-followups.md index 7469ee24dd..75ec456104 100644 --- a/docs/docs/debug/might-sleep-followups.md +++ b/docs/docs/debug/might-sleep-followups.md @@ -379,7 +379,7 @@ rg -n "access_user_memory|handle_page_fault|vm_read|vm_write|IoDst::write" \ 2026-07-02 在实现 MS-1、MS-2 Phase 1 和 MS-3 Phase A/B 时,以下 host 单元测试过滤项出现 SIGSEGV: -- `cargo test -p ax-task --features "test sched-rr" test_fp_state_switch` +- `cargo test -p ax-task --features "test rr" test_fp_state_switch` - `cargo test -p ax-lockdep dynamic_lock_instances_do_not_consume_class_slots` - `cargo test -p ax-lockdep subclass_tracks_same_base_class_nesting` diff --git a/docs/docs/debug/task-stack-guard-page.md b/docs/docs/debug/task-stack-guard-page.md index 9006818c18..9e4a719bf8 100644 --- a/docs/docs/debug/task-stack-guard-page.md +++ b/docs/docs/debug/task-stack-guard-page.md @@ -12,7 +12,7 @@ sidebar_label: "Task Stack Guard Page" ## 背景 -当前 `ax-task` 已经有 task stack canary 检查。启用 `stack-canary` 后, +当前 `ax-task` 已经有 task stack canary 检查。启用 `stack canary` 后, `TaskStack` 会在栈底写入固定 magic 值,调度器在任务切换时检查上一个 任务的 canary 是否仍然完整。这个机制可以发现栈底被覆盖或栈溢出导致的 内存破坏,但它本质上是事后检查:只有在后续检查点运行时,破坏才会被发现。 @@ -85,10 +85,10 @@ guard page。 常见启用方式包括: - ArceOS Rust 应用通过 `ax-std/stack-guard-page` 启用。 -- ArceOS 底层或非 `ax-std` 场景通过 `ax-feat/stack-guard-page` 启用。 +- ArceOS 底层或非 `ax-std` 场景通过 `ax-runtime/stack-guard-page` 启用。 - StarryOS 通过 `starry-kernel/stack-guard-page` 启用;这个 feature 会同时 打开 Starry fault handler 中的 guard page 诊断路径,并向下启用 - `ax-feat/stack-guard-page`。 + `ax-runtime/stack-guard-page`。 项目的 xtask/axbuild 流程也支持通过环境变量注入额外 feature,例如: @@ -132,7 +132,7 @@ guard page 和 canary 覆盖的问题不同: - canary 用于在调度切换等检查点发现栈底被覆盖或破坏。 小范围栈底破坏、未覆盖到 guard page 的破坏,以及暂不支持 guard page 的 -borrowed stack,仍需要 canary 兜底。因此第一阶段不应移除 `stack-canary`。 +borrowed stack,仍需要 canary 兜底。因此第一阶段不应移除 `stack canary`。 ## 当前覆盖边界 @@ -270,7 +270,7 @@ FEATURES=ax-std/stack-guard-page cargo xtask arceos test qemu --arch riscv64 \ StarryOS 可以加 `starry-kernel/stack-guard-page`。不要只写裸 `stack-guard-page`:裸 feature 会按当前包的 ax feature 前缀推导,可能只打开 -底层 `ax-feat/stack-guard-page`,而不会打开 `starry-kernel` 中 +底层 `ax-runtime/stack-guard-page`,而不会打开 `starry-kernel` 中 `#[cfg(feature = "stack-guard-page")]` 保护的 fault 诊断分支。 推荐手动抽样: diff --git a/docs/docs/development/arceos.md b/docs/docs/development/arceos.md index cc50059566..6734b5ab00 100644 --- a/docs/docs/development/arceos.md +++ b/docs/docs/development/arceos.md @@ -66,7 +66,7 @@ os/arceos/ │ ├── axipi/ # 核间中断 │ ├── axruntime/ # 运行时初始化,调用 main() ├── api/ # 对外 API 层 -│ ├── axfeat/ # 顶层 feature 聚合(单一真相源) +│ ├── feature/ # 顶层 feature 聚合(单一真相源) │ ├── arceos_api/ # 公共 API 和类型 │ └── arceos_posix_api/ # POSIX 兼容 API ├── ulib/ # 用户侧库 @@ -156,7 +156,7 @@ version.workspace = true edition.workspace = true [dependencies] -ax-feat = { path = "../../api/axfeat" } +ax-runtime = { path = "../../api/feature" } log = "0.4" [features] @@ -199,9 +199,9 @@ pub fn do_something() -> i32 { ax_mymod::init(); ``` -**6) 在 `axfeat` 中注册 feature** +**6) 在 `feature` 中注册 feature** -在 `os/arceos/api/axfeat/Cargo.toml` 中添加: +在 `os/arceos/api/feature/Cargo.toml` 中添加: ```toml [features] @@ -219,9 +219,9 @@ cargo xtask arceos qemu --package arceos-helloworld --arch aarch64 --features my ### 3.3 Feature 驱动编译 -ArceOS 的核心设计是 **feature 聚合**:应用在 `Cargo.toml` 中声明需要的 feature,`axfeat` 将它们传播到对应模块。 +ArceOS 的核心设计是 **feature 聚合**:应用在 `Cargo.toml` 中声明需要的 feature,`feature` 将它们传播到对应模块。 -`axfeat` 中的 feature 定义示例(简化): +`feature` 中的 feature 定义示例(简化): ```toml [features] @@ -235,9 +235,9 @@ paging = ["alloc", "ax-hal/paging", "ax-runtime/paging"] # 任务 multitask = ["alloc", "ax-task/multitask", "ax-sync/multitask", "ax-runtime/multitask"] -sched-fifo = ["ax-task/sched-fifo"] -sched-rr = ["ax-task/sched-rr", "irq"] -sched-cfs = ["ax-task/sched-cfs", "irq"] +multitask = ["ax-task/multitask"] +rr = ["ax-task/rr", "irq"] +cfs = ["ax-task/cfs", "irq"] # 上层协议栈 fs = ["alloc", "paging", "ax-driver/virtio-blk", "dep:ax-fs", "ax-runtime/fs"] diff --git a/docs/docs/development/components.md b/docs/docs/development/components.md index c0c702dc07..2fd856ec3a 100644 --- a/docs/docs/development/components.md +++ b/docs/docs/development/components.md @@ -18,7 +18,7 @@ TGOSKits 的核心价值不仅在于将各仓库整合到同一工作区,更 | --- | --- | --- | --- | | `components/` | subtree 管理的独立可复用 crate | `ax-errno`、`ax-kspin`、`axvm`、`starry-process` | 三套系统都可能直接或间接使用 | | `os/arceos/modules/` | ArceOS 内核模块 | `ax-hal`、`ax-task`、`ax-net`、`ax-fs` | ArceOS,且经常被 StarryOS 和 Axvisor 复用 | -| `os/arceos/api/` | feature 与对外 API 聚合 | `ax-feat`、`ax-api` | ArceOS 应用、StarryOS、Axvisor | +| `os/arceos/api/` | feature 与对外 API 聚合 | `ax-runtime`、`ax-api` | ArceOS 应用、StarryOS、Axvisor | | `os/arceos/ulib/` | 用户侧库 | `ax-std`、`ax-libc` | ArceOS 示例与用户应用 | | `os/StarryOS/kernel/` | StarryOS 内核逻辑 | syscall、进程、内存、文件系统 | `starryos` 包 | | `os/axvisor/` | Hypervisor 运行时与配置 | `src/`、`configs/board/`、`configs/vms/` | Axvisor | @@ -92,7 +92,7 @@ flowchart TD | --- | --- | --- | | 通用基础能力:错误、锁、页表、Per-CPU、容器 | `components/axerrno`、`components/kspin`、`memory/page_table_multiarch`、`components/percpu` | 三套系统都可能受影响 | | ArceOS 内核服务:调度、HAL、驱动、网络、文件系统 | `os/arceos/modules/*`、`drivers/*`,以及相关 `memory/*` / `platforms/*` | ArceOS,且可能波及 StarryOS / Axvisor | -| ArceOS 的 feature 或应用接口 | `os/arceos/api/axfeat`、`os/arceos/ulib/axstd`、`os/arceos/ulib/axlibc` | ArceOS 应用与上层系统 | +| ArceOS 的 feature 或应用接口 | `os/arceos/api/feature`、`os/arceos/ulib/axstd`、`os/arceos/ulib/axlibc` | ArceOS 应用与上层系统 | | StarryOS 的 Linux 兼容行为 | `components/starry-*`、`os/StarryOS/kernel/*` | StarryOS | | Hypervisor、vCPU、虚拟设备、VM 管理 | `virtualization/axvm`、`virtualization/axvm-types`、`virtualization/*_vcpu`、`virtualization/axdevice`、`virtualization/axvisor_api`、`os/axvisor/src/*` | Axvisor | | 平台、板级适配或 VM 启动配置 | `platforms/*`、`os/axvisor/configs/*` | 一到多个系统 | @@ -283,7 +283,7 @@ my_component = { path = "components/my_component" } ## 6. ArceOS 集成 -在 ArceOS 中集成组件的典型链路为:在 `components/` 或 `os/arceos/modules/` 实现复用逻辑,若需作为可选能力暴露则接入 `os/arceos/api/axfeat`,若需直接供应用使用则接入 `os/arceos/ulib/axstd` 或 `ax-libc`,最后通过 `apps/arceos/*` 或 `test-suit/arceos/*` 进行验证。 +在 ArceOS 中集成组件的典型链路为:在 `components/` 或 `os/arceos/modules/` 实现复用逻辑,若需作为可选能力暴露则接入 `os/arceos/api/feature`,若需直接供应用使用则接入 `os/arceos/ulib/axstd` 或 `ax-libc`,最后通过 `apps/arceos/*` 或 `test-suit/arceos/*` 进行验证。 最常用的三个验证入口: @@ -296,7 +296,7 @@ cargo xtask arceos run --package arceos-shell --arch riscv64 --blk 各层适用场景: - 仅修改内部实现:通常只需修改 `components/` 或 `modules/` -- 新增 feature 开关:修改 `os/arceos/api/axfeat` +- 新增 feature 开关:修改 `os/arceos/api/feature` - 新增应用侧 API:修改 `os/arceos/ulib/axstd` 或 `ax-libc` - 新增示例:添加至 `apps/arceos/` diff --git a/docs/docs/development/starryos.md b/docs/docs/development/starryos.md index 1973890311..00e374129a 100644 --- a/docs/docs/development/starryos.md +++ b/docs/docs/development/starryos.md @@ -117,7 +117,7 @@ StarryOS 专用组件(位于 `components/`): | `rknpu` | Rockchip NPU 驱动 | | `vsock` | VSOCK 支持 | -内核默认启用:`fp-simd`, `irq`, `uspace`, `page-alloc-4g`, `alloc-slab`, `multitask`, `task-ext`, `sched-rr`, `rtc`, `fs-ng-ext4`, `net`。 +内核默认启用:`fp-simd`, `irq`, `uspace`, `page-alloc-4g`, `alloc-slab`, `multitask`, `task-ext`, `rr`, `rtc`, `fs-ng-ext4`, `net`。 ### 3.3 KCOV 暂不引入 @@ -432,7 +432,7 @@ StarryOS 测试配置与 ArceOS 类似,但增加了 shell 交互: # build config env = {AX_IP = "10.0.2.15", AX_GW = "10.0.2.2"} features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/docs/docs/introduction/overview.md b/docs/docs/introduction/overview.md index aa359de117..b12df23344 100644 --- a/docs/docs/introduction/overview.md +++ b/docs/docs/introduction/overview.md @@ -86,7 +86,7 @@ tgoskits/ ├── os/ │ ├── arceos/ # ArceOS 模块化 unikernel │ │ ├── modules/ # 17 个内核模块(axhal, axtask, axmm...) -│ │ ├── api/ # API 聚合层(arceos_api, posix_api, axfeat) +│ │ ├── api/ # API 聚合层(arceos_api, posix_api, feature) │ │ ├── ulib/ # 用户态库(axstd, axlibc) │ │ └── examples/ # 内置示例(helloworld, shell, http*) │ ├── StarryOS/ # StarryOS Linux 兼容系统 @@ -127,7 +127,7 @@ flowchart LR subgraph api["API 聚合层"] arceos_api["arceos_api"] posix_api["arceos_posix_api"] - axfeat["axfeat"] + feature["feature"] end subgraph mods["内核模块 (17)"] hal["axhal"] @@ -146,7 +146,7 @@ flowchart LR | 层次 | 内容 | 职责 | |------|------|------| | 内核模块 (`modules/`) | `axhal`, `axtask`, `axmm`, `axdriver`, `axfs`, `axnet`, `axsync`, `axlog`, `axruntime` 等 | 硬件抽象、调度、内存管理、设备驱动、文件系统、网络栈 | -| API 聚合层 (`api/`) | `arceos_api`, `arceos_posix_api`, `axfeat` | 向上提供统一 API 接口与 feature 开关 | +| API 聚合层 (`api/`) | `arceos_api`, `arceos_posix_api`, `feature` | 向上提供统一 API 接口与 feature 开关 | | 用户态库 (`ulib/`) | `axstd`, `axlibc` | Rust 标准库子集与 C 库兼容层 | → 开发指南:[ArceOS 开发指南](/docs/development/arceos) | 架构说明:[ArceOS 架构](/docs/architecture/arceos) diff --git a/docs/spin-migration-tracking.md b/docs/spin-migration-tracking.md index 35c46e9590..3ad4179121 100644 --- a/docs/spin-migration-tracking.md +++ b/docs/spin-migration-tracking.md @@ -87,7 +87,7 @@ - `components/axfs-ng-vfs` 已将 VFS 内部 `Mutex` / `MutexGuard` 别名从 `spin::Mutex` 切换为 `ax_kspin::SpinNoPreempt`,保持非睡眠自旋语义, 同时可通过 `axfs-ng-vfs/lockdep` 接入 `ax-kspin` lockdep。 -- `ax-fs-ng/lockdep` 和 `ax-feat/lockdep` 已向下传播 `axfs-ng-vfs/lockdep`, +- `ax-fs-ng/lockdep` 和 `ax-runtime/lockdep` 已向下传播 `axfs-ng-vfs/lockdep`, ArceOS lockdep 测试套件也显式启用该 feature。 - `buddy-slab-allocator`、`ramdisk`、`rdif-serial`、`arm-scmi-rs`、 `realtek-rtl8125`、`aic8800`、`rdrive`、`ax-driver`、`crab-usb`、 diff --git a/drivers/ax-driver/Cargo.toml b/drivers/ax-driver/Cargo.toml index 69d5c1d1fa..f932c814d9 100644 --- a/drivers/ax-driver/Cargo.toml +++ b/drivers/ax-driver/Cargo.toml @@ -45,7 +45,7 @@ cvsd = [ fxmac = ["net", "dep:ax-alloc", "dep:ax-crate-interface", "dep:fxmac_rs"] intel-net = ["net", "pci", "dep:eth-intel"] realtek-rtl8125 = ["net", "pci", "dep:realtek-rtl8125"] -aic8800-wifi = [ +aic8800 = [ "net", "dep:aic8800", "dep:sdhci-cv1800", diff --git a/drivers/ax-driver/src/net/mod.rs b/drivers/ax-driver/src/net/mod.rs index d607d71b3b..a2c81f8268 100644 --- a/drivers/ax-driver/src/net/mod.rs +++ b/drivers/ax-driver/src/net/mod.rs @@ -1,6 +1,6 @@ mod binding; -#[cfg(feature = "aic8800-wifi")] +#[cfg(feature = "aic8800")] pub mod aic8800; #[cfg(feature = "fxmac")] pub mod fxmac; diff --git a/os/StarryOS/Makefile b/os/StarryOS/Makefile index 7ae4af0fe1..8526e8f8d6 100644 --- a/os/StarryOS/Makefile +++ b/os/StarryOS/Makefile @@ -15,7 +15,7 @@ export DISK_IMG := rootfs-$(ARCH).img # Generated Options export A := $(CURDIR)/starryos export NO_AXSTD := y -export AX_LIB := ax-feat +export AX_LIB := ax-std export APP_FEATURES := qemu ifeq ($(MEMTRACK), y) diff --git a/os/StarryOS/configs/board/qemu-riscv64.toml b/os/StarryOS/configs/board/qemu-riscv64.toml index 61c1214bfa..75531a504f 100644 --- a/os/StarryOS/configs/board/qemu-riscv64.toml +++ b/os/StarryOS/configs/board/qemu-riscv64.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/virtio-blk", "ax-driver/virtio-net", diff --git a/os/StarryOS/configs/board/visionfive2.toml b/os/StarryOS/configs/board/visionfive2.toml index 3a7943906e..d93ef7c797 100644 --- a/os/StarryOS/configs/board/visionfive2.toml +++ b/os/StarryOS/configs/board/visionfive2.toml @@ -1,7 +1,7 @@ # Build-time config template for StarryOS on VisionFive2. target = "riscv64gc-unknown-none-elf" features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/rtc", "ax-driver/serial", "ax-driver/starfive-jh7110-dwmmc", diff --git a/os/StarryOS/docs/kmod-axbuild-migration.md b/os/StarryOS/docs/kmod-axbuild-migration.md index fa9d8ae2ae..868f6de465 100644 --- a/os/StarryOS/docs/kmod-axbuild-migration.md +++ b/os/StarryOS/docs/kmod-axbuild-migration.md @@ -21,7 +21,7 @@ The upstream StarryOS kmod build flow is Makefile-based: The important property is not the Makefile itself. The important property is that the module build shares the same kernel build context, so Cargo can reuse -the same compiled `starry-kernel`, `ax-feat`, platform, and ArceOS dependency +the same compiled `starry-kernel`, `ax-runtime`, platform, and ArceOS dependency artifacts whenever the compilation inputs match. The existing tgoskits `cargo xtask starry kmod build` implementation bypassed diff --git a/os/StarryOS/kernel/Cargo.toml b/os/StarryOS/kernel/Cargo.toml index ca4ad8f5d7..e440aa2093 100644 --- a/os/StarryOS/kernel/Cargo.toml +++ b/os/StarryOS/kernel/Cargo.toml @@ -18,9 +18,9 @@ default = ["dynamic_debug"] dev-log = [] kprobe_test = [] ext4 = ["ax-fs-ng/ext4"] -input = ["dep:ax-input", "ax-feat/input"] -ipi = ["ax-feat/ipi"] -memtrack = ["ax-feat/backtrace", "ax-alloc/tracking"] +input = ["dep:ax-input", "ax-runtime/input"] +ipi = ["ax-runtime/ipi"] +memtrack = ["axbacktrace/alloc", "ax-alloc/tracking"] rknpu = ["ax-driver/rknpu", "dep:ax-dma"] jpeg = ["ax-driver/jpeg", "dep:ax-dma"] rk3588-pwm = [ @@ -28,11 +28,11 @@ rk3588-pwm = [ "dep:rdif-pwm", ] std-compat = [] -k230-kpu = ["ax-feat/xuantie-c9xx", "dep:axklib", "dep:k230-kpu"] -vsock = ["ax-feat/vsock"] +k230-kpu = ["ax-hal/xuantie-c9xx", "dep:axklib", "dep:k230-kpu"] +vsock = ["ax-runtime/vsock"] dynamic_debug = ["ipi"] sg2002 = [ - "ax-feat/usb", + "ax-runtime/irq", "ax-driver/usb", "dep:ax-dma", "dep:axklib", @@ -47,35 +47,19 @@ sg2002 = [ # feature on. No direct chip-crate deps needed here anymore. sg2002-wifi = [ "sg2002", - "ax-feat/aic8800-wifi", + "ax-runtime/aic8800", ] -stack-guard-page = ["ax-feat/stack-guard-page"] -stack-protector = ["ax-feat/stack-protector"] +stack-guard-page = ["ax-runtime/stack-guard-page"] +stack-protector = ["ax-runtime/stack-protector"] axtest = [] [dependencies] -ax-feat = { workspace = true, features = [ - "fp-simd", - "irq", - "uspace", - - "multitask", - "task-ext", - "tracepoint-hooks", - "sched-rr", - - "rtc", - - "ext4fs", - "net", -] } - ax-alloc = { workspace = true } ax-crate-interface.workspace = true ax-display.workspace = true ax-fs-ng = { workspace = true, features = ["vfs"] } ax-cpu = { workspace = true, features = ["fp-simd"] } -ax-hal.workspace = true +ax-hal = { workspace = true, features = ["fp-simd", "uspace"] } ax-input = { workspace = true, optional = true } ax-lazyinit.workspace = true ax-log.workspace = true @@ -84,9 +68,21 @@ ax-net = { workspace = true } ax-driver = { workspace = true, features = ["serial", "usb"] } axklib = { workspace = true, optional = true } axplat-dyn.workspace = true -ax-runtime.workspace = true -ax-sync.workspace = true -ax-task.workspace = true +ax-runtime = { workspace = true, features = [ + "irq", + "uspace", + "multitask", + "rtc", + "ext4", + "net", +] } +ax-sync = { workspace = true, features = ["multitask"] } +ax-task = { workspace = true, features = [ + "multitask", + "task-ext", + "tracepoint-hooks", + "rr", +] } ax-dma = { workspace = true, optional = true } sg2002-tpu = { workspace = true, optional = true } k230-kpu = { workspace = true, optional = true } diff --git a/os/StarryOS/kernel/src/pseudofs/lockdep-tmpfs-analysis.md b/os/StarryOS/kernel/src/pseudofs/lockdep-tmpfs-analysis.md index 6399dbf3b4..8596a84315 100644 --- a/os/StarryOS/kernel/src/pseudofs/lockdep-tmpfs-analysis.md +++ b/os/StarryOS/kernel/src/pseudofs/lockdep-tmpfs-analysis.md @@ -283,7 +283,7 @@ stack=[0xffffffc080520000..0xffffffc080524000), expected magic=0x57acce1157acce1 That is no longer a lockdep order report. It points at the 16 KiB primary idle task stack in `os/arceos/modules/axtask/src/run_queue.rs`. Further work should -separate that stack-canary issue from the subclass implementation. +separate that stack canary issue from the subclass implementation. ## Instance identity cleanup @@ -325,7 +325,7 @@ The reproduced failure pattern is: - the test prints the first seven PASS lines through `clone shmget_thread`; - it does not print the final `no deadlock detected` PASS line; - it does not print a lockdep report; -- it does not print a panic or stack-canary diagnostic; +- it does not print a panic or stack canary diagnostic; - the QEMU harness eventually reports `QEMU timed out after 120s`. The relevant C test code is: diff --git a/os/StarryOS/lkm/README.md b/os/StarryOS/lkm/README.md index 6a8c6923e5..41aa50c95b 100644 --- a/os/StarryOS/lkm/README.md +++ b/os/StarryOS/lkm/README.md @@ -60,7 +60,7 @@ from the same crate graph: [dependencies] kmod-tools.workspace = true starry-kernel = { workspace = true, features = [...] } -ax-feat = { workspace = true, features = [...] } +ax-runtime = { workspace = true, features = [...] } ax-std = { workspace = true, features = [...] } ``` @@ -68,7 +68,7 @@ Add lower-level ArceOS crates such as `ax-hal`, `ax-driver`, or `axplat-dyn` only when the module directly uses their APIs. Do not use module features to select a platform path; the kernel build always provides `axplat-dyn`. -Do not depend on a different version of `starry-kernel`, `ax-std`, `ax-feat`, +Do not depend on a different version of `starry-kernel`, `ax-std`, `ax-runtime`, or platform crates. A Rust kmod may contain undefined Rust `core`/`alloc` and kernel symbols that must match the kernel ELF exactly. @@ -87,7 +87,7 @@ example SMP: ```toml [features] default = [] -smp = ["ax-feat/smp", "ax-hal/smp"] +smp = ["ax-runtime/smp", "ax-hal/smp"] ``` The same applies to board and device features. If a module needs a symbol or diff --git a/os/StarryOS/lkm/hello/Cargo.toml b/os/StarryOS/lkm/hello/Cargo.toml index d1c5469ffa..cf63cbe368 100644 --- a/os/StarryOS/lkm/hello/Cargo.toml +++ b/os/StarryOS/lkm/hello/Cargo.toml @@ -10,9 +10,9 @@ categories.workspace = true publish = false [dependencies] -ax-feat = { workspace = true, features = ["ext-ld", "fs-times", "irq"] } ax-driver.workspace = true ax-hal.workspace = true +ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn = { workspace = true, optional = true } starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } @@ -22,13 +22,13 @@ kmod-tools.workspace = true [features] default = [] qemu = [ - "ax-feat/irq", - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/irq", + "ax-runtime/rtc", + "ax-runtime/display", "starry-kernel/input", "starry-kernel/vsock", # auxilary features ] -smp = ["ax-feat/smp", "axplat-dyn?/smp", "ax-hal/smp"] +smp = ["ax-runtime/smp", "axplat-dyn?/smp", "ax-hal/smp"] k230 = [ "starry-kernel/k230-kpu", diff --git a/os/StarryOS/lkm/kprobe_test/Cargo.toml b/os/StarryOS/lkm/kprobe_test/Cargo.toml index c739d7c481..ce36e7627f 100644 --- a/os/StarryOS/lkm/kprobe_test/Cargo.toml +++ b/os/StarryOS/lkm/kprobe_test/Cargo.toml @@ -10,9 +10,9 @@ categories.workspace = true publish = false [dependencies] -ax-feat = { workspace = true, features = ["ext-ld", "fs-times", "irq"] } ax-driver.workspace = true ax-hal.workspace = true +ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn = { workspace = true, optional = true } starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } @@ -24,13 +24,13 @@ kprobe.workspace = true [features] default = [] qemu = [ - "ax-feat/irq", - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/irq", + "ax-runtime/rtc", + "ax-runtime/display", "starry-kernel/input", "starry-kernel/vsock", # auxiliary features ] -smp = ["ax-feat/smp", "axplat-dyn?/smp", "ax-hal/smp"] +smp = ["ax-runtime/smp", "axplat-dyn?/smp", "ax-hal/smp"] k230 = [ "starry-kernel/k230-kpu", diff --git a/os/StarryOS/starryos/Cargo.toml b/os/StarryOS/starryos/Cargo.toml index 6898d6f77e..612f2e688e 100644 --- a/os/StarryOS/starryos/Cargo.toml +++ b/os/StarryOS/starryos/Cargo.toml @@ -16,13 +16,13 @@ version = "0.5.20" [features] default = [] qemu = [ - "ax-feat/irq", - "ax-feat/rtc", - "ax-feat/display", + "ax-runtime/irq", + "ax-runtime/rtc", + "ax-runtime/display", "starry-kernel/input", "starry-kernel/vsock", # auxiliary features ] -smp = ["ax-feat/smp", "axplat-dyn/smp", "ax-hal/smp", "starry-kernel/ipi"] +smp = ["ax-runtime/smp", "axplat-dyn/smp", "ax-hal/smp", "starry-kernel/ipi"] k230 = [ "starry-kernel/k230-kpu", @@ -45,10 +45,10 @@ name = "xtask" path = "xtask/main.rs" [dependencies] -ax-feat = { workspace = true, features = ["ext-ld", "fs-times", "irq"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } ax-driver.workspace = true ax-hal.workspace = true +ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn.workspace = true starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } diff --git a/os/arceos/api/arceos_api/Cargo.toml b/os/arceos/api/arceos_api/Cargo.toml index d8850d25a2..a1ac1eafb1 100644 --- a/os/arceos/api/arceos_api/Cargo.toml +++ b/os/arceos/api/arceos_api/Cargo.toml @@ -10,27 +10,25 @@ license.workspace = true [features] default = [] -irq = ["ax-feat/irq"] -ipi = ["dep:ax-ipi", "ax-feat/ipi"] -alloc = ["dep:ax-alloc", "ax-feat/alloc"] -paging = ["dep:ax-mm", "ax-feat/paging"] -dma = ["dep:ax-dma", "ax-feat/dma"] -multitask = ["ax-task/multitask", "ax-sync/multitask", "ax-feat/multitask"] -stack-guard-page = ["multitask", "paging", "ax-feat/stack-guard-page"] -fs = ["dep:ax-fs-ng", "ax-feat/fs"] -net = ["dep:ax-net", "ax-feat/net"] -display = ["dep:ax-display", "ax-feat/display"] +irq = ["ax-task?/irq"] +ipi = ["dep:ax-ipi"] +alloc = ["dep:ax-alloc"] +paging = ["dep:ax-mm"] +dma = ["dep:ax-dma"] +multitask = ["ax-task/multitask", "ax-sync/multitask"] +fs = ["dep:ax-fs-ng"] +net = ["dep:ax-net"] +display = ["dep:ax-display"] -# Use dummy functions if the feature is not enabled -dummy-if-not-enabled = [] +# Use stub functions if the feature is not enabled. +stubs = [] [dependencies] ax-alloc = { workspace = true, optional = true } ax-display = { workspace = true, optional = true } ax-dma = { workspace = true, optional = true } ax-errno.workspace = true -ax-feat.workspace = true ax-fs-ng = { workspace = true, optional = true } ax-hal.workspace = true ax-io.workspace = true diff --git a/os/arceos/api/arceos_api/src/lib.rs b/os/arceos/api/arceos_api/src/lib.rs index 47522ec15c..bcd1577cfa 100644 --- a/os/arceos/api/arceos_api/src/lib.rs +++ b/os/arceos/api/arceos_api/src/lib.rs @@ -10,7 +10,7 @@ feature = "fs", feature = "net", feature = "multitask", - feature = "dummy-if-not-enabled" + feature = "stubs" ))] extern crate alloc; diff --git a/os/arceos/api/arceos_api/src/macros.rs b/os/arceos/api/arceos_api/src/macros.rs index 7fae100a5e..009a7cb12c 100644 --- a/os/arceos/api/arceos_api/src/macros.rs +++ b/os/arceos/api/arceos_api/src/macros.rs @@ -12,7 +12,7 @@ macro_rules! define_api_type { $(#[$attr])* $vis use $crate::imp::$name; - #[cfg(all(feature = "dummy-if-not-enabled", not(feature = $feature)))] + #[cfg(all(feature = "stubs", not(feature = $feature)))] $(#[$attr])* $vis struct $name; )+ @@ -48,7 +48,7 @@ macro_rules! define_api { } #[allow(unused_variables)] - #[cfg(all(feature = "dummy-if-not-enabled", not(feature = $feature)))] + #[cfg(all(feature = "stubs", not(feature = $feature)))] $(#[$attr])* $vis fn $name( $($arg : $type),* ) $( -> $ret )? { unimplemented!(stringify!($name)) @@ -67,7 +67,7 @@ macro_rules! define_api { } #[allow(unused_variables)] - #[cfg(all(feature = "dummy-if-not-enabled", not(feature = $feature)))] + #[cfg(all(feature = "stubs", not(feature = $feature)))] $(#[$attr])* $vis unsafe fn $name( $($arg : $type),* ) $( -> $ret )? { unimplemented!(stringify!($name)) diff --git a/os/arceos/api/arceos_posix_api/Cargo.toml b/os/arceos/api/arceos_posix_api/Cargo.toml index 2bf6b52961..198f824020 100644 --- a/os/arceos/api/arceos_posix_api/Cargo.toml +++ b/os/arceos/api/arceos_posix_api/Cargo.toml @@ -18,14 +18,14 @@ license.workspace = true [features] default = [] -smp = ["ax-feat/smp"] -irq = ["ax-feat/irq"] -alloc = ["dep:ax-alloc", "ax-feat/alloc"] -multitask = ["alloc", "ax-task/multitask", "ax-feat/multitask", "ax-sync/multitask"] -lockdep = ["multitask", "ax-feat/lockdep", "ax-sync/lockdep", "ax-kspin/lockdep"] +smp = [] +irq = [] +alloc = ["dep:ax-alloc"] +multitask = ["alloc", "ax-task/multitask", "ax-sync/multitask"] +lockdep = ["multitask", "ax-sync/lockdep", "ax-kspin/lockdep"] fd = ["alloc", "dep:scope-local"] -fs = ["dep:ax-fs-ng", "ax-feat/fs", "fd"] -net = ["dep:ax-net", "ax-feat/net", "fd"] +fs = ["dep:ax-fs-ng", "fd"] +net = ["dep:ax-net", "fd"] pipe = ["fd"] select = ["fd"] poll = ["fd"] @@ -34,7 +34,6 @@ epoll = ["fd"] [dependencies] # ArceOS modules ax-alloc = { workspace = true, optional = true } -ax-feat.workspace = true ax-fs-ng = { workspace = true, optional = true } ax-hal.workspace = true ax-kspin.workspace = true diff --git a/os/arceos/api/axfeat/CHANGELOG.md b/os/arceos/api/axfeat/CHANGELOG.md deleted file mode 100644 index d74fb80332..0000000000 --- a/os/arceos/api/axfeat/CHANGELOG.md +++ /dev/null @@ -1,106 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.5.24](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.23...ax-feat-v0.5.24) - 2026-07-02 - -### Other - -- *(ax-runtime)* resolve device IRQ bindings to IrqId - -## [0.5.23](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.22...ax-feat-v0.5.23) - 2026-06-27 - -### Fixed - -- *(locking)* remove spin mutex usage from kernel paths ([#1380](https://github.com/rcore-os/tgoskits/pull/1380)) - -### Other - -- *(platform)* remove ax-config from dynamic runtime path ([#1387](https://github.com/rcore-os/tgoskits/pull/1387)) - -## [0.5.22](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.21...ax-feat-v0.5.22) - 2026-06-23 - -### Other - -- updated the following local packages: ax-hal, ax-net, ax-runtime, ax-kspin, axbacktrace, ax-alloc, ax-driver, ax-ipi, ax-task, ax-sync, ax-display, ax-fs-ng, ax-input, ax-log - -## [0.5.21](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.20...ax-feat-v0.5.21) - 2026-06-22 - -### Added - -- *(axruntime)* add compiler-backed stack protector support ([#1239](https://github.com/rcore-os/tgoskits/pull/1239)) -- AIC8800 Wi-Fi SoftAP for SG2002 (LicheeRV Nano) ([#1185](https://github.com/rcore-os/tgoskits/pull/1185)) - -### Other - -- *(ax-runtime)* adapt submit-poll fs block irq registration ([#1228](https://github.com/rcore-os/tgoskits/pull/1228)) - -## [0.5.20](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.19...ax-feat-v0.5.20) - 2026-06-12 - -### Added - -- *(axruntime)* add runtime IRQ registration adapters - -### Other - -- *(ax-net)* unify network stack into single net/ax-net crate, r… ([#1203](https://github.com/rcore-os/tgoskits/pull/1203)) - -## [0.5.19](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.18...ax-feat-v0.5.19) - 2026-06-11 - -### Other - -- updated the following local packages: ax-alloc, ax-driver, ax-config, ax-hal, ax-task, ax-fs-ng, ax-ipi, ax-sync, ax-display, ax-fs, ax-input, ax-net-ng, ax-net, ax-runtime - -## [0.5.18](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.17...ax-feat-v0.5.18) - 2026-06-09 - -### Added - -- *(starry-kernel)* eBPF kernel runtime (tracepoint / kprobe / perf) ([#886](https://github.com/rcore-os/tgoskits/pull/886)) - -## [0.5.17](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.16...ax-feat-v0.5.17) - 2026-06-03 - -### Added - -- *(starryos)* expose K230 KPU device ([#1054](https://github.com/rcore-os/tgoskits/pull/1054)) -- *(riscv64)* support dynamic platform on QEMU and SG2002 ([#961](https://github.com/rcore-os/tgoskits/pull/961)) -- *(axtask)* add task stack guard page support ([#811](https://github.com/rcore-os/tgoskits/pull/811)) - -### Other - -- *(platform)* remove static aarch64 platforms ([#1074](https://github.com/rcore-os/tgoskits/pull/1074)) -- *(linker)* layer platform runtime and final scripts ([#1075](https://github.com/rcore-os/tgoskits/pull/1075)) -- *(rdif-block)* switch block drivers to submit poll ([#976](https://github.com/rcore-os/tgoskits/pull/976)) -- *(ax-alloc)* remove ax-allocator dependency, simplify to TLSF/buddy-slab backends ([#987](https://github.com/rcore-os/tgoskits/pull/987)) -- *(axruntime)* remove alloc feature, make it unconditional ([#985](https://github.com/rcore-os/tgoskits/pull/985)) -- *(starry)* route HAL access through ax-runtime ([#963](https://github.com/rcore-os/tgoskits/pull/963)) -- *(drivers)* split shared driver stack from ArceOS ([#831](https://github.com/rcore-os/tgoskits/pull/831)) -- Refactor workspace structure and update dependencies ([#864](https://github.com/rcore-os/tgoskits/pull/864)) - -## [0.5.16](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.15...ax-feat-v0.5.16) - 2026-05-22 - -### Added - -- *(axplat-aarch64)* GICv3 + CNTV backend for Apple HVF native execution ([#511](https://github.com/rcore-os/tgoskits/pull/511)) - -## [0.5.15](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.14...ax-feat-v0.5.15) - 2026-05-19 - -### Other - -- updated the following local packages: ax-alloc, ax-driver, ax-task, ax-hal, ax-sync, ax-display, ax-fs, ax-fs-ng, ax-input, ax-ipi, ax-net, ax-runtime - -## [0.5.14](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.13...ax-feat-v0.5.14) - 2026-05-15 - -### Other - -- updated the following local packages: axbacktrace, ax-kspin, ax-alloc, ax-config, ax-hal, ax-sync, ax-fs, ax-fs-ng, ax-log, ax-net, ax-driver, ax-task, ax-display, ax-input, ax-ipi, ax-runtime - -## [0.5.12](https://github.com/rcore-os/tgoskits/compare/ax-feat-v0.5.11...ax-feat-v0.5.12) - 2026-04-27 - -### Other - -- updated the following local packages: ax-alloc diff --git a/os/arceos/api/axfeat/Cargo.toml b/os/arceos/api/axfeat/Cargo.toml deleted file mode 100644 index ece28c361e..0000000000 --- a/os/arceos/api/axfeat/Cargo.toml +++ /dev/null @@ -1,122 +0,0 @@ -[package] -name = "ax-feat" -version = "0.5.24" -repository = "https://github.com/rcore-os/tgoskits" -edition.workspace = true -authors = ["Yuekai Jia "] -description = "Top-level feature selection for ArceOS" -license.workspace = true - -[features] -default = ["alloc"] - -# Multicore -smp = ["ax-hal/smp", "ax-runtime/smp", "ax-task?/smp", "ax-kspin/smp"] - -# Floating point/SIMD -fp-simd = ["ax-hal/fp-simd"] -xuantie-c9xx = ["ax-hal/xuantie-c9xx"] - -# User space support -uspace = ["ax-hal/uspace", "ax-task?/uspace"] -hv = ["ax-hal/hv"] - -# Interrupts -irq = ["ax-hal/irq", "ax-runtime/irq", "ax-task?/irq", "ax-driver?/irq"] -ipi = ["irq", "dep:ax-ipi", "ax-hal/ipi", "ax-runtime/ipi", "ax-task?/ipi"] -wake-ipi = ["irq", "ax-hal/ipi", "ax-runtime/wake-ipi"] - -ext-ld = ["ax-runtime/ext-ld"] - -# Memory -alloc = ["ax-alloc"] -paging = ["ax-hal/paging", "ax-runtime/paging"] -tls = ["ax-hal/tls", "ax-runtime/tls", "ax-task?/tls"] -dma = ["paging"] - -# Multi-threading and scheduler -multitask = [ - "ax-task/multitask", - "ax-sync/multitask", - "ax-runtime/multitask", -] -lockdep = [ - "multitask", - "ax-sync/lockdep", - "ax-kspin/lockdep", - "ax-fs-ng?/lockdep", -] -task-ext = ["ax-task/task-ext"] -tracepoint-hooks = ["ax-task/tracepoint-hooks"] -sched-fifo = ["ax-task/sched-fifo"] -sched-rr = ["ax-task/sched-rr", "irq"] -sched-cfs = ["ax-task/sched-cfs", "irq"] -stack-guard-page = [ - "ipi", - "multitask", - "paging", - "ax-task/stack-guard-page", - "ax-runtime/stack-guard-page", -] -stack-protector = ["ax-runtime/stack-protector"] - -# File system -fs = [ - "paging", - "dep:ax-fs-ng", - "ax-runtime/fs", -] # TODO: try to remove "paging" -ext4fs = ["fs", "ax-fs-ng/ext4", "ax-runtime/fs-ext4"] -fatfs = ["fs", "ax-fs-ng/fat", "ax-runtime/fs-fat"] -fs-times = ["fs", "ax-fs-ng/times"] - -# Networking -net = [ - "paging", - "irq", - "multitask", - "dep:ax-net", - "ax-runtime/net", -] -aic8800-wifi = ["net", "ax-runtime/aic8800-wifi"] -vsock = ["ax-runtime/vsock"] - -# Display -display = [ - "paging", - "dep:ax-display", - "ax-runtime/display", -] - -# Input -input = [ - "paging", - "dep:ax-input", - "ax-runtime/input", -] - -# USB -usb = ["irq", "ax-driver?/usb"] - -# Real Time Clock (RTC) Driver. -rtc = ["ax-hal/rtc", "ax-runtime/rtc"] - -# Backtrace -backtrace = ["axbacktrace/alloc"] -dwarf = ["axbacktrace/dwarf"] - -[dependencies] -ax-alloc = { workspace = true, optional = true } -axbacktrace.workspace = true -ax-driver = { workspace = true, optional = true } -ax-display = { workspace = true, optional = true } -ax-fs-ng = { workspace = true, optional = true } -ax-hal.workspace = true -ax-input = { workspace = true, optional = true } -ax-ipi = { workspace = true, optional = true } -ax-log.workspace = true -ax-net = { workspace = true, optional = true } -ax-runtime.workspace = true -ax-sync = { workspace = true, optional = true } -ax-task = { workspace = true, optional = true } -ax-kspin = { workspace = true, optional = true } diff --git a/os/arceos/api/axfeat/src/lib.rs b/os/arceos/api/axfeat/src/lib.rs deleted file mode 100644 index 603b3e4fff..0000000000 --- a/os/arceos/api/axfeat/src/lib.rs +++ /dev/null @@ -1,30 +0,0 @@ -//! Top-level feature selection for [ArceOS]. -//! -//! # Cargo Features -//! -//! - CPU -//! - `smp`: Enable SMP (symmetric multiprocessing) support. -//! - `fp-simd`: Enable floating point and SIMD support. -//! - Interrupts: -//! - `irq`: Enable interrupt handling support. -//! - `ipi`: Enable Inter-Processor Interrupts (IPIs). -//! - Memory -//! - `alloc`: Enable dynamic memory allocation. -//! - `paging`: Enable page table manipulation. -//! - `tls`: Enable thread-local storage. -//! - Task management -//! - `multitask`: Enable multi-threading support. -//! - `sched-fifo`: Use the FIFO cooperative scheduler. -//! - `sched-rr`: Use the Round-robin preemptive scheduler. -//! - `sched-cfs`: Use the Completely Fair Scheduler (CFS) preemptive scheduler. -//! - `stack-protector`: Enable compiler-inserted stack frame canary checks. -//! - Upperlayer stacks (fs, net, display) -//! - `fs`: Enable file system support. -//! - `net`: Enable networking support. -//! - `display`: Enable graphics support. -//! - Device drivers are selected directly through `ax-driver/*` features by -//! board configurations. -//! -//! [ArceOS]: https://github.com/arceos-org/arceos - -#![no_std] diff --git a/os/arceos/doc/build.md b/os/arceos/doc/build.md index 0466e17166..2c42f3f8b7 100644 --- a/os/arceos/doc/build.md +++ b/os/arceos/doc/build.md @@ -18,11 +18,11 @@ What happens when "make A=examples/httpserver ARCH=riscv64 LOG=info NET=y SMP=1 - `_cargo_build`: The `_cargo_build` method is defined in cargo.mk. Different compilation methods are selected based on the language. For example, for Rust, when `cargo_build,--manifest-path $(APP)/Cargo.toml` is called, where $(APP) represents the current application to be run. - Taking httpserver as an example, let's see how ArceOS are conditionally compiled. First, in the `Cargo.toml` file of httpserver, the dependency is specified as: `ax-std = { workspace = true, features = ["paging", "multitask", "net"] }`. This indicates that ax-std needs to be compiled and has the three features mentioned above. - After checking ax-std, the following three features were found: - - `paging = ["ax-feat/paging"]` - - `multitask = ["ax-api/multitask", "ax-feat/multitask"]` - - `net = ["ax-api/net", "ax-feat/net"]` + - `paging = ["ax-runtime/paging"]` + - `multitask = ["ax-api/multitask", "ax-runtime/multitask"]` + - `net = ["ax-api/net", "ax-runtime/net"]` - This involves modules such as ax-api, ax-feat, and their dependencies like axtask, ax-net, etc., and conditional compilation is performed on these modules. + This involves modules such as ax-api, ax-runtime, and their dependencies like axtask, ax-net, etc., and conditional compilation is performed on these modules. - The above are some modules required for compilation, next we will look at how to perform conditional compilation. The `cargo.mk` file describes how to use the cargo method for conditional compilation, with the following build parameters: ``` build_args := \ diff --git a/os/arceos/doc/figures/ArceOS.svg b/os/arceos/doc/figures/ArceOS.svg index 613ff0efb3..eb1ed36228 100644 --- a/os/arceos/doc/figures/ArceOS.svg +++ b/os/arceos/doc/figures/ArceOS.svg @@ -1,4 +1,4 @@ -
ArceOS modules
ArceOS modules
ArceOS crates
ArceOS crates
User Apps
User Apps
Hypervisor
Hypervisor
axnet
axnet
axtask
axtask
axconfig
axconfig
ax-runtime
ax-runtime
axhal
axhal
axdriver
axdriver
allocator
allocator
ax-alloc
ax-alloc
scheduler
scheduler
page_table
page_table
linked_list
linked_list
driver_blk
driver_blk
axasync
axasync
smoltcp
smoltcp
buddy
buddy
slab
slab
FIFO
FIFO
CFS
CFS
ixgbe
ixgbe
lwip_rust
lwip_rust
driver_virtio
driver_virtio
driver_net
driver_net
ax-fs
ax-fs
ax-page-table-entry
ax-page-table-entry
ArceOS API
ArceOS API
ax-posix-api
ax-posix-api
arceos_rust_api
arceos_rust_api
ArceOS ulib
ArceOS ulib
ax-std
ax-std
axlibc
axlibc
rust std
rust std
Rust App
Rust App
C App
C App
Rust std App
Rust std App
C App
C App
musl libc
musl libc
ax-feat
ax-feat
feature selection
feature selection
Text is not SVG - cannot display
\ No newline at end of file +
ArceOS modules
ArceOS modules
ArceOS crates
ArceOS crates
User Apps
User Apps
Hypervisor
Hypervisor
axnet
axnet
axtask
axtask
axconfig
axconfig
ax-runtime
ax-runtime
axhal
axhal
axdriver
axdriver
allocator
allocator
ax-alloc
ax-alloc
scheduler
scheduler
page_table
page_table
linked_list
linked_list
driver_blk
driver_blk
axasync
axasync
smoltcp
smoltcp
buddy
buddy
slab
slab
FIFO
FIFO
CFS
CFS
ixgbe
ixgbe
lwip_rust
lwip_rust
driver_virtio
driver_virtio
driver_net
driver_net
ax-fs
ax-fs
ax-page-table-entry
ax-page-table-entry
ArceOS API
ArceOS API
ax-posix-api
ax-posix-api
arceos_rust_api
arceos_rust_api
ArceOS ulib
ArceOS ulib
ax-std
ax-std
axlibc
axlibc
rust std
rust std
Rust App
Rust App
C App
C App
Rust std App
Rust std App
C App
C App
musl libc
musl libc
ax-runtime
ax-runtime
feature selection
feature selection
Text is not SVG - cannot display
\ No newline at end of file diff --git a/os/arceos/modules/axfs-ng/Cargo.toml b/os/arceos/modules/axfs-ng/Cargo.toml index 90589bf5d5..927ea861e2 100644 --- a/os/arceos/modules/axfs-ng/Cargo.toml +++ b/os/arceos/modules/axfs-ng/Cargo.toml @@ -12,8 +12,6 @@ fat = ["dep:fatfs"] ext4 = ["dep:rsext4"] vfs = [] lockdep = ["axfs-ng-vfs/lockdep"] -times = [] -std = [] [dependencies] ax-errno = { workspace = true } diff --git a/os/arceos/modules/axfs-ng/src/file/handle.rs b/os/arceos/modules/axfs-ng/src/file/handle.rs index c6f6f0879c..780d05a1b1 100644 --- a/os/arceos/modules/axfs-ng/src/file/handle.rs +++ b/os/arceos/modules/axfs-ng/src/file/handle.rs @@ -168,7 +168,6 @@ pub struct File { inner: FileBackend, flags: AtomicU8, position: Option>, - #[cfg(feature = "times")] access_flags: AtomicU8, } @@ -190,7 +189,6 @@ impl File { inner, flags: AtomicU8::new(flags.bits()), position, - #[cfg(feature = "times")] access_flags: AtomicU8::new(0), } } @@ -287,10 +285,7 @@ impl File { /// Reads data from the current position, advancing the cursor. pub fn read(&self, dst: impl Write + IoBufMut) -> ax_io::Result { - #[cfg(feature = "times")] - { - self.access_flags.fetch_or(1, Ordering::AcqRel); - } + self.access_flags.fetch_or(1, Ordering::AcqRel); if let Some(pos) = self.position.as_ref() { let mut pos = pos.lock(); self.read_at(dst, *pos).inspect(|n| { @@ -303,10 +298,7 @@ impl File { /// Writes data at the current position (or appends), advancing the cursor. pub fn write(&self, src: impl Read + IoBuf) -> ax_io::Result { - #[cfg(feature = "times")] - { - self.access_flags.fetch_or(3, Ordering::AcqRel); - } + self.access_flags.fetch_or(3, Ordering::AcqRel); // WRITE bit is mandatory for any write path, regardless of whether // APPEND is set. Otherwise O_RDONLY|O_APPEND fd would silently // succeed writes (since access(APPEND) only checks the APPEND bit). @@ -386,7 +378,6 @@ impl FsPollable for File { } } -#[cfg(feature = "times")] impl Drop for File { fn drop(&mut self) { let flags = self.access_flags.load(Ordering::Acquire); diff --git a/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/inode.rs b/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/inode.rs index b4f3662b5c..ea552b1fb9 100644 --- a/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/inode.rs +++ b/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/inode.rs @@ -90,9 +90,7 @@ impl Inode { ino: InodeNumber, ) -> VfsResult<()> { fs.modify_inode(dev, ino, |inode| { - if cfg!(feature = "times") { - inode.i_ctime = crate::os::wall_time().as_secs() as u32; - } + inode.i_ctime = crate::os::wall_time().as_secs() as u32; }) .map_err(into_vfs_err) } @@ -159,9 +157,7 @@ impl NodeOps for Inode { if let Some(mtime) = update.mtime { inode.i_mtime = mtime.as_secs() as u32; } - if cfg!(feature = "times") { - inode.i_ctime = crate::os::wall_time().as_secs() as u32; - } + inode.i_ctime = crate::os::wall_time().as_secs() as u32; }) .map_err(into_vfs_err)?; } diff --git a/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/mod.rs b/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/mod.rs index 7ac597e87c..e23e758c1f 100644 --- a/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/mod.rs +++ b/os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/mod.rs @@ -80,11 +80,7 @@ impl BlockDevice for Ext4Disk { } fn current_time(&self) -> Ext4Result { - if cfg!(feature = "times") { - let dur = crate::os::wall_time(); - Ok(Ext4Timestamp::new(dur.as_secs() as i64, dur.subsec_nanos())) - } else { - Ok(Ext4Timestamp::new(0, 0)) - } + let dur = crate::os::wall_time(); + Ok(Ext4Timestamp::new(dur.as_secs() as i64, dur.subsec_nanos())) } } diff --git a/os/arceos/modules/axruntime/Cargo.toml b/os/arceos/modules/axruntime/Cargo.toml index 39a644bf8f..4183f8aad6 100644 --- a/os/arceos/modules/axruntime/Cargo.toml +++ b/os/arceos/modules/axruntime/Cargo.toml @@ -10,10 +10,9 @@ version = "0.9.0" [features] default = [] -dma = ["paging"] ext-ld = [] std-compat = [] -ipi = ["dep:ax-ipi"] +ipi = ["irq", "dep:ax-ipi", "ax-hal/ipi", "ax-task?/ipi"] # Register a lightweight IPI IRQ handler that only acknowledges SGIs so idle # CPUs can wake and re-enter the scheduler. This intentionally does not enable # the ax-ipi callback queue. @@ -23,43 +22,50 @@ irq = [ "ax-task?/irq", "dep:ax-kspin", "dep:ax-percpu", - "dep:axklib", "dep:rdif-intc", "ax-driver/irq", ] multitask = ["ax-task/multitask"] -paging = ["ax-hal/paging", "dep:ax-mm", "dep:axklib"] +paging = ["ax-hal/paging", "dep:ax-mm"] rtc = ["ax-hal/rtc", "ax-driver/rtc"] smp = ["ax-hal/smp", "ax-task?/smp"] -stack-guard-page = ["multitask", "paging", "ax-task/stack-guard-page"] +uspace = ["ax-hal/uspace", "ax-task?/uspace"] +lockdep = ["ax-fs-ng?/lockdep"] +stack-guard-page = ["ipi", "multitask", "paging", "ax-task?/stack-guard-page"] stack-protector = [] tls = ["ax-hal/tls", "ax-task?/tls"] -display = ["dep:ax-display", "ax-driver/display"] +display = ["paging", "dep:ax-display", "ax-driver/display"] fs = [ "irq", "multitask", - "dma", + "paging", "dep:ax-errno", "dep:ax-fs-ng", "ax-fs-ng/vfs", "dep:axfs-ng-vfs", "dep:spin", - "dep:axklib", "dep:dma-api", "dep:rdif-block", "ax-driver/block", ] -fs-ext4 = ["fs", "ax-fs-ng/ext4"] -fs-fat = ["fs", "ax-fs-ng/fat"] -input = ["dep:ax-input", "ax-driver/input"] -net = ["dep:ax-net", "dep:rd-net", "dep:spin", "dep:axklib", "ax-driver/net"] +ext4 = ["fs", "ax-fs-ng/ext4"] +fat = ["fs", "ax-fs-ng/fat"] +input = ["paging", "dep:ax-input", "ax-driver/input"] +net = [ + "irq", + "multitask", + "paging", + "dep:ax-net", + "dep:rd-net", + "dep:spin", + "ax-driver/net", +] # SG2002 AIC8800 SoftAP Wi-Fi. Pulls the FDT probe into ax-driver and installs # the ArceOS runtime glue (the driver cores are OS-independent) before probing. -aic8800-wifi = [ +aic8800 = [ "net", - "multitask", - "ax-driver/aic8800-wifi", + "ax-driver/aic8800", "dep:aic8800", "dep:sdhci-cv1800", ] @@ -89,7 +95,7 @@ ax-percpu = {workspace = true, optional = true} ax-plat = {workspace = true} ax-task = {workspace = true, optional = true} axbacktrace = {workspace = true} -axklib = {workspace = true, optional = true} +axklib.workspace = true axpanic = {workspace = true} cfg-if = {workspace = true} chrono = {version = "0.4", default-features = false} diff --git a/os/arceos/modules/axruntime/src/lib.rs b/os/arceos/modules/axruntime/src/lib.rs index 43092295f5..e760db8e6a 100644 --- a/os/arceos/modules/axruntime/src/lib.rs +++ b/os/arceos/modules/axruntime/src/lib.rs @@ -50,7 +50,6 @@ mod stack_protector; #[cfg(feature = "smp")] mod mp; -#[cfg(any(feature = "irq", feature = "paging"))] mod klib; mod devices; @@ -62,7 +61,7 @@ mod registers; #[cfg(all(feature = "net", feature = "fs"))] mod unix_ns; -#[cfg(feature = "aic8800-wifi")] +#[cfg(feature = "aic8800")] mod wifi_glue; pub use ax_hal as hal; @@ -292,7 +291,7 @@ pub fn rust_main(cpu_id: usize, arg: usize) -> ! { // brings the chip up and that needs timing/task capabilities. The cores // declare no ArceOS dependency themselves; this is the adapter layer (see // `wifi_glue`). - #[cfg(feature = "aic8800-wifi")] + #[cfg(feature = "aic8800")] wifi_glue::install_runtime(); devices::probe_all_devices(); diff --git a/os/arceos/modules/axtask/Cargo.toml b/os/arceos/modules/axtask/Cargo.toml index 9c9050b789..3dcad843fd 100644 --- a/os/arceos/modules/axtask/Cargo.toml +++ b/os/arceos/modules/axtask/Cargo.toml @@ -13,7 +13,6 @@ default = [] irq = ["ax-hal/irq", "dep:ax-timer-list"] ipi = ["irq", "ax-hal/ipi", "dep:ax-ipi"] multitask = [ - "stack-canary", "dep:axpoll", "dep:ax-sched", "dep:ax-cpumask", @@ -28,7 +27,6 @@ multitask = [ ] preempt = ["irq", "ax-percpu?/preempt", "ax-kernel-guard/preempt"] smp = ["ax-kspin/smp"] -stack-canary = [] stack-guard-page = ["multitask", "dep:ax-alloc", "dep:ax-mm", "ax-hal/paging"] lockdep = [ "multitask", @@ -46,9 +44,8 @@ tls = ["ax-hal/tls"] tracepoint-hooks = ["multitask"] uspace = ["ax-hal/uspace"] -sched-cfs = ["multitask", "preempt"] -sched-fifo = ["multitask"] -sched-rr = ["multitask", "preempt"] +cfs = ["multitask", "preempt"] +rr = ["multitask", "preempt"] host-test = [ "ax-hal/host-test", diff --git a/os/arceos/modules/axtask/README.md b/os/arceos/modules/axtask/README.md index 5072da3d52..e94d2f5f28 100644 --- a/os/arceos/modules/axtask/README.md +++ b/os/arceos/modules/axtask/README.md @@ -14,9 +14,9 @@ by cargo features. - `multitask`: Enable multi-task support with complex scheduling and more task-related APIs. - `irq`: Enable timer-based APIs such as `sleep`, `sleep_until`, and `WaitQueue::wait_timeout`. - `preempt`: Enable preemptive scheduling. -- `sched-fifo`: Use the FIFO cooperative scheduler (enables `multitask`). -- `sched-rr`: Use the Round-robin preemptive scheduler (enables `multitask` and `preempt`). -- `sched-cfs`: Use the Completely Fair Scheduler (enables `multitask` and `preempt`). +- FIFO cooperative scheduler is the default when no scheduler feature is selected. +- `rr`: Use the Round-robin preemptive scheduler (enables `multitask` and `preempt`). +- `cfs`: Use the Completely Fair Scheduler (enables `multitask` and `preempt`). - `tls`: Enable kernel space thread-local storage support. - `smp`: Enable SMP (symmetric multiprocessing) support. diff --git a/os/arceos/modules/axtask/src/api.rs b/os/arceos/modules/axtask/src/api.rs index d44f9960e8..c02c540a41 100644 --- a/os/arceos/modules/axtask/src/api.rs +++ b/os/arceos/modules/axtask/src/api.rs @@ -46,11 +46,11 @@ pub fn default_task_stack_size() -> usize { } cfg_if::cfg_if! { - if #[cfg(feature = "sched-rr")] { + if #[cfg(feature = "rr")] { const MAX_TIME_SLICE: usize = 5; pub(crate) type AxTask = ax_sched::RRTask; pub(crate) type Scheduler = ax_sched::RRScheduler; - } else if #[cfg(feature = "sched-cfs")] { + } else if #[cfg(feature = "cfs")] { pub(crate) type AxTask = ax_sched::CFSTask; pub(crate) type Scheduler = ax_sched::CFScheduler; } else { diff --git a/os/arceos/modules/axtask/src/lib.rs b/os/arceos/modules/axtask/src/lib.rs index 59dc2cb7a6..791cad2980 100644 --- a/os/arceos/modules/axtask/src/lib.rs +++ b/os/arceos/modules/axtask/src/lib.rs @@ -13,12 +13,11 @@ //! APIs can be used, such as [`sleep`], [`sleep_until`], and //! [`WaitQueue::wait_timeout`]. //! - `preempt`: Enable preemptive scheduling. -//! - `sched-fifo`: Use the [FIFO cooperative scheduler][1]. It also enables the -//! `multitask` feature if it is enabled. This feature is enabled by default, -//! and it can be overridden by other scheduler features. -//! - `sched-rr`: Use the [Round-robin preemptive scheduler][2]. It also enables +//! - FIFO cooperative scheduler is the default when no scheduler feature is +//! selected. +//! - `rr`: Use the [Round-robin preemptive scheduler][2]. It also enables //! the `multitask` and `preempt` features if it is enabled. -//! - `sched-cfs`: Use the [Completely Fair Scheduler][3]. It also enables the +//! - `cfs`: Use the [Completely Fair Scheduler][3]. It also enables the //! the `multitask` and `preempt` features if it is enabled. //! - `host-test`: Use host-safe fallbacks for unit tests. //! diff --git a/os/arceos/modules/axtask/src/run_queue.rs b/os/arceos/modules/axtask/src/run_queue.rs index a1daea1383..c9d96f455c 100644 --- a/os/arceos/modules/axtask/src/run_queue.rs +++ b/os/arceos/modules/axtask/src/run_queue.rs @@ -963,7 +963,6 @@ impl AxRunQueue { prev_task.id_name(), next_task.id_name() ); - #[cfg(feature = "stack-canary")] prev_task.check_stack_canary(); #[cfg(feature = "preempt")] next_task.set_preempt_pending(false); diff --git a/os/arceos/modules/axtask/src/task.rs b/os/arceos/modules/axtask/src/task.rs index ff15ec8c0d..8f455bac81 100644 --- a/os/arceos/modules/axtask/src/task.rs +++ b/os/arceos/modules/axtask/src/task.rs @@ -28,9 +28,9 @@ use futures_util::task::AtomicWaker; use crate::lockdep::HeldLockStack; use crate::{AxCpuMask, AxTask, AxTaskRef, WaitQueue}; -#[cfg(all(feature = "stack-canary", target_pointer_width = "64"))] +#[cfg(target_pointer_width = "64")] const STACK_END_MAGIC: usize = 0x57AC_CE11_57AC_CE11usize; -#[cfg(all(feature = "stack-canary", target_pointer_width = "32"))] +#[cfg(target_pointer_width = "32")] const STACK_END_MAGIC: usize = 0x57AC_CE11usize; /// Required alignment for task kernel stacks. x86_64 task context setup relies @@ -582,7 +582,6 @@ impl TaskInner { self.ctx.get() } - #[cfg(feature = "stack-canary")] #[inline] pub(crate) fn check_stack_canary(&self) { if self.kstack.is_canary_intact() { @@ -683,10 +682,7 @@ impl TaskStack { align, kind: TaskStackKind::Alloc, }; - #[cfg(feature = "stack-canary")] - unsafe { - stack.write_canary() - }; + unsafe { stack.write_canary() }; stack } @@ -708,10 +704,7 @@ impl TaskStack { kind: TaskStackKind::GuardedAlloc, }; stack.unmap_guard_page(); - #[cfg(feature = "stack-canary")] - unsafe { - stack.write_canary() - }; + unsafe { stack.write_canary() }; stack } @@ -728,14 +721,10 @@ impl TaskStack { alloc_pages: 0, kind: TaskStackKind::Borrowed, }; - #[cfg(feature = "stack-canary")] - unsafe { - stack.write_canary() - }; + unsafe { stack.write_canary() }; stack } - #[cfg(feature = "stack-canary")] #[inline] pub fn bottom(&self) -> VirtAddr { VirtAddr::from(self.ptr) @@ -793,24 +782,21 @@ impl TaskStack { } #[inline] - #[cfg(feature = "stack-canary")] fn canary_ptr(&self) -> *mut usize { self.ptr as *mut usize } #[inline] - #[cfg(feature = "stack-canary")] unsafe fn write_canary(&self) { unsafe { self.canary_ptr().write(STACK_END_MAGIC) }; } #[inline] - #[cfg(feature = "stack-canary")] pub fn is_canary_intact(&self) -> bool { unsafe { self.canary_ptr().read() == STACK_END_MAGIC } } - #[cfg(all(test, feature = "stack-canary", not(feature = "stack-guard-page")))] + #[cfg(all(test, not(feature = "stack-guard-page")))] fn corrupt_canary_for_test(&self) { unsafe { self.canary_ptr().write(0) }; } @@ -913,7 +899,7 @@ impl Drop for TaskStack { mod stack_tests { use super::{TASK_STACK_ALIGN, TaskStack}; - #[cfg(all(feature = "stack-canary", not(feature = "stack-guard-page")))] + #[cfg(not(feature = "stack-guard-page"))] #[test] fn task_stack_canary_detects_corruption() { let stack = TaskStack::alloc(0x1000); @@ -924,7 +910,7 @@ mod stack_tests { assert!(!stack.is_canary_intact()); } - #[cfg(all(feature = "stack-canary", not(feature = "stack-guard-page")))] + #[cfg(not(feature = "stack-guard-page"))] #[cfg(target_arch = "x86_64")] #[test] fn task_stack_top_stays_16_byte_aligned() { diff --git a/os/arceos/modules/axtask/src/tests.rs b/os/arceos/modules/axtask/src/tests.rs index f7be771281..02792541e4 100644 --- a/os/arceos/modules/axtask/src/tests.rs +++ b/os/arceos/modules/axtask/src/tests.rs @@ -218,7 +218,7 @@ fn test_sched_fifo() { for i in 0..NUM_TASKS { tasks.push(ax_task::spawn_raw( move || { - println!("sched-fifo: Hello, task {}! ({})", i, current().id_name()); + println!("multitask: Hello, task {}! ({})", i, current().id_name()); ax_task::yield_now(); let order = FINISHED_TASKS.fetch_add(1, Ordering::Release); assert_eq!(order, i); // FIFO scheduler diff --git a/os/arceos/scripts/make/build.mk b/os/arceos/scripts/make/build.mk index 7e76b850c6..b037ab21d5 100644 --- a/os/arceos/scripts/make/build.mk +++ b/os/arceos/scripts/make/build.mk @@ -24,7 +24,7 @@ else ifneq ($(filter $(or $(MAKECMDGOALS), $(.DEFAULT_GOAL)), all build run just $(info APP: "$(APP)") $(info APP_TYPE: "$(APP_TYPE)") $(info FEATURES: "$(FEATURES)") - $(info arceos features: "$(AX_FEAT)") + $(info arceos features: "$(AX_FEATURES)") $(info lib features: "$(LIB_FEAT)") $(info app features: "$(APP_FEAT)") endif @@ -47,11 +47,11 @@ endif _cargo_build: @printf " $(GREEN_C)Building$(END_C) App: $(APP_NAME), Arch: $(ARCH), App type: $(APP_TYPE)\n" ifeq ($(APP_TYPE), rust) - $(call cargo_build,$(APP),$(AX_FEAT) $(LIB_FEAT) $(APP_FEAT)) + $(call cargo_build,$(APP),$(AX_FEATURES) $(LIB_FEAT) $(APP_FEAT)) @cp $(rust_elf) $(OUT_ELF) else ifeq ($(APP_TYPE), c) $(call run_cmd,touch,api/arceos_posix_api/build.rs) - $(call cargo_build,ulib/axlibc,$(AX_FEAT) $(LIB_FEAT)) + $(call cargo_build,ulib/axlibc,$(AX_FEATURES) $(LIB_FEAT)) endif $(OUT_DIR): diff --git a/os/arceos/scripts/make/cargo.mk b/os/arceos/scripts/make/cargo.mk index 7032cbfa91..b21074897d 100644 --- a/os/arceos/scripts/make/cargo.mk +++ b/os/arceos/scripts/make/cargo.mk @@ -41,7 +41,7 @@ endef all_packages := \ $(filter-out axplat-dyn,$(shell ls $(CURDIR)/modules)) \ - ax-feat ax-api ax-std ax-libc + ax-api ax-std ax-libc define cargo_doc $(call run_cmd,cargo doc,--no-deps --all-features --workspace --exclude "arceos-*" --exclude axplat-dyn $(verbose)) diff --git a/os/arceos/scripts/make/features.mk b/os/arceos/scripts/make/features.mk index 63d2941242..4df514a69a 100644 --- a/os/arceos/scripts/make/features.mk +++ b/os/arceos/scripts/make/features.mk @@ -2,24 +2,20 @@ # # Inputs: # - `FEATURES`: a list of features to be enabled split by spaces or commas. -# The features can be selected from the crate `ax-feat` or the user library -# (crate `ax-std` or `ax-libc`). +# The features can be selected from the user library (crate `ax-std` or +# `ax-libc`) or by direct crate feature paths. # - `APP_FEATURES`: a list of features to be enabled for the Rust app. # # Outputs: -# - `AX_FEAT`: features to be enabled for ArceOS modules (crate `ax-feat`). +# - `AX_FEATURESURES`: resolved ArceOS user-library or direct crate features. # - `LIB_FEAT`: features to be enabled for the user library (crate `ax-std`, `ax-libc`). # - `APP_FEAT`: features to be enabled for the Rust app. ifeq ($(APP_TYPE),c) - ax_feat_prefix := ax-feat/ + arceos_feature_prefix := ax-libc/ lib_features := fp-simd irq alloc multitask lockdep fs net fd pipe select epoll else - ifeq ($(NO_AXSTD),y) - ax_feat_prefix := ax-feat/ - else - ax_feat_prefix := ax-std/ - endif + arceos_feature_prefix := ax-std/ lib_features := endif @@ -38,7 +34,7 @@ endif override FEATURES := $(strip $(FEATURES)) -ax_feat := +arceos_feature := lib_feat := direct_feat := @@ -47,7 +43,7 @@ ifeq ($(filter $(LOG),off error warn info debug trace),) endif ifeq ($(DWARF),y) - ax_feat += dwarf + arceos_feature += dwarf endif ifeq ($(shell test $(SMP) -gt 1; echo $$?),0) @@ -57,9 +53,9 @@ endif direct_feat += $(filter %/%,$(FEATURES)) legacy_feat := $(filter-out %/%,$(FEATURES)) -ax_feat += $(filter-out $(lib_features),$(legacy_feat)) +arceos_feature += $(filter-out $(lib_features),$(legacy_feat)) lib_feat += $(filter $(lib_features),$(legacy_feat)) -AX_FEAT := $(strip $(addprefix $(ax_feat_prefix),$(ax_feat)) $(direct_feat)) +AX_FEATURESURES := $(strip $(addprefix $(arceos_feature_prefix),$(arceos_feature)) $(direct_feat)) LIB_FEAT := $(strip $(addprefix $(lib_feat_prefix),$(lib_feat))) APP_FEAT := $(strip $(shell echo $(APP_FEATURES) | tr ',' ' ')) diff --git a/os/arceos/ulib/axlibc/Cargo.toml b/os/arceos/ulib/axlibc/Cargo.toml index 08d0070df3..4fb142302b 100644 --- a/os/arceos/ulib/axlibc/Cargo.toml +++ b/os/arceos/ulib/axlibc/Cargo.toml @@ -22,42 +22,46 @@ crate-type = ["staticlib"] default = [] # Multicore -smp = ["ax-posix-api/smp"] +smp = ["ax-runtime/smp", "ax-kspin/smp", "ax-posix-api/smp"] # Floating point/SIMD -fp-simd = ["ax-feat/fp-simd"] +fp-simd = ["ax-hal/fp-simd"] # Interrupts -irq = ["ax-posix-api/irq", "ax-feat/irq"] +irq = ["ax-posix-api/irq", "ax-runtime/irq"] # Memory alloc = ["ax-posix-api/alloc"] -tls = ["alloc", "ax-feat/tls"] +tls = ["alloc", "ax-runtime/tls"] # Multi-task -multitask = ["ax-feat/multitask", "ax-posix-api/multitask"] -lockdep = ["ax-posix-api/lockdep", "ax-feat/lockdep"] -stack-protector = ["ax-feat/stack-protector"] +multitask = ["ax-posix-api/multitask", "ax-runtime/multitask"] +lockdep = ["ax-posix-api/lockdep", "ax-runtime/lockdep"] +stack-protector = ["ax-runtime/stack-protector"] # File system -fs = ["ax-posix-api/fs", "fd"] +fs = ["ax-posix-api/fs", "ax-runtime/fs", "fd"] +ext4 = ["fs", "ax-runtime/ext4"] +fat = ["fs", "ax-runtime/fat"] # Networking -net = ["ax-posix-api/net", "fd"] +net = ["ax-posix-api/net", "ax-runtime/net", "fd"] # Libc features fd = ["ax-posix-api/fd"] pipe = ["ax-posix-api/pipe"] select = ["ax-posix-api/select"] +poll = ["ax-posix-api/poll"] epoll = ["ax-posix-api/epoll"] [dependencies] ax-driver.workspace = true ax-hal.workspace = true +ax-kspin.workspace = true ax-posix-api.workspace = true ax-errno.workspace = true -ax-feat.workspace = true ax-io.workspace = true +ax-runtime.workspace = true [build-dependencies] bindgen.workspace = true diff --git a/os/arceos/ulib/axstd/Cargo.toml b/os/arceos/ulib/axstd/Cargo.toml index 42781f9283..1234c626c0 100644 --- a/os/arceos/ulib/axstd/Cargo.toml +++ b/os/arceos/ulib/axstd/Cargo.toml @@ -25,60 +25,62 @@ default = ["alloc", "tls", "fd"] std-compat = ["ax-alloc/global-allocator", "ax-runtime/std-compat"] # Multicore -smp = ["ax-feat/smp", "ax-kspin/smp", "ax-posix-api/smp"] +smp = ["ax-runtime/smp", "ax-kspin/smp", "ax-posix-api/smp"] # Floating point/SIMD -fp-simd = ["ax-feat/fp-simd"] +fp-simd = ["ax-hal/fp-simd"] # User space support -uspace = ["ax-feat/uspace"] +uspace = ["ax-runtime/uspace"] # Hypervisor support -hv = ["ax-feat/hv"] +hv = ["ax-hal/hv"] # Interrupts -irq = ["ax-api/irq", "ax-feat/irq", "ax-posix-api/irq"] -ipi = ["ax-api/ipi", "ax-feat/ipi"] -wake-ipi = ["ax-feat/wake-ipi"] +irq = ["ax-api/irq", "ax-posix-api/irq", "ax-runtime/irq"] +ipi = ["ax-api/ipi", "ax-runtime/ipi"] +wake-ipi = ["ax-runtime/wake-ipi"] -ext-ld = ["ax-feat/ext-ld"] +ext-ld = ["ax-runtime/ext-ld"] # Memory -alloc = ["ax-api/alloc", "ax-feat/alloc", "ax-io/alloc", "ax-posix-api/alloc"] -paging = ["ax-feat/paging", "alloc"] -dma = ["ax-api/dma", "ax-feat/dma"] -tls = ["ax-feat/tls"] +alloc = ["ax-api/alloc", "ax-io/alloc", "ax-posix-api/alloc"] +paging = ["alloc", "ax-runtime/paging"] +dma = ["ax-api/dma", "ax-runtime/paging"] +tls = ["ax-runtime/tls"] # Multi-threading and scheduler -multitask = ["ax-api/multitask", "ax-feat/multitask", "ax-posix-api/multitask"] -lockdep = ["ax-feat/lockdep", "ax-posix-api/lockdep"] -task-ext = ["ax-feat/task-ext"] -sched-fifo = ["ax-feat/sched-fifo"] -sched-rr = ["ax-feat/sched-rr"] -sched-cfs = ["ax-feat/sched-cfs"] -stack-guard-page = ["multitask", "paging", "ax-feat/stack-guard-page"] -stack-protector = ["ax-feat/stack-protector"] +multitask = ["ax-api/multitask", "ax-posix-api/multitask", "ax-runtime/multitask"] +lockdep = ["multitask", "ax-posix-api/lockdep", "ax-runtime/lockdep"] +task-ext = ["ax-task/task-ext"] +tracepoint-hooks = ["ax-task/tracepoint-hooks"] +rr = ["irq", "multitask", "ax-task/rr"] +cfs = ["irq", "multitask", "ax-task/cfs"] +stack-guard-page = ["ax-runtime/stack-guard-page"] +stack-protector = ["ax-runtime/stack-protector"] # File system fs = [ "ax-api/fs", - "ax-feat/fs", "ax-posix-api/fs", + "ax-runtime/fs", "ax-driver/virtio-blk", "fd", ] -ext4fs = ["fs", "ax-feat/ext4fs"] -fatfs = ["fs", "ax-feat/fatfs"] +ext4 = ["fs", "ax-runtime/ext4"] +fat = ["fs", "ax-runtime/fat"] # Networking net = [ "ax-api/net", - "ax-feat/net", "ax-posix-api/net", + "ax-runtime/net", "ax-driver/virtio-net", "fd", ] -dns = [] +vsock = ["ax-runtime/vsock"] +aic8800 = ["ax-runtime/aic8800"] +dns = ["net"] # libc compatibility surface used when ax-std is linked as fake libc for Rust std. fd = ["ax-posix-api/fd", "ax-posix-api/poll"] @@ -91,30 +93,34 @@ virtio-input = ["ax-driver/virtio-input"] virtio-socket = ["ax-driver/virtio-socket"] # Display -display = ["ax-api/display", "ax-feat/display"] +display = ["ax-api/display", "ax-runtime/display"] # Input -input = ["ax-feat/input"] +input = ["ax-runtime/input"] + +# USB +usb = ["irq", "ax-driver/usb"] # Real Time Clock (RTC) Driver. -rtc = ["ax-feat/rtc"] +rtc = ["ax-runtime/rtc"] # Backtrace -backtrace = ["ax-feat/backtrace"] -dwarf = ["ax-feat/dwarf"] +backtrace = ["axbacktrace/alloc"] +dwarf = ["axbacktrace/dwarf"] [dependencies] ax-api.workspace = true ax-alloc.workspace = true +axbacktrace.workspace = true ax-driver.workspace = true ax-errno.workspace = true -ax-feat.workspace = true ax-hal.workspace = true ax-io.workspace = true ax-kspin.workspace = true ax-lazyinit.workspace = true ax-posix-api.workspace = true ax-runtime.workspace = true +ax-task.workspace = true libc.workspace = true lock_api.workspace = true spin.workspace = true diff --git a/os/arceos/ulib/axstd/src/lib.rs b/os/arceos/ulib/axstd/src/lib.rs index e3fc92a4b3..8e1a40b090 100644 --- a/os/arceos/ulib/axstd/src/lib.rs +++ b/os/arceos/ulib/axstd/src/lib.rs @@ -4,10 +4,6 @@ //! to rust [std], but calling the functions directly in ArceOS modules, instead //! of using libc and system calls. //! -//! These features are exactly the same as those in [ax-feat], they are used to -//! provide users with the selection of features in ax-feat, without import -//! [ax-feat] additionally: -//! //! ## Cargo Features //! //! - CPU @@ -21,11 +17,12 @@ //! - `tls`: Enable thread-local storage. //! - Task management //! - `multitask`: Enable multi-threading support. -//! - `sched-fifo`: Use the FIFO cooperative scheduler. -//! - `sched-rr`: Use the Round-robin preemptive scheduler. -//! - `sched-cfs`: Use the Completely Fair Scheduler (CFS) preemptive scheduler. +//! - `rr`: Use the Round-robin preemptive scheduler. +//! - `cfs`: Use the Completely Fair Scheduler (CFS) preemptive scheduler. //! - Upperlayer stacks //! - `fs`: Enable file system support. +//! - `ext4`: Enable the ext4 filesystem. +//! - `fat`: Enable the FAT filesystem. //! - `net`: Enable networking support. //! - `dns`: Enable DNS lookup support. //! - `display`: Enable graphics support. diff --git a/os/axvisor/Cargo.toml b/os/axvisor/Cargo.toml index e87cdadead..2a0b055010 100644 --- a/os/axvisor/Cargo.toml +++ b/os/axvisor/Cargo.toml @@ -42,7 +42,7 @@ required-features = ["axtest"] [features] default = [] axtest = [] -fs = ["ax-std/ext4fs", "ax-std/fatfs", "axvm/host-fs"] +fs = ["ax-std/ext4", "ax-std/fat", "axvm/host-fs"] vmx = ["axvm/vmx"] svm = ["axvm/svm"] sstc = ["axvm/sstc"] diff --git a/os/axvisor/doc/shell.md b/os/axvisor/doc/shell.md index 9e936d86b6..4d2efe0138 100644 --- a/os/axvisor/doc/shell.md +++ b/os/axvisor/doc/shell.md @@ -846,7 +846,7 @@ ArceOS 默认使用 **FAT32** 文件系统。如需使用其他文件系统, --arch aarch64 \ --vmconfigs configs/vms/qemu/aarch64/nimbos-smp1.toml \ --features fs \ - --arceos-features ext4fs \ + --arceos-features ext4 \ --arceos-args "BUS=mmio,BLK=y,DISK_IMG=disk-ext4.img,MEM=8g" ``` diff --git a/p.md b/p.md new file mode 100644 index 0000000000..9e2ce0f71f --- /dev/null +++ b/p.md @@ -0,0 +1,839 @@ +# 删除 `ax-feat` 并重建 ArceOS Feature 归属 + +## 目标 + +彻底删除 `os/arceos/api/axfeat`,重新建立 ArceOS feature 的职责层级,使 feature 关系直接、简单、可审计。 + +本方案不保留旧兼容: + +- 删除 `ax-feat` crate。 +- 删除所有 `ax-feat/*` feature 前缀。 +- 删除 `axfeat` 历史别名。 +- 不提供废弃兼容 crate。 +- 不引入新的 feature 聚合 crate 替代 `ax-feat`。 + +最终状态应满足: + +- 每个 feature 只由最贴近真实职责的 crate 拥有。 +- API crate 只控制 API 是否暴露。 +- Runtime crate 只控制系统装配和启动初始化。 +- User library crate 只控制用户侧门面能力。 +- StarryOS、Axvisor 等上层系统直接组合所需底层能力,不再通过 ArceOS API 聚合层转发。 + +## 当前问题 + +`ax-feat` 当前只有 feature 转发,没有实质 API。它把以下职责混在一起: + +- 用户可见 feature 名表。 +- runtime 初始化装配。 +- HAL、task、sync、driver、fs、net、display、input 等模块 feature 转发。 +- StarryOS / LKM / axbuild 的跨系统 feature 前缀入口。 + +这会带来几个问题: + +- feature 的真实所有权不清楚。 +- `ax-std`、`ax-api`、`ax-posix-api` 与 `ax-feat` 重复传递同一批底层 feature。 +- `ax-runtime` 已经有装配逻辑,但 `ax-feat` 又在外层重复描述依赖。 +- 上层系统依赖 `ax-feat` 后,很难判断它实际打开了哪些模块和隐式前置条件。 +- 新能力接入时容易形成“先加到底层,再加到 runtime,再加到 ax-feat,再加到 ax-std”的机械链条。 + +## Feature 保留标准 + +清理 `ax-feat` 时不能只做机械替换,还要重新判断每个 feature 是否有必要存在。 + +一个 feature 只有满足以下任一条件时才应保留: + +- 能显著裁剪镜像体积、依赖集合或初始化路径,例如 `fs`、`net`、`display`、`input`、`multitask`。 +- 选择真实不同的实现、格式、算法或硬件路径,例如 `ax-fs-ng/ext4`、`ax-fs-ng/fat`、`ax-task/rr`、`ax-task/cfs`。 +- 控制上层公开 API 是否存在,例如 `ax-api/fs`、`ax-posix-api/net`、`ax-std/fs`。 +- 控制平台或 CPU 能力,例如 `smp`、`irq`、`fp-simd`、`hv`、`uspace`、`xuantie-c9xx`。 +- 控制可选诊断、调试或加固能力,例如 `lockdep`、`backtrace`、`dwarf`、`stack-guard-page`、`stack-protector`。 + +以下情况不应继续作为 feature: + +- 空 feature,或没有任何行为差异的 marker,例如当前 `ax-fs-ng/std`。 +- 只为了转发另一个 crate 的 feature 而存在的 feature,例如 `ax-feat/*`。 +- crate 正常工作所必需的能力。必选能力应直接成为默认实现,而不是继续暴露给用户选择。 +- 某个上层能力已经必然包含的内部实现细节。例如 FIFO 是 `multitask` 的默认调度器,task stack canary 是 multitask task 栈基础防护时,不应再提供单独 feature。 + +## Feature 命名规则 + +清理后的 feature 名应短、稳定,并且能直接表达真实能力。命名优先级如下: + +- 已形成行业或架构共识的缩写直接保留,例如 `smp`、`irq`、`ipi`、`tls`、`rtc`、`dma`、`hv`。 +- 文件系统格式、调度算法、协议和设备型号直接使用真实名,例如 `ext4`、`fat`、`rr`、`cfs`、`virtio-net`、`aic8800`。 +- 避免为了说明所属层级而加前缀,例如不用 `fs-ext4` / `fs-fat`,因为 feature 已经在具体 crate 下有命名空间,且依赖关系会表达它属于 `fs`。 +- 避免过长的多段连字符名;只有当它是成熟术语、协议名或驱动名时才保留,例如 `stack-protector`、`virtio-net`。 +- 不为“看起来统一”而发明难懂缩写;短名必须仍然能让使用者判断真实含义。 +- Cargo feature 名是 per-crate 的;不同 crate 下的同名 feature 在 Cargo 层面互不相同。本方案允许 `ax-api/fs`、`ax-runtime/fs`、`ax-std/fs` 这类同名 feature 表达同一能力的不同职责切面,但调用关系必须通过各 crate 的 `Cargo.toml` 显式映射审计,不能跨 crate 推断等价性。 + +## 优化后各层 Feature 清单 + +### 应删除或默认化的 Feature + +| Feature | 处理方式 | 原因 | +| --- | --- | --- | +| `ax-feat/*` | 全部删除 | 纯聚合转发,职责重复 | +| `axfeat/*` | 全部删除 | 历史别名,不保留兼容 | +| `ax-fs-ng/std` | 删除 | 当前为空 feature,没有行为差异 | +| `ax-fs-ng/times` | 删除 feature,行为默认启用 | 文件时间戳字段和 POSIX stat 表面是基础文件系统语义;无 wall time provider 时已有 0 时间回退,不应作为编译期开关 | +| `ax-runtime/times` / `ax-std/times` / `ax-libc/times` | 删除 | 时间戳支持不再作为上层可选能力暴露 | +| `ax-runtime/dma` | 删除 | 当前只是 `paging` 别名,runtime 没有独立 DMA 初始化路径 | +| `ax-task/stack-canary` | 删除 feature,行为并入 `multitask` 默认实现 | 当前 `ax-task/multitask` 已强制启用它,不存在真实“不启用 task 栈 canary 的 multitask”配置 | +| `ax-task/fifo` / `ax-std/fifo` / 旧 `sched-fifo` | 删除 feature,FIFO 作为默认调度器 | `ax-task` 在未选择 `rr` / `cfs` 时天然使用 FIFO;单独 feature 只表达默认值,没有裁剪或选择意义 | +| `sched-rr` / `sched-cfs` 旧命名 | 删除旧名 | 改为 `rr` / `cfs`,避免在 `ax-task` 命名空间内重复 `sched-` 前缀 | +| `ax-std/dynld` | 不新增 | `ext-ld` 的真实含义是 external linker,不是 dynamic loader;不引入误导性新名字 | +| `aic8800-wifi` 旧命名 | 删除旧名 | 改为 `aic8800`;设备型号已足够表达真实驱动目标 | +| `dummy-if-not-enabled` 旧命名 | 删除旧名 | 改为 `stubs`,直接表达生成 stub API 的行为 | +| `ext4fs` / `fatfs` 旧命名 | 删除 | 改为统一的 `ext4` / `fat` 命名 | + +### 保留 Feature 必要性复核 + +下表按唯一能力名复核。若同一名字出现在 `ax-runtime`、`ax-std`、`ax-libc` 或 API 门面中,上层 feature 只作为直接映射入口保留,不代表底层能力被重复定义。 + +| Feature / 能力 | 复核结论 | +| --- | --- | +| `smp` | 保留。单核 / 多核启动、per-CPU、调度迁移、C ABI 中 pthread mutex layout 都有真实差异。 | +| `irq` | 保留。中断初始化、timer、IRQ wait/waker、设备 IRQ 注册均可裁剪。 | +| `ipi` | 保留。完整 IPI 队列 / 回调 / TLB shootdown 路径不是 `irq` 的必选子集。 | +| `wake-ipi` | 保留。它是只确认 SGI、唤醒 idle CPU 的轻量路径,可在没有完整 `ax-ipi` 队列时使用。 | +| `fp-simd`、`xuantie-c9xx`、`hv` | 保留。分别对应 CPU 扩展状态、具体 CPU errata / 扩展、虚拟化能力。 | +| `rtc` | 保留。不是所有平台都有 RTC,且会改变设备 probe 与 boot 时间输出。 | +| `paging` | 保留。无页表 / 有页表 runtime 差异巨大,且影响 DMA、framebuffer、地址空间、page fault。 | +| `tls` | 保留。TLS 初始化和 task TLS 字段不是所有配置必需。 | +| `uspace` | 保留。用户地址空间、页表切换 API、HAL / task wiring 都是可选能力。 | +| `multitask` | 保留。单任务和 scheduler runtime 是根本不同的执行模型。 | +| `preempt` | 保留为 `ax-task` 局部能力。抢占计数、抢占调度和 kernel guard 行为可独立于基础 multitask 审计。 | +| `rr`、`cfs` | 保留。它们是真实调度算法选择;FIFO 是默认值,不再作为 feature。 | +| `stack-guard-page` | 保留。guard page 依赖 paging / TLB flush / 诊断路径,成本和语义都不是必选。 | +| `stack-protector` | 保留。它控制 compiler-inserted canary runtime 符号,不是普通 task 栈 canary。 | +| `lockdep` | 保留。诊断能力,会引入锁依赖跟踪状态和跨 crate wiring。 | +| `task-ext`、`tracepoint-hooks` | 保留。它们分别暴露外部 task 扩展接口和 tracepoint hook,不是基础 task 必选行为。 | +| `alloc` | 保留。`ax-api` / `ax-posix-api` / `ax-std` 仍支持无 alloc 的更小 API 表面。 | +| `global-allocator` | 保留为 `ax-alloc` 局部 / `std-compat` 支撑能力;它不是普通应用 feature。 | +| `tlsf`、`buddy-slab` | 保留。它们是真实 allocator 后端选择。 | +| `tracking` | 保留。内存分配跟踪是可选诊断能力。 | +| `fs` | 保留。文件系统 API、block runtime、rootfs 初始化和 fd 集成可整体裁剪。 | +| `vfs` | 保留。它控制 `ax-fs-ng` 高层 VFS / cache / open-options / context API 是否编译。 | +| `ext4`、`fat` | 保留。当前仓库确有两种 rootfs / 磁盘格式实现。 | +| `net` | 保留。网络设备、网络栈和 socket API 可整体裁剪。 | +| `vsock` | 保留。vsock 是网络栈上的可选协议 / 设备路径。 | +| `dns` | 保留为 `ax-std` 网络行为开关。它只控制 `ToSocketAddrs` 是否进行 DNS 查询,并应依赖 `net`。 | +| `display`、`input` | 保留。图形和输入子系统是可选设备能力。 | +| `usb`、`virtio-*`、`aic8800` | 保留。它们是真实设备 / 总线 / 驱动选择。 | +| `dma` | 保留在 API 门面。它暴露显式 DMA 分配 API;runtime 不保留 `dma`,因为 runtime 没有独立 DMA 装配代码,DMA 在 runtime 侧只需要 `paging` 支撑。 | +| `axklib` glue | 不作为用户 feature 暴露。`ax-runtime` 默认提供 `axklib::Klib` glue;没有 `paging` / `irq` 时相关内存映射和 IRQ 操作返回 `Unsupported`。动态平台基础路径会使用 `axklib::mmio`,因此该 glue 不能挂在 `paging`、`fs` 或 `net` 等可选 feature 后面。 | +| `fd`、`pipe`、`select`、`poll`、`epoll` | 保留。POSIX fd 表和 I/O multiplexing API 可分别裁剪,`fs` / `net` 通过 `fd` 组合。 | +| `stubs` | 保留在 `ax-api`。它用于生成未启用 API 的 stub 符号,不是 runtime 能力。 | +| `std-compat` | 保留。它改变 lang items / libc compat / global allocator 入口,属于真实构建模式。 | +| `ext-ld` | 保留。它控制 `ax-runtime/build.rs` 生成可扩展链接脚本 `runtime.x` 而非最终 `linker.x`,Axvisor / StarryOS / LKM 实际依赖该模式追加自定义 section。 | +| `backtrace`、`dwarf` | 保留。基础栈回溯和 DWARF 符号化依赖集合明显不同。 | +| `copy` | 保留为 `ax-mm` 局部能力。它只在需要复制页表映射时启用 `ax-page-table-multiarch/copy-from`。 | + +### ArceOS 底层模块层 + +| Crate | 保留 feature | 默认化 / 删除 | +| --- | --- | --- | +| `ax-hal` | `smp`, `irq`, `ipi`, `fp-simd`, `xuantie-c9xx`, `rtc`, `paging`, `tls`, `uspace`, `hv` | `host-test`、`axvisor-linker` 只作为测试 / 构建内部 feature,不进入用户能力层 | +| `ax-task` | `multitask`, `irq`, `ipi`, `preempt`, `smp`, `stack-guard-page`, `lockdep`, `task-ext`, `tls`, `tracepoint-hooks`, `uspace`, `rr`, `cfs` | 删除 `stack-canary` 独立 feature;删除 `sched-fifo`,FIFO 为默认调度器;`host-test` / `test` 只作为测试内部 feature | +| `ax-sync` | `multitask`, `lockdep` | 无 | +| `ax-alloc` | `global-allocator`, `tlsf`, `buddy-slab`, `tracking` | 无 | +| `ax-mm` | `copy` | 无;仅当调用方需要复制页表映射时启用 | +| `ax-fs-ng` | `vfs`, `ext4`, `fat`, `lockdep` | 删除 `std` 和 `times`;时间戳行为默认编译 | +| `ax-net` | `vsock` 等真实网络栈变体 | 无 | +| `ax-display` | 无 feature,作为 display 能力模块被上层可选依赖 | 无 | +| `ax-input` | 无 feature,作为 input 能力模块被上层可选依赖 | 无 | +| `axbacktrace` | `alloc`, `dwarf` | 无 | + +### `ax-runtime` + +`ax-runtime` 只保留会改变 runtime 初始化或全局系统装配的 feature。 + +| 保留 feature | 含义 | +| --- | --- | +| `irq` | 中断初始化、IRQ 分发、驱动 IRQ 集成 | +| `ipi` | 完整 IPI 队列 / 回调支持;清理时必须补齐 `irq`、`dep:ax-ipi`、`ax-hal/ipi`、`ax-task?/ipi` wiring | +| `wake-ipi` | 轻量 idle wake IPI handler | +| `smp` | 多核启动和 secondary CPU runtime 流程 | +| `uspace` | user address space 相关 HAL / task wiring,包括任务切换页表 API | +| `paging` | 页表、地址空间和 page fault runtime wiring | +| `multitask` | task scheduler runtime 初始化 | +| `tls` | runtime TLS 设置 | +| `fs` | 文件系统 runtime 基础栈:block runtime、rootfs 初始化、`ax-fs-ng/vfs`、page cache、block IRQ / task ops | +| `ext4` | `fs` + `ax-fs-ng/ext4` | +| `fat` | `fs` + `ax-fs-ng/fat` | +| `net` | `irq` + `multitask` + `paging` + 网络设备和网络栈注册 | +| `vsock` | `net` + vsock 设备 / 协议支持 | +| `display` | `paging` + display 设备注册 | +| `input` | `paging` + input 设备注册 | +| `rtc` | RTC 设备支持 | +| `aic8800` | SG2002 AIC8800 Wi-Fi runtime bring-up | +| `std-compat` | Rust std 兼容 runtime hook | +| `ext-ld` | 生成可扩展链接脚本 `runtime.x` 而非最终 `linker.x`,供外层镜像追加 section | +| `lockdep` | runtime 参与的系统层 lockdep wiring,尤其是 `fs` 启用时传播到 `ax-fs-ng/lockdep` | +| `stack-guard-page` | guard page 初始化和诊断路径;承接旧 `ax-feat/stack-guard-page` 的 `ipi` / `multitask` / `paging` 前置条件 | +| `stack-protector` | stack protector runtime hook | + +`ax-runtime` 默认依赖 `axklib` 并提供 `axklib::Klib` glue。这不是用户可选择的能力,而是动态平台和驱动基础路径需要的 runtime glue;未启用 `paging` 或 `irq` 时,相关 `mem_iomap` / IRQ 操作应返回 `Unsupported`,而不是让链接符号缺失。 + +`ax-runtime/fs` 本身表示“文件系统 runtime 栈存在”,不表示具体磁盘格式。当前仓库确实有 `ext4` 和 `fat` 两种文件系统格式,因此具体 rootfs 格式应通过 `ext4` / `fat` 选择。构建可启动 rootfs 时,不应只启用 `fs` 而不启用任何格式 feature。 + +### API 与用户库层 + +| Crate | 保留 feature | 说明 | +| --- | --- | --- | +| `ax-api` | `irq`, `ipi`, `alloc`, `paging`, `dma`, `multitask`, `fs`, `net`, `display`, `stubs` | 只控制 Rust API / 类型是否暴露,不负责 runtime 装配 | +| `ax-posix-api` | `smp`, `irq`, `alloc`, `multitask`, `lockdep`, `fd`, `fs`, `net`, `pipe`, `select`, `poll`, `epoll` | `smp` / `lockdep` 影响 build.rs 生成的 C 头文件和 pthread mutex ABI;该层只控制 POSIX API / C ABI 表面 | +| `ax-std` | `std-compat`, `ext-ld`, `smp`, `fp-simd`, `uspace`, `hv`, `irq`, `ipi`, `wake-ipi`, `alloc`, `paging`, `dma`, `tls`, `multitask`, `lockdep`, `task-ext`, `tracepoint-hooks`, `rr`, `cfs`, `stack-guard-page`, `stack-protector`, `fs`, `ext4`, `fat`, `net`, `vsock`, `aic8800`, `dns`, `fd`, `display`, `input`, `usb`, `rtc`, `backtrace`, `dwarf`, `virtio-*` | Rust 应用侧门面;`fs` 打开文件 API 和基础 runtime fs 栈,但不选择具体 rootfs 格式,格式用 `ext4` / `fat`;`xuantie-c9xx` 这类具体 CPU errata / 扩展由平台或系统集成者直接启用 `ax-hal/xuantie-c9xx`,不放入通用应用门面 | +| `ax-libc` | `smp`, `fp-simd`, `irq`, `alloc`, `tls`, `multitask`, `lockdep`, `stack-protector`, `fs`, `ext4`, `fat`, `net`, `fd`, `pipe`, `select`, `poll`, `epoll` | C 应用侧门面;通过 `ax-posix-api` 暴露 API,通过 `ax-runtime` 装配系统能力 | + +## 目标归属模型 + +### 1. 模块局部 Feature + +每个底层 crate 只拥有本 crate 的局部能力。 + +| Crate | 负责的 feature | +| --- | --- | +| `ax-hal` | `smp`, `irq`, `ipi`, `fp-simd`, `xuantie-c9xx`, `rtc`, `paging`, `tls`, `uspace`, `hv` | +| `ax-task` | `multitask`, `irq`, `ipi`, `preempt`, `smp`, `stack-guard-page`, `task-ext`, `tls`, `tracepoint-hooks`, `uspace`, `rr`, `cfs`, `lockdep` | +| `ax-sync` | `multitask`, `lockdep` | +| `ax-mm` | `copy` | +| `ax-runtime` | runtime 初始化和系统装配 feature | +| `ax-driver` | 具体设备、总线和 probe feature | +| `ax-fs-ng` | `vfs`, `fat`, `ext4`, `lockdep` 等文件系统实现 / API feature | +| `ax-net` | `vsock` 等网络栈 feature | +| `ax-display` | display 子系统 feature | +| `ax-input` | input 子系统 feature | +| `axbacktrace` | `alloc`, `dwarf` | + +规则:crate 不应暴露只用于命名其他层产物概念的 feature。 + +### 2. Runtime 装配 Feature + +`ax-runtime` 拥有系统装配图。只要启用某项能力需要启动期初始化、全局 runtime 状态、设备探测、IRQ 注册、DMA 设置或调度器参与,对应依赖就应放在 `ax-runtime`。 + +目标 `ax-runtime` feature 职责: + +| Feature | 含义 | +| --- | --- | +| `irq` | runtime 中断处理和 driver IRQ 集成 | +| `ipi` | 完整 IPI 队列 / 回调支持,同时包含 IRQ、HAL、task 的 IPI wiring | +| `wake-ipi` | 轻量 idle wake IPI handler | +| `smp` | runtime SMP 启动和 task SMP wiring | +| `uspace` | runtime user address space wiring,同时启用 `ax-hal/uspace` 和 `ax-task?/uspace` | +| `paging` | runtime 页表和内存管理支持 | +| `multitask` | runtime task scheduler 集成 | +| `tls` | runtime TLS 设置 | +| `fs` | runtime block driver、VFS/rootfs、DMA、IRQ、multitask 前置条件 | +| `ext4` | runtime ext4 rootfs 支持 | +| `fat` | runtime FAT rootfs 支持 | +| `net` | runtime 网络驱动和网络栈注册;自带 `irq`、`multitask`、`paging` 前置条件 | +| `vsock` | runtime vsock 支持 | +| `display` | runtime display 设备注册;保留旧 `ax-feat/display` 的 `paging` 前置条件 | +| `input` | runtime input 设备注册;保留旧 `ax-feat/input` 的 `paging` 前置条件 | +| `rtc` | runtime RTC 设备支持 | +| `aic8800` | runtime SG2002 AIC8800 Wi-Fi bring-up | +| `std-compat` | Rust std 兼容 runtime hook | +| `ext-ld` | 生成可扩展链接脚本 `runtime.x` 而非最终 `linker.x`,供外层镜像追加 section | +| `lockdep` | runtime 参与的系统层 lockdep wiring,尤其是 `fs` 启用时传播到 `ax-fs-ng/lockdep` | +| `stack-guard-page` | runtime guard-page 初始化;自带 `ipi`、`multitask`、`paging` 前置条件 | +| `stack-protector` | runtime stack protector hook | + +规则:`ax-runtime` 可以依赖更底层模块。更底层模块不能依赖 user library 或 API facade crate。 + +### 3. API 门面 Feature + +`ax-api` 和 `ax-posix-api` 只描述哪些公开 API 被编译。它们可以启用类型检查和 API 实现所需的直接依赖,但不能再通过全局 feature 聚合层转发。 + +`ax-api` 目标 feature: + +| Feature | 清理后的直接展开 | +| --- | --- | +| `irq` | `ax-task?/irq`;只保持 API 行为和 `WaitQueue::wait_timeout*` 编译所需 task IRQ 能力,不启用 `ax-runtime/irq` | +| `ipi` | `dep:ax-ipi` | +| `alloc` | `dep:ax-alloc` | +| `paging` | `dep:ax-mm` | +| `dma` | `dep:ax-dma` | +| `multitask` | `ax-task/multitask`, `ax-sync/multitask` | +| `fs` | `dep:ax-fs-ng` | +| `net` | `dep:ax-net` | +| `display` | `dep:ax-display` | +| `stubs` | 原 `dummy-if-not-enabled`,用于在真实 API feature 未启用时生成 stub 符号 | + +`ax-posix-api` 目标 feature: + +| Feature | 清理后的直接展开 | +| --- | --- | +| `smp` | 空展开;保留该 feature 让 build.rs 在计算 `pthread_mutex_t` 内存布局时区分 SMP 与非 SMP,并作为 bindgen 的 `AX_CONFIG_SMP` 输入 | +| `irq` | 仅当 POSIX API 代码确实需要 IRQ 符号时保留直接依赖 | +| `alloc` | `dep:ax-alloc` | +| `multitask` | `alloc`, `ax-task/multitask`, `ax-sync/multitask` | +| `lockdep` | `multitask`, `ax-sync/lockdep`, `ax-kspin/lockdep`;同时被 build.rs 用于 `pthread_mutex_t` layout 计算,保证 C ABI 与 Rust 锁布局一致 | +| `fd` | `alloc`, `dep:scope-local` | +| `fs` | `dep:ax-fs-ng`, `fd` | +| `net` | `dep:ax-net`, `fd` | +| `pipe` | `fd` | +| `select` | `fd` | +| `poll` | `fd` | +| `epoll` | `fd` | + +规则:API 门面的 feature 名可以和 runtime feature 名相同,但 API 门面不负责启用 runtime 装配。 + +### 4. 用户库 Feature + +`ax-std` 和 `ax-libc` 成为唯一的 ArceOS 应用侧便利层。 + +`ax-std` feature 策略: + +- Rust 应用选择 `ax-std/*`。 +- `ax-std` 显式组合以下内容: + - 通过 `ax-api/*` 控制 API 可见性。 + - 通过 `ax-posix-api/*` 控制 POSIX 兼容接口。 + - 通过 `ax-runtime/*` 控制 runtime 装配。 + - 只有 `ax-std` 自身直接使用底层符号时,才直接启用底层模块 feature。 + - 只有历史上 `ax-std` 已承诺的默认应用驱动选择,才保留在 `ax-std` 中。 + +目标 `ax-std` 映射: + +| Feature | 清理后的直接展开 | +| --- | --- | +| `std-compat` | `ax-alloc/global-allocator`, `ax-runtime/std-compat` | +| `smp` | `ax-runtime/smp`, `ax-kspin/smp`, `ax-posix-api/smp` | +| `fp-simd` | `ax-hal/fp-simd` | +| `uspace` | `ax-runtime/uspace` | +| `hv` | `ax-hal/hv` | +| `irq` | `ax-api/irq`, `ax-posix-api/irq`, `ax-runtime/irq` | +| `ipi` | `ax-api/ipi`, `ax-runtime/ipi` | +| `wake-ipi` | `ax-runtime/wake-ipi` | +| `ext-ld` | `ax-runtime/ext-ld` | +| `alloc` | `ax-api/alloc`, `ax-io/alloc`, `ax-posix-api/alloc`;`ax-alloc` 仍作为普通依赖存在,不写 `dep:ax-alloc`,除非后续将该依赖 optional 化 | +| `paging` | `alloc`, `ax-runtime/paging` | +| `dma` | `ax-api/dma`, `ax-runtime/paging` | +| `tls` | `ax-runtime/tls` | +| `multitask` | `ax-api/multitask`, `ax-posix-api/multitask`, `ax-runtime/multitask` | +| `lockdep` | `multitask`, `ax-posix-api/lockdep`, `ax-runtime/lockdep` | +| `task-ext` | `ax-task/task-ext` | +| `tracepoint-hooks` | `ax-task/tracepoint-hooks` | +| `rr` | `irq`, `multitask`, `ax-task/rr` | +| `cfs` | `irq`, `multitask`, `ax-task/cfs` | +| `stack-guard-page` | `ax-runtime/stack-guard-page` | +| `stack-protector` | `ax-runtime/stack-protector` | +| `fs` | `ax-api/fs`, `ax-posix-api/fs`, `ax-runtime/fs`, `ax-driver/virtio-blk`, `fd` | +| `ext4` | `fs`, `ax-runtime/ext4` | +| `fat` | `fs`, `ax-runtime/fat` | +| `net` | `ax-api/net`, `ax-posix-api/net`, `ax-runtime/net`, `ax-driver/virtio-net`, `fd` | +| `vsock` | `ax-runtime/vsock` | +| `aic8800` | `ax-runtime/aic8800` | +| `dns` | `net`;仅改变 `ToSocketAddrs` 是否调用 DNS 查询,不单独启用新的底层模块 | +| `fd` | `ax-posix-api/fd`, `ax-posix-api/poll` | +| `display` | `ax-api/display`, `ax-runtime/display` | +| `input` | `ax-runtime/input` | +| `usb` | `irq`, `ax-driver/usb` | +| `rtc` | `ax-runtime/rtc` | +| `backtrace` | `axbacktrace/alloc` | +| `dwarf` | `axbacktrace/dwarf` | +| `virtio-blk` | `ax-driver/virtio-blk` | +| `virtio-net` | `ax-driver/virtio-net` | +| `virtio-gpu` | `ax-driver/virtio-gpu` | +| `virtio-input` | `ax-driver/virtio-input` | +| `virtio-socket` | `ax-driver/virtio-socket` | + +`ax-libc` feature 策略: + +- C 应用选择 `ax-libc/*`。 +- `ax-libc` 直接组合 POSIX API 和 runtime 装配。 +- `ax-libc` 不能依赖 `ax-std`。 + +目标 `ax-libc` 映射: + +| Feature | 清理后的直接展开 | +| --- | --- | +| `smp` | `ax-runtime/smp`, `ax-kspin/smp`, `ax-posix-api/smp` | +| `fp-simd` | `ax-hal/fp-simd` | +| `irq` | `ax-posix-api/irq`, `ax-runtime/irq` | +| `alloc` | `ax-posix-api/alloc` | +| `tls` | `alloc`, `ax-runtime/tls` | +| `multitask` | `ax-posix-api/multitask`, `ax-runtime/multitask` | +| `lockdep` | `ax-posix-api/lockdep`, `ax-runtime/lockdep` | +| `stack-protector` | `ax-runtime/stack-protector` | +| `fs` | `ax-posix-api/fs`, `ax-runtime/fs`, `fd` | +| `ext4` | `fs`, `ax-runtime/ext4` | +| `fat` | `fs`, `ax-runtime/fat` | +| `net` | `ax-posix-api/net`, `ax-runtime/net`, `fd` | +| `fd` | `ax-posix-api/fd` | +| `pipe` | `ax-posix-api/pipe` | +| `select` | `ax-posix-api/select` | +| `poll` | `ax-posix-api/poll` | +| `epoll` | `ax-posix-api/epoll` | + +规则:`ax-std` 和 `ax-libc` 应保持显式,但不要重复展开 `ax-runtime` 已经负责的下层细节。它们的 feature 表应让组合关系清晰可审计。 + +### 5. 上层系统 Feature + +StarryOS 和 Axvisor 不能再依赖 `ax-feat`。 + +StarryOS 目标策略: + +- `starry-kernel` 直接启用所需 ArceOS 基础模块: + - `ax-hal/*` + - `ax-runtime/*` + - `ax-task/*` + - `ax-sync/*` + - `ax-driver/*` + - `ax-fs-ng/*` + - `ax-net/*` + - `axbacktrace/*` +- `starry-kernel` 如果直接使用 `ax_sync::Mutex` 等 sleepable / task-aware 同步原语,应在自身依赖上启用 `ax-sync/multitask`,不能依赖 `starryos` 镜像包或其他上层组合“碰巧”打开。 +- `starryos` 镜像包主要启用 `starry-kernel/*`、平台和具体驱动。 +- LKM crate 依赖与主 StarryOS kernel image 相同的直接底层 feature,不能再导入单独的 feature 聚合路径。 + +Axvisor 目标策略: + +- 只有在构建 ArceOS 风格用户库接口时,才使用 `ax-std/*`。 +- hypervisor / platform 装配使用直接底层 feature: + - `ax-hal/hv` + - `ax-runtime/*` + - `ax-task/*` + - `ax-driver/*` + +规则:上层系统应表现为系统集成者,而不是应用 crate。 + +## 具体清理步骤 + +### 步骤 1:冻结当前 Feature 图 + +改动前先生成基线: + +```bash +cargo metadata --no-deps --format-version 1 > tmp/axfeat-cleanup-metadata-before.json +rg -n "ax-feat|axfeat" . > tmp/axfeat-cleanup-refs-before.txt +``` + +把每个当前 `ax-feat` 引用归入以下类别之一: + +- `ax-std` 映射。 +- `ax-libc` 映射。 +- `ax-api` API 可见性。 +- `ax-posix-api` API 可见性。 +- `ax-runtime` 装配。 +- StarryOS 系统装配。 +- Axvisor 系统装配。 +- axbuild feature 解析。 +- docs / changelog / 生成的组件文档。 + +### 步骤 2:让 API Crate 脱离 `ax-feat` + +编辑: + +- `os/arceos/api/arceos_api/Cargo.toml` +- `os/arceos/api/arceos_posix_api/Cargo.toml` + +必要改动: + +- 删除 `ax-feat.workspace = true`。 +- 将所有 `ax-feat/*` feature 展开替换为上文 API 映射中的直接本地依赖。 +- 保持 optional dependency 仍为 optional。 +- 除非 API 代码确实调用 runtime 符号,否则不要从 API crate 启用 `ax-runtime/*`。 +- 删除 `arceos_api/stack-guard-page` feature;当前 `arceos_api/src` 没有对应 API 符号,stack guard page 的真实处理在 `ax-runtime` 和 `ax-task`。 +- 将 `dummy-if-not-enabled` 重命名为 `stubs`,避免使用描述实现细节的长 feature 名。 + +期望结果: + +```bash +rg -n "ax-feat|axfeat" os/arceos/api/arceos_api os/arceos/api/arceos_posix_api +``` + +除非历史 changelog 按仓库策略需要保留,否则不应再有匹配。 + +### 步骤 3:收敛底层模块和 `ax-runtime` Feature + +编辑: + +- `os/arceos/modules/axtask/Cargo.toml` +- `os/arceos/modules/axfs-ng/Cargo.toml` +- `os/arceos/modules/axfs-ng/src/file/handle.rs` +- `os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/*` +- `os/arceos/modules/axruntime/Cargo.toml` + +必要改动: + +- 删除 `ax-task/sched-fifo` 和 `ax-std/sched-fifo`。FIFO 是 `multitask` 未选择 `rr` / `cfs` 时的默认调度器,不再作为 feature。 +- 将 `ax-task/sched-rr`、`ax-task/sched-cfs` 分别重命名为 `ax-task/rr`、`ax-task/cfs`。这是调度算法自身的真实名字,`sched-` 前缀在 `ax-task` 命名空间内属于冗余。 +- 删除 `ax-task/stack-canary` 独立 feature,并让 task stack canary 成为 `multitask` 的默认实现细节。 +- 保留 `ax-runtime/ext-ld`,因为它通过 `CARGO_FEATURE_EXT_LD` 控制 `axruntime/build.rs` 输出 `runtime.x` 还是 `linker.x`。不要引入 `dynld` 新名,避免把 external linker 误读为 dynamic loader。 +- 将 `ax-runtime/aic8800-wifi` 和 `ax-driver/aic8800-wifi` 重命名为 `aic8800`,并保持 runtime 侧自带 `net`、`ax-driver/aic8800`、`dep:aic8800`、`dep:sdhci-cv1800` 等真实 Wi-Fi bring-up 依赖。 +- `ax-runtime` 默认依赖 `axklib` 并编译 `axklib::Klib` glue。动态平台基础路径会无条件使用 `axklib::mmio`,因此 `axklib` 不能只挂在 `paging`、`fs` 或 `net` 后面;未启用 `paging` / `irq` 时对应操作返回 `Unsupported`。 +- 删除 `dma = ["paging"]`。 +- 将 `fs` feature 中的 `"dma"` 替换为 `"paging"`,避免 `fs` 引用已删除的 runtime feature。 +- 保留 `fs` feature 中的 `"ax-fs-ng/vfs"`,因为它控制 `ax-fs-ng` 高层 VFS / cache / open-options / context API 是否编译。 +- 删除 `ax-fs-ng/times` feature,并把当前 `#[cfg(feature = "times")]` 门控改为默认编译。文件元数据、POSIX stat 字段、`utime` / `utimensat` 语义都天然需要时间戳;无 wall time provider 时保留当前返回 0 的运行时回退即可。 +- 新增 `lockdep = ["ax-fs-ng?/lockdep"]`,让启用 `lockdep + fs` 时文件系统层锁也进入 lockdep 诊断。 +- 新增 `uspace = ["ax-hal/uspace", "ax-task?/uspace"]`,承接旧 `ax-feat/uspace`,避免只启用 HAL 而丢失 `TaskControlBlock::switch_page_table()` 等 task 层 API。 +- 将 `stack-guard-page` 增强为 `["ipi", "multitask", "paging", "ax-task?/stack-guard-page"]`,承接旧 `ax-feat/stack-guard-page` 的完整前置条件,避免 StarryOS 等直接启用 runtime feature 时丢失 IPI TLB shootdown 路径。 +- 将 `net` 改为自包含系统装配 feature,至少包含: + +```toml +net = [ + "irq", + "multitask", + "paging", + "dep:ax-net", + "dep:rd-net", + "dep:spin", + "ax-driver/net", +] +``` + +- 将 `display` 和 `input` 补上 `paging`,保持旧 `ax-feat/display`、`ax-feat/input` 的前置条件语义: + +```toml +display = ["paging", "dep:ax-display", "ax-driver/display"] +input = ["paging", "dep:ax-input", "ax-driver/input"] +``` + +- 增强 `ipi` feature,使它承接旧 `ax-feat/ipi` 的完整 wiring: + +```toml +ipi = ["irq", "dep:ax-ipi", "ax-hal/ipi", "ax-task?/ipi"] +``` + +这样 `ax-std/ipi` 和上层系统只需要启用 `ax-runtime/ipi`,不会丢失 HAL/task IPI 路径。 + +### 步骤 4:让 `ax-std` 脱离 `ax-feat` + +编辑: + +- `os/arceos/ulib/axstd/Cargo.toml` +- `os/arceos/ulib/axstd/src/lib.rs` + +必要改动: + +- 删除 `ax-feat.workspace = true`。 +- 将每个 `ax-feat/*` 展开替换为直接的 `ax-runtime/*`、`ax-hal/*`、`ax-task/*`、`ax-sync/*`、`ax-driver/*`、`axbacktrace/*` 或 API 门面 feature。 +- 更新 crate 文档,删除 “`ax-std` features are exactly the same as those in `ax-feat`” 之类描述。 +- 保持 `ax-std` 作为 ArceOS Rust 应用 feature 门面。 +- `rr` / `cfs` 必须组合 `irq` 和 `multitask`,承接旧 `ax-feat/sched-rr` / `ax-feat/sched-cfs` 的中断前置条件。 +- 这是有意的行为改进,不是等价机械替换:旧 `ax-feat/sched-*` 只会打开 `ax-task` 的调度算法 feature,可能缺少 runtime scheduler 初始化和用户侧 API;清理后用户启用 `ax-std/rr` 或 `ax-std/cfs` 应得到完整可运行的 multitask runtime 栈。FIFO 不需要独立 feature,启用 `multitask` 且不选择 `rr` / `cfs` 即为 FIFO。 + +重要规则: + +- 不要为了缩短 feature 列表而创建 `base-fs`、`runtime-net` 之类辅助别名。显式组合更容易审计。 +- 不要在 `ax-std` 重复展开 `ax-runtime` 已经负责的 `ax-hal`、`ax-task`、`ax-driver` 细节,除非 `ax-std` 自身直接使用对应符号。 + +### 步骤 5:让 `ax-libc` 脱离 `ax-feat` + +编辑: + +- `os/arceos/ulib/axlibc/Cargo.toml` + +必要改动: + +- 删除 `ax-feat.workspace = true`。 +- 新增 `ax-runtime.workspace = true` 和 `ax-kspin.workspace = true`,因为清理后的 `ax-libc` feature 会直接引用 `ax-runtime/*` 和 `ax-kspin/smp`。 +- 将 `fp-simd`、`irq`、`tls`、`multitask`、`lockdep`、`stack-protector` 映射替换为直接模块 / runtime 映射。 +- 保持 libc 专属 feature(`fd`、`pipe`、`select`、`poll`、`epoll`)通过 `ax-posix-api` 路由。 +- 新增 `poll = ["ax-posix-api/poll"]`;当前 `ax-posix-api/poll` 已存在,但 `ax-libc` 尚未暴露同名 feature。 +- 新增 `ext4`、`fat` 两个 C 应用侧 feature,并分别映射到 `fs + ax-runtime/ext4`、`fs + ax-runtime/fat`。 + +### 步骤 6:让 StarryOS 脱离 `ax-feat` + +至少编辑: + +- `os/StarryOS/kernel/Cargo.toml` +- `os/StarryOS/starryos/Cargo.toml` +- `os/StarryOS/lkm/*/Cargo.toml` +- `os/StarryOS/lkm/README.md` +- `os/StarryOS/docs/*` 中提到 `ax-feat` 的引用。 +- `apps/starry/*` 中提到 `ax-feat` 的文档或构建配置。 + +目标替换示例: + +| 旧写法 | 新写法 | +| --- | --- | +| `ax-feat/input` | `ax-runtime/input`,如果代码直接使用 `ax-input` API,再加 `dep:ax-input` | +| `ax-feat/ipi` | `ax-runtime/ipi`,如果 kernel 代码直接使用 IPI API,再加 `dep:ax-ipi` | +| `ax-feat/backtrace` | `axbacktrace/alloc` | +| `ax-feat/fp-simd` | `ax-hal/fp-simd` | +| `ax-feat/xuantie-c9xx` | `ax-hal/xuantie-c9xx` | +| `ax-feat/uspace` | `ax-runtime/uspace` | +| `ax-feat/multitask` | `ax-runtime/multitask`,如果 kernel 代码直接使用 task API,再加 `ax-task/multitask` | +| `ax-feat/task-ext` | `ax-task/task-ext` | +| `ax-feat/tracepoint-hooks` | `ax-task/tracepoint-hooks` | +| `ax-feat/sched-fifo` | 删除,无替代 feature;启用 `ax-runtime/multitask` 且不启用 `rr` / `cfs` 即为 FIFO | +| `ax-feat/sched-rr` | `ax-runtime/irq`, `ax-runtime/multitask`, `ax-task/rr` | +| `ax-feat/sched-cfs` | `ax-runtime/irq`, `ax-runtime/multitask`, `ax-task/cfs` | +| `ax-feat/ext4fs` | `ax-runtime/ext4` | +| `ax-feat/fatfs` | `ax-runtime/fat` | +| `ax-feat/net` | `ax-runtime/net`,如果 kernel 代码直接使用 `ax-net` 符号,保留直接依赖 `ax-net` | +| `ax-feat/vsock` | `ax-runtime/vsock`,如果 kernel 代码直接使用 net 符号,再加 `ax-net/vsock` | +| `ax-feat/usb` | `ax-runtime/irq`, `ax-driver/usb` | +| `ax-feat/aic8800-wifi` | `ax-runtime/aic8800` | +| `ax-feat/stack-guard-page` | `ax-runtime/stack-guard-page`,并保留 Starry 诊断 feature | +| `ax-feat/stack-protector` | `ax-runtime/stack-protector` | +| `ax-feat/fs-times` | 删除,无替代 feature;文件时间戳默认启用 | +| `ax-feat/ext-ld` | `ax-runtime/ext-ld`;若通过 `ax-std` 入口构建,则使用 `ax-std/ext-ld` | +| `ax-feat/rtc` | `ax-runtime/rtc` | +| `ax-feat/display` | `ax-runtime/display` | +| `ax-feat/irq` | `ax-runtime/irq` | +| `ax-feat/smp` | 对用户侧门面映射为 `ax-runtime/smp` + `ax-kspin/smp` + `ax-posix-api/smp`;对内部 crate 则按实际消费的 SMP 能力直接启用对应模块 feature | + +StarryOS 清理后的依赖策略: + +- `starry-kernel` 应显式依赖自己消费的 ArceOS 模块。 +- `starryos` 不应启用底层 ArceOS feature,除非它拥有该 feature 的镜像级集成职责。 +- LKM 示例应直接镜像主 StarryOS kernel 的 feature 表面。 + +### 步骤 7:让 Axvisor 脱离间接 `ax-feat` + +编辑: + +- `os/axvisor/Cargo.toml` +- `virtualization/*/Cargo.toml` 中仍存在 `ax-feat` 引用的文件。 +- 提到 `ax-feat` 的 Axvisor 文档和构建测试。 + +如果 Axvisor 只通过 `ax-std` 间接接收 `ax-feat`,则本步骤主要是在 `ax-std` 清理后做验证。 + +同时替换旧文件系统格式 feature 名: + +- `ax-std/ext4fs` 改为 `ax-std/ext4`。 +- `ax-std/fatfs` 改为 `ax-std/fat`。 + +### 步骤 8:从 Workspace 删除 `ax-feat` + +编辑: + +- 根目录 `Cargo.toml`。 +- 任何 workspace package 列表或 dependency table 中的 `ax-feat` 条目。 +- release / changelog 工具中枚举 package 的位置。 +- std-test whitelist 中的 `ax-feat` 条目。 +- 如果仓库提交了生成文档索引,也要同步清理。 + +删除: + +- `os/arceos/api/axfeat/Cargo.toml` +- `os/arceos/api/axfeat/src/lib.rs` +- `os/arceos/api/axfeat/CHANGELOG.md` +- `os/arceos/api/axfeat/` + +不要添加替代 package。 + +### 步骤 9:删除 `axbuild` 中的 `ax-feat` 支持 + +编辑: + +- `scripts/axbuild/src/build/platform.rs` +- `scripts/axbuild/src/build/info.rs` +- `scripts/axbuild/src/build/std_build.rs` +- `scripts/axbuild/src/arceos/cbuild/features.rs` +- `scripts/axbuild/src/starry/build.rs` +- `scripts/axbuild/src/axvisor/build/features.rs` +- 所有引用 `ax-feat` 或 `axfeat` 的 axbuild 测试。 + +清理后的必要行为: + +- `FEATURES=axfeat/net` 非法。 +- `FEATURES=ax-feat/net` 非法。 +- Build Info 不再自动检测 `AxFeat` 前缀族。 +- 应用包必须依赖 `ax-std`、`ax-libc` 或直接依赖更底层模块。 +- `axbuild` 不再归一化 `axfeat` 别名。 +- `axbuild` 不再剥离 `ax-feat/` 前缀。 +- `axbuild` 不再把 `ext4fs` / `fatfs` 当作可继续传播的旧 feature 名;构建配置必须使用 `ext4` / `fat`。 +- C app feature 映射不再把未知低层系统 feature 回退到 `ax-feat/{unknown}`,而应直接映射到模块 / runtime feature 或拒绝。 + +删除: + +- `AxFeaturePrefixFamily::AxFeat` +- `normalize_legacy_feature_alias()` 中对 `axfeat` 的处理。 +- `is_removed_dynamic_platform_feature()` 中对 `ax-feat/plat-dyn` 的分支。 +- `feature_family_from_existing_features()` 对 `ax-feat/` 的检测。 +- `detect_ax_feature_prefix_family()` 对直接依赖 `ax-feat` 的接受逻辑。 + +简化目标: + +```rust +enum StdFeaturePrefixFamily { + AxStd, +} +``` + +如果该 enum 已经没有实际用途,则直接删除整个 enum。若为了保持现有解析流程清晰而暂时保留单变体 `StdFeaturePrefixFamily::AxStd`,也可接受;关键是不再存在 `AxFeat` 分支或 `axfeat` / `ax-feat` 兼容路径。 + +### 步骤 10:清理文档 + +编辑所有把 `ax-feat` 描述为架构层的文档: + +- `docs/docs/architecture/arceos.md` +- `docs/docs/development/arceos.md` +- `docs/docs/development/components.md` +- `docs/docs/components/layers.md` +- `docs/docs/components/crates/ax-feat.md` +- `docs/docs/components/crates/ax-api.md` +- `docs/docs/components/crates/ax-posix-api.md` +- `docs/docs/components/crates/ax-std.md` +- `docs/docs/components/crates/ax-runtime.md` +- `docs/docs/components/crates/starry-kernel.md` +- `docs/docs/components/crates/starryos.md` +- `docs/docs/build/arceos/build.md` +- `docs/docs/debug/task-stack-guard-page.md` +- `docs/docs/debug/check-mechanisms-summary.md` +- `os/arceos/doc/build.md` + +必要文档改动: + +- 从架构图中移除 `ax-feat`。 +- 删除 `docs/docs/components/crates/ax-feat.md`。 +- 将“API 聚合层包含 axfeat”替换为: + - `ax-api`:Rust API 门面。 + - `ax-posix-api`:POSIX API 门面。 + - `ax-std` / `ax-libc`:应用侧用户库。 + - `ax-runtime`:系统装配和初始化。 +- 记录直接 feature 归属规则。 +- 根据上下文,将构建示例中的 `ax-feat/*` 改为 `ax-std/*`、`ax-libc/*`、`ax-runtime/*` 或直接模块 feature。 + +### 步骤 11:清理测试和生成产物 + +编辑: + +- `scripts/axbuild/src/build/tests/*` +- `scripts/axbuild/src/arceos/build/tests.rs` +- `scripts/axbuild/src/arceos/cbuild/tests.rs` +- `scripts/axbuild/src/starry/test/tests/*` +- `scripts/axbuild/src/test/std.rs` +- `test-suit/arceos/rust/Cargo.toml` 中的 `ax-std/ext4fs` / `ax-std/fatfs` 旧 feature 名。 +- feature 列表中包含 `ax-feat` 的 `test-suit/*` 配置。 + +测试更新必须断言新的行为: + +- `axfeat/*` 不会被归一化。 +- `ax-feat/*` 会被拒绝,或只有在所选 package 真实存在同名 feature 时才原样保留;由于 `ax-feat` 已删除,普通 ArceOS 流程应拒绝它。 +- feature 前缀族检测不再接受 `ax-feat`。 +- C app 映射不再回退生成 `ax-feat/{unknown}`。 +- Starry build 配置不再包含 `ax-feat/plat-dyn`。 +- 测试和示例不再使用 `ax-std/ext4fs` / `ax-std/fatfs`,统一使用 `ax-std/ext4` / `ax-std/fat`。 + +### 步骤 12:最终搜索必须干净 + +完成代码和文档清理后执行: + +```bash +rg -n "ax-feat|axfeat|ax_feat|AxFeat|axfeat/" . +``` + +允许的匹配: + +- 如果仓库策略要求历史 changelog 不可变,则只允许历史 changelog 条目。 +- 本方案文件,直到方案被删除或归档。 + +除此之外,所有匹配都必须删除或改写。 + +## 清理后的依赖规则 + +硬性规则: + +- `os/arceos/api/*` 不能依赖已删除的 feature 聚合 crate。 +- `ax-runtime` 不能依赖 `ax-api`、`ax-posix-api`、`ax-std` 或 `ax-libc`。 +- `ax-api` 和 `ax-posix-api` 不能启用 `ax-runtime/*`,除非它们直接调用 runtime 符号。 +- `ax-std` 可以依赖 `ax-api`、`ax-posix-api`、`ax-runtime` 和更底层模块。 +- `ax-libc` 可以依赖 `ax-posix-api`、`ax-runtime` 和更底层模块。 +- StarryOS 和 Axvisor 在装配 kernel / runtime 内部能力时,不能使用 ArceOS user-library feature 名;只有明确链接 user library 表面时例外。 +- 上层 `Cargo.toml` 依赖 `ax-*` crate 时,如不希望被默认 feature 影响,应显式写 `default-features = false`,然后只开启本镜像实际需要的 feature。 + +期望依赖方向: + +```text +apps / C apps + -> ax-std / ax-libc + -> ax-api / ax-posix-api + -> ax-runtime + -> ax-hal / ax-task / ax-sync / ax-driver / ax-fs-ng / ax-net / ... + -> components / platforms + +StarryOS / Axvisor + -> ax-runtime and lower modules directly +``` + +## 验证计划 + +先运行格式化: + +```bash +cargo fmt +``` + +运行定向 clippy: + +```bash +cargo xtask clippy --package ax-runtime +cargo xtask clippy --package ax-api +cargo xtask clippy --package ax-posix-api +cargo xtask clippy --package ax-std +cargo xtask clippy --package ax-libc +cargo xtask clippy --package starry-kernel +cargo xtask clippy --package starryos +cargo xtask clippy --package axbuild +``` + +运行 axbuild 测试: + +```bash +cargo test -p axbuild +``` + +当前 `cargo xtask test` 子命令不支持 `--package` 过滤;因此 axbuild 单元测试使用原生 Cargo 的 `cargo test -p axbuild`。这属于 xtask 无法表达该精确配置时的等价验证命令。 + +运行代表性 ArceOS 构建: + +```bash +cargo xtask arceos build --package arceos-helloworld --arch aarch64 +cargo xtask arceos build --package arceos-thread-test --arch aarch64 +cargo xtask arceos build --package arceos-fs-shell --arch aarch64 +cargo xtask arceos build --package arceos-net-httpserver --arch aarch64 +``` + +运行代表性 StarryOS 构建: + +```bash +cargo xtask starry build --arch riscv64 +cargo xtask starry build --arch aarch64 +``` + +运行代表性 Axvisor 构建: + +```bash +cargo xtask axvisor build --arch aarch64 +``` + +如果某条命令不符合当前 xtask 语法,先查看 `cargo xtask --help`,使用最接近的 xtask 支持命令。除非 xtask 无法表达对应配置,否则不要对 OS 镜像构建回退到原生 Cargo 命令。 + +## 审查清单 + +合并前检查: + +- `ax-feat` 已从根 workspace dependencies 中移除。 +- `os/arceos/api/axfeat` 目录已删除。 +- 活跃代码路径中不再引用 `ax-feat`、`axfeat`、`AxFeat` 或 `ax_feat`。 +- `axbuild` 中不再存在 `ax-feat` 前缀族。 +- C app feature 映射不再生成 `ax-feat/*`。 +- `ax-std` feature 定义显式且可读。 +- `ax-libc` feature 定义显式且可读。 +- `ax-api` 和 `ax-posix-api` 不再承担 runtime 装配职责。 +- `ax-runtime` 拥有系统装配依赖。 +- StarryOS 使用直接 runtime / module feature。 +- Axvisor 在合适位置使用直接 runtime / module feature。 +- 文档不再把 `ax-feat` 描述为 ArceOS 层级。 +- 所有定向 clippy 检查通过。 +- 代表性 ArceOS、StarryOS 和 Axvisor 构建通过。 + +## 期望最终状态 + +清理完成后,feature 模型应很容易解释: + +- 构建 Rust ArceOS 应用:使用 `ax-std/*`。 +- 构建 C ArceOS 应用:使用 `ax-libc/*`。 +- 暴露 Rust API:使用 `ax-api/*`。 +- 暴露 POSIX API:使用 `ax-posix-api/*`。 +- 需要 runtime 初始化:使用 `ax-runtime/*`。 +- 做 kernel / system 集成:直接依赖需要的具体模块。 + +不再存在单独的顶层 feature crate。Cargo feature 图本身就是唯一事实来源。 diff --git a/scripts/axbuild/src/arceos/build/tests.rs b/scripts/axbuild/src/arceos/build/tests.rs index a44961852d..abb184f134 100644 --- a/scripts/axbuild/src/arceos/build/tests.rs +++ b/scripts/axbuild/src/arceos/build/tests.rs @@ -60,7 +60,7 @@ fn resolves_dynamic_platform_features_and_args() { fn max_cpu_num_adds_smp_feature_for_std_build() { let metadata = repo_metadata(); let mut build_info = ArceosBuildInfo { - features: vec!["ax-feat/net".to_string()], + features: vec!["ax-api/net".to_string()], max_cpu_num: Some(4), ..ArceosBuildInfo::default() }; @@ -212,7 +212,7 @@ fn load_build_info_normalizes_legacy_feature_aliases() { fs::write( &path, r#" -features = ["axstd", "axstd/smp", "axfeat/net"] +features = ["axstd", "ax-std/smp", "ax-runtime/net"] log = "Warn" "#, @@ -224,7 +224,7 @@ log = "Warn" assert!(build_info.features.contains(&"ax-std".to_string())); assert!(build_info.features.contains(&"ax-std/smp".to_string())); - assert!(build_info.features.contains(&"ax-feat/net".to_string())); + assert!(build_info.features.contains(&"ax-runtime/net".to_string())); assert!(!build_info.features.contains(&"axstd".to_string())); let rewritten = fs::read_to_string(path).unwrap(); @@ -347,11 +347,11 @@ log = "Warn" #[test] fn parse_makefile_features_splits_commas_whitespace_and_dedups() { assert_eq!( - build::parse_makefile_features(" lockdep, sched-rr lockdep\taxfeat/net "), + build::parse_makefile_features(" lockdep, rr lockdep\tax-runtime/net "), vec![ "lockdep".to_string(), - "sched-rr".to_string(), - "axfeat/net".to_string() + "rr".to_string(), + "ax-runtime/net".to_string() ] ); } @@ -372,7 +372,7 @@ fn apply_makefile_features_uses_ax_std_prefix_for_unified_std_build() { ); assert!(build_info.features.contains(&"lockdep".to_string())); - assert!(!build_info.features.contains(&"ax-feat/lockdep".to_string())); + assert!(!build_info.features.contains(&"ax-api/lockdep".to_string())); } #[test] diff --git a/scripts/axbuild/src/arceos/cbuild/features.rs b/scripts/axbuild/src/arceos/cbuild/features.rs index 95aa0c5b81..a17b48b6dc 100644 --- a/scripts/axbuild/src/arceos/cbuild/features.rs +++ b/scripts/axbuild/src/arceos/cbuild/features.rs @@ -15,18 +15,19 @@ pub(super) fn c_config_features(features: &[String]) -> BTreeSet { if feature.starts_with(C_DEFINE_FEATURE_PREFIX) { return None; } - if feature.starts_with("ax-hal/") || feature.starts_with("ax-driver/") { + if feature.starts_with("ax-hal/") + || feature.starts_with("ax-driver/") + || feature.starts_with("ax-runtime/") + { return None; } feature .strip_prefix("ax-libc/") - .or_else(|| feature.strip_prefix("ax-feat/")) .or_else(|| feature.strip_prefix("ax-std/")) .or(Some(feature.as_str())) }) .filter(|feature| { - !matches!(*feature, "ax-libc" | "ax-feat" | "ax-std" | "plat-dyn") - && !feature.contains('/') + !matches!(*feature, "ax-libc" | "ax-std" | "plat-dyn") && !feature.contains('/') }) .map(str::to_string) .collect(); @@ -59,7 +60,6 @@ pub(super) fn has_feature(features: &[String], name: &str) -> bool { features.iter().any(|feature| { feature == name || feature.strip_prefix("ax-libc/") == Some(name) - || feature.strip_prefix("ax-feat/") == Some(name) || feature.strip_prefix("ax-std/") == Some(name) }) } @@ -83,7 +83,10 @@ pub(super) fn map_c_app_features( "fd", "pipe", "select", + "poll", "epoll", + "ext4", + "fat", ]; let mut features = BTreeSet::new(); @@ -92,16 +95,18 @@ pub(super) fn map_c_app_features( continue; } let normalized = feature - .strip_prefix("ax-feat/") - .or_else(|| feature.strip_prefix("ax-std/")) + .strip_prefix("ax-std/") .or_else(|| feature.strip_prefix("ax-libc/")) .unwrap_or(feature); - if feature.starts_with("ax-hal/") || feature.starts_with("ax-driver/") { + if feature.starts_with("ax-hal/") + || feature.starts_with("ax-driver/") + || feature.starts_with("ax-runtime/") + { features.insert(feature.clone()); continue; } match normalized { - "ax-std" | "ax-feat" | "ax-libc" => {} + "ax-std" | "ax-libc" => {} "plat-dyn" => {} "smp" => { features.insert("smp".to_string()); @@ -110,7 +115,7 @@ pub(super) fn map_c_app_features( features.insert(feature.to_string()); } feature => { - features.insert(format!("ax-feat/{feature}")); + features.insert(feature.to_string()); } } } @@ -119,22 +124,20 @@ pub(super) fn map_c_app_features( continue; } let normalized = feature - .strip_prefix("ax-feat/") - .or_else(|| feature.strip_prefix("ax-std/")) + .strip_prefix("ax-std/") .or_else(|| feature.strip_prefix("ax-libc/")) .unwrap_or(feature); - if feature.starts_with("ax-hal/") || feature.starts_with("ax-driver/") { + if feature.starts_with("ax-hal/") + || feature.starts_with("ax-driver/") + || feature.starts_with("ax-runtime/") + { features.insert(feature.clone()); continue; } if normalized == "plat-dyn" { continue; } - if LIB_FEATURES.contains(&normalized) || normalized == "smp" { - features.insert(normalized.to_string()); - } else { - features.insert(format!("ax-feat/{normalized}")); - } + features.insert(normalized.to_string()); } if features .iter() diff --git a/scripts/axbuild/src/arceos/cbuild/tests.rs b/scripts/axbuild/src/arceos/cbuild/tests.rs index 2f018e45fc..4d4a7a6eec 100644 --- a/scripts/axbuild/src/arceos/cbuild/tests.rs +++ b/scripts/axbuild/src/arceos/cbuild/tests.rs @@ -21,7 +21,7 @@ fn strings(items: &[&str]) -> Vec { fn c_config_features_skips_nested_cargo_only_features() { let features = c_config_features(&strings(&[ "ax-libc/net", - "ax-feat/paging", + "ax-runtime/paging", "ax-driver/virtio-net", "ax-hal/custom-board", "some-crate/feature", @@ -29,7 +29,7 @@ fn c_config_features_skips_nested_cargo_only_features() { assert_eq!( features.into_iter().collect::>(), - vec!["net".to_string(), "paging".to_string()] + vec!["net".to_string()] ); } diff --git a/scripts/axbuild/src/arceos/test/mod.rs b/scripts/axbuild/src/arceos/test/mod.rs index a7d0ac2e78..4c4c2bff74 100644 --- a/scripts/axbuild/src/arceos/test/mod.rs +++ b/scripts/axbuild/src/arceos/test/mod.rs @@ -42,8 +42,8 @@ const ARCEOS_RUST_QEMU_FEATURES: &[&str] = &[ ARCEOS_RUST_LOCKDEP_DETECT_FEATURE, "memtest", "net-loopback", - "sched-cfs", - "sched-rr", + "cfs", + "rr", "task-affinity", "task-ipi", "task-irq", diff --git a/scripts/axbuild/src/arceos/test/rust_qemu.rs b/scripts/axbuild/src/arceos/test/rust_qemu.rs index 4488202784..4224c65624 100644 --- a/scripts/axbuild/src/arceos/test/rust_qemu.rs +++ b/scripts/axbuild/src/arceos/test/rust_qemu.rs @@ -357,8 +357,8 @@ mod tests { "lockdep-baseline", ARCEOS_RUST_LOCKDEP_DETECT_FEATURE, "net-loopback", - "sched-cfs", - "sched-rr", + "cfs", + "rr", ARCEOS_RUST_STACK_GUARD_PAGE_FEATURE, ] { let features = rust_qemu_features_for_list(Some(feature), false).unwrap(); diff --git a/scripts/axbuild/src/axvisor/build/features.rs b/scripts/axbuild/src/axvisor/build/features.rs index 183f33b600..b1a85119a1 100644 --- a/scripts/axbuild/src/axvisor/build/features.rs +++ b/scripts/axbuild/src/axvisor/build/features.rs @@ -56,7 +56,6 @@ pub(super) fn is_removed_dynamic_platform_feature(feature: &str) -> bool { "dyn-plat" | "plat-dyn" | "axplat-dyn" - | "ax-feat/plat-dyn" | "ax-hal/plat-dyn" | "ax-std/plat-dyn" | "axvm/plat-dyn" @@ -70,7 +69,6 @@ fn nested_platform_feature_name<'a>( ) -> Option<&'a str> { feature .strip_prefix("ax-std/") - .or_else(|| feature.strip_prefix("ax-feat/")) .filter(|name| is_platform_control_feature(name, known_platforms)) } diff --git a/scripts/axbuild/src/build/info.rs b/scripts/axbuild/src/build/info.rs index 2793532926..fcb483c1f2 100644 --- a/scripts/axbuild/src/build/info.rs +++ b/scripts/axbuild/src/build/info.rs @@ -30,10 +30,7 @@ pub(super) fn features_enable_stack_protector(features: &[String]) -> bool { features.iter().any(|feature| { matches!( feature.as_str(), - "stack-protector" - | "ax-std/stack-protector" - | "ax-feat/stack-protector" - | "starry-kernel/stack-protector" + "stack-protector" | "ax-std/stack-protector" | "starry-kernel/stack-protector" ) }) } @@ -80,16 +77,14 @@ pub(super) const STD_TARGET_DIR: &str = "std"; pub(super) const AXSTD_STD_PACKAGE: &str = "ax-std"; #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub(super) enum AxFeaturePrefixFamily { +pub(super) enum StdFeaturePrefixFamily { AxStd, - AxFeat, } -impl AxFeaturePrefixFamily { +impl StdFeaturePrefixFamily { fn prefix(self) -> &'static str { match self { Self::AxStd => "ax-std/", - Self::AxFeat => "ax-feat/", } } } @@ -269,7 +264,7 @@ impl BuildInfo { self.resolve_features_with_prefix_family( package, target, - detect_ax_feature_prefix_family(package, metadata), + detect_std_feature_prefix_family(package, metadata), Some(metadata), ); } @@ -278,18 +273,14 @@ impl BuildInfo { &mut self, package: &str, target: &str, - prefix_family: anyhow::Result, + prefix_family: anyhow::Result, metadata: Option<&Metadata>, ) { - let prefix_family = self.resolve_ax_feature_prefix_family(package, prefix_family); + let prefix_family = self.resolve_std_feature_prefix_family(package, prefix_family); let _ = (target, metadata); - self.features.retain(|feature| { - !matches!( - feature.as_str(), - "plat-dyn" | "ax-std/plat-dyn" | "ax-feat/plat-dyn" - ) - }); + self.features + .retain(|feature| !matches!(feature.as_str(), "plat-dyn" | "ax-std/plat-dyn")); if self.max_cpu_num.is_some_and(|max_cpu_num| max_cpu_num > 1) { self.features.push(format!("{}smp", prefix_family.prefix())); @@ -299,11 +290,11 @@ impl BuildInfo { self.features.dedup(); } - fn resolve_ax_feature_prefix_family( + fn resolve_std_feature_prefix_family( &self, package: &str, - prefix_family: anyhow::Result, - ) -> AxFeaturePrefixFamily { + prefix_family: anyhow::Result, + ) -> StdFeaturePrefixFamily { match prefix_family { Ok(prefix_family) => prefix_family, Err(err) => { @@ -315,7 +306,7 @@ impl BuildInfo { ax-std feature prefix", package, err ); - AxFeaturePrefixFamily::AxStd + StdFeaturePrefixFamily::AxStd } } } diff --git a/scripts/axbuild/src/build/platform.rs b/scripts/axbuild/src/build/platform.rs index 7b8e978405..1e2a080406 100644 --- a/scripts/axbuild/src/build/platform.rs +++ b/scripts/axbuild/src/build/platform.rs @@ -1,4 +1,4 @@ -use super::{info::AxFeaturePrefixFamily, *}; +use super::{info::StdFeaturePrefixFamily, *}; #[cfg(test)] pub(super) fn supports_platform_dynamic(target: &str) -> bool { @@ -17,10 +17,6 @@ pub(super) fn normalize_legacy_feature_alias(feature: &str) -> String { "ax-std".to_string() } else if let Some(rest) = feature.strip_prefix("axstd/") { format!("ax-std/{rest}") - } else if feature == "axfeat" { - "ax-feat".to_string() - } else if let Some(rest) = feature.strip_prefix("axfeat/") { - format!("ax-feat/{rest}") } else { feature.to_string() } @@ -29,12 +25,16 @@ pub(super) fn normalize_legacy_feature_alias(feature: &str) -> String { pub(super) fn normalize_std_feature(feature: &str) -> String { let normalized = normalize_legacy_feature_alias(feature); match normalized.as_str() { - "ax-std" | "ax-feat" => normalized, - feature if feature.starts_with("ax-std/") || feature.starts_with("ax-feat/") => feature + "ax-std" => normalized, + feature if feature.starts_with("ax-std/") => feature .split_once('/') .map(|(_, feature)| feature.to_string()) .unwrap_or_else(|| normalized.clone()), - feature if feature.starts_with("ax-hal/") || feature.starts_with("ax-driver/") => { + feature + if feature.starts_with("ax-hal/") + || feature.starts_with("ax-driver/") + || feature.starts_with("ax-runtime/") => + { normalized } feature => feature.to_string(), @@ -44,14 +44,15 @@ pub(super) fn normalize_std_feature(feature: &str) -> String { pub(super) fn is_removed_dynamic_platform_feature(feature: &str) -> bool { matches!( feature, - "plat-dyn" | "ax-feat/plat-dyn" | "ax-std/plat-dyn" | "ax-driver/plat-dyn" + "plat-dyn" | "ax-std/plat-dyn" | "ax-driver/plat-dyn" ) } pub(super) fn is_axstd_std_check_feature(feature: &str) -> bool { - matches!(feature, "ax-std" | "ax-feat") + matches!(feature, "ax-std") || feature.starts_with("ax-hal/") || feature.starts_with("ax-driver/") + || feature.starts_with("ax-runtime/") || is_known_axstd_feature(feature) } @@ -81,21 +82,26 @@ pub(super) fn is_known_axstd_feature(feature: &str) -> bool { | "multitask" | "lockdep" | "task-ext" - | "sched-fifo" - | "sched-rr" - | "sched-cfs" + | "tracepoint-hooks" + | "rr" + | "cfs" | "stack-guard-page" | "stack-protector" | "fs" - | "ext4fs" - | "fatfs" + | "ext4" + | "fat" | "net" + | "vsock" + | "aic8800" | "dns" | "display" | "input" + | "usb" | "rtc" | "backtrace" | "dwarf" + | "ext-ld" + | "wake-ipi" | "std-compat" ) } @@ -155,7 +161,7 @@ pub(super) fn apply_makefile_features_with_prefix_family( build_info: &mut BuildInfo, _package: &str, makefile_features: &[String], - _prefix_family: anyhow::Result, + _prefix_family: anyhow::Result, ) { if makefile_features.is_empty() { return; @@ -196,18 +202,12 @@ pub(crate) fn default_build_info_path_in_workspace( pub(super) fn feature_family_from_existing_features( features: &[String], -) -> Option { +) -> Option { if features .iter() .any(|feature| feature.starts_with("ax-std/")) { - return Some(AxFeaturePrefixFamily::AxStd); - } - if features - .iter() - .any(|feature| feature.starts_with("ax-feat/")) - { - return Some(AxFeaturePrefixFamily::AxFeat); + return Some(StdFeaturePrefixFamily::AxStd); } None } @@ -246,27 +246,23 @@ pub(super) fn metadata_package<'a>(metadata: &'a Metadata, package: &str) -> Opt metadata.packages.iter().find(|pkg| pkg.name == package) } -pub(super) fn detect_ax_feature_prefix_family( +pub(super) fn detect_std_feature_prefix_family( package: &str, metadata: &Metadata, -) -> anyhow::Result { +) -> anyhow::Result { let package_info = workspace_package(metadata, package)?; let has_axstd = package_info .dependencies .iter() .any(|dep| dep.name == "ax-std" || dep.rename.as_deref() == Some("ax-std")); - let has_axfeat = package_info - .dependencies - .iter() - .any(|dep| dep.name == "ax-feat" || dep.rename.as_deref() == Some("ax-feat")); - - match (has_axstd, has_axfeat) { - (true, true) | (true, false) => Ok(AxFeaturePrefixFamily::AxStd), - (false, true) => Ok(AxFeaturePrefixFamily::AxFeat), - (false, false) => Err(anyhow::anyhow!( - "package `{package}` must directly depend on `ax-std` or `ax-feat`" - )), + + if has_axstd { + Ok(StdFeaturePrefixFamily::AxStd) + } else { + Err(anyhow::anyhow!( + "package `{package}` must directly depend on `ax-std`" + )) } } diff --git a/scripts/axbuild/src/build/std_build.rs b/scripts/axbuild/src/build/std_build.rs index 9a89824514..c0571c5753 100644 --- a/scripts/axbuild/src/build/std_build.rs +++ b/scripts/axbuild/src/build/std_build.rs @@ -261,7 +261,7 @@ pub(super) fn pass_std_build_nested_features( if is_removed_dynamic_platform_feature(&feature) { continue; } - if matches!(feature.as_str(), "ax-std" | "ax-feat") { + if matches!(feature.as_str(), "ax-std") { continue; } if is_log_level_feature(&feature) { diff --git a/scripts/axbuild/src/build/tests/info.rs b/scripts/axbuild/src/build/tests/info.rs index 7880023ad3..569f057233 100644 --- a/scripts/axbuild/src/build/tests/info.rs +++ b/scripts/axbuild/src/build/tests/info.rs @@ -68,7 +68,6 @@ fn stack_protector_feature_detection_accepts_supported_surfaces() { for feature in [ "stack-protector", "ax-std/stack-protector", - "ax-feat/stack-protector", "starry-kernel/stack-protector", ] { assert!(features_enable_stack_protector(&[feature.to_string()])); diff --git a/scripts/axbuild/src/build/tests/metadata.rs b/scripts/axbuild/src/build/tests/metadata.rs index 1fb40dff20..9631b095ed 100644 --- a/scripts/axbuild/src/build/tests/metadata.rs +++ b/scripts/axbuild/src/build/tests/metadata.rs @@ -1,14 +1,14 @@ use super::*; -use crate::build::info::AxFeaturePrefixFamily; +use crate::build::info::StdFeaturePrefixFamily; #[test] -fn detects_axfeat_direct_dependency_via_metadata() { - let workspace = temp_workspace("ax-feat-app", "ax-feat = \"0.1.0\"\n").unwrap(); +fn rejects_packages_without_ax_std_dependency() { + let workspace = temp_workspace("plain-app", "ax-api = \"0.1.0\"\n").unwrap(); let metadata = metadata_for_manifest(&workspace.join("Cargo.toml")); - let family = detect_ax_feature_prefix_family("ax-feat-app", &metadata).unwrap(); + let err = detect_std_feature_prefix_family("plain-app", &metadata).unwrap_err(); - assert_eq!(family, AxFeaturePrefixFamily::AxFeat); + assert!(err.to_string().contains("must directly depend on `ax-std`")); } #[test] @@ -97,7 +97,7 @@ fn default_platform_feature_uses_dynamic_platform() { info.resolve_features_with_prefix_family( "arceos-helloworld", "loongarch64-unknown-none-softfloat", - Ok(AxFeaturePrefixFamily::AxStd), + Ok(StdFeaturePrefixFamily::AxStd), None, ); diff --git a/scripts/axbuild/src/build/tests/platform.rs b/scripts/axbuild/src/build/tests/platform.rs index 32a01cf26e..f3c59b76b9 100644 --- a/scripts/axbuild/src/build/tests/platform.rs +++ b/scripts/axbuild/src/build/tests/platform.rs @@ -3,7 +3,7 @@ use super::*; #[test] fn std_build_platform_feature_stays_on_arceos_rust_dependency() { let mut info = BuildInfo { - features: vec!["ax-feat/plat-dyn".to_string(), "alloc".to_string()], + features: vec!["ax-std/plat-dyn".to_string(), "alloc".to_string()], ..BuildInfo::default() }; diff --git a/scripts/axbuild/src/starry/build.rs b/scripts/axbuild/src/starry/build.rs index fb5c4587fb..43f8007daf 100644 --- a/scripts/axbuild/src/starry/build.rs +++ b/scripts/axbuild/src/starry/build.rs @@ -556,11 +556,7 @@ fn temp_file_path(path: &Path, suffix: &str) -> anyhow::Result { fn is_removed_dynamic_platform_feature(feature: &str) -> bool { matches!( feature, - "plat-dyn" - | "ax-feat/plat-dyn" - | "ax-std/plat-dyn" - | "starry-kernel/plat-dyn" - | "ax-hal/plat-dyn" + "plat-dyn" | "ax-std/plat-dyn" | "starry-kernel/plat-dyn" | "ax-hal/plat-dyn" ) } diff --git a/scripts/axbuild/src/starry/rootfs.rs b/scripts/axbuild/src/starry/rootfs.rs index bfc27614b3..5cae8ca0c7 100644 --- a/scripts/axbuild/src/starry/rootfs.rs +++ b/scripts/axbuild/src/starry/rootfs.rs @@ -281,7 +281,7 @@ fn rootfs_patch_mode(cargo: &Cargo) -> RootfsPatchMode { if cargo.features.iter().any(|feature| { matches!( feature.as_str(), - "plat-dyn" | "ax-feat/plat-dyn" | "ax-std/plat-dyn" | "starry-kernel/plat-dyn" + "plat-dyn" | "ax-std/plat-dyn" | "starry-kernel/plat-dyn" ) }) { RootfsPatchMode::ReplaceDriveOnly diff --git a/scripts/axbuild/src/starry/test/tests/qemu_run_tests.rs b/scripts/axbuild/src/starry/test/tests/qemu_run_tests.rs index ea6305129b..155e18d2ad 100644 --- a/scripts/axbuild/src/starry/test/tests/qemu_run_tests.rs +++ b/scripts/axbuild/src/starry/test/tests/qemu_run_tests.rs @@ -283,7 +283,7 @@ fn qemu_group_build_context_uses_dynamic_group_platform_over_default_request() { Starry::qemu_group_build_context(&request, &build_config).unwrap(); assert!(!cargo.features.contains(&"plat-dyn".to_string())); - assert!(!cargo.features.contains(&"ax-feat/plat-dyn".to_string())); + assert!(!cargo.features.contains(&"ax-std/plat-dyn".to_string())); assert!( !cargo .features diff --git a/scripts/axbuild/src/test/std.rs b/scripts/axbuild/src/test/std.rs index d11d9646c3..126af10cb4 100644 --- a/scripts/axbuild/src/test/std.rs +++ b/scripts/axbuild/src/test/std.rs @@ -146,7 +146,7 @@ mod tests { fn known_packages() -> HashSet { HashSet::from([ - "ax-feat".to_string(), + "ax-api".to_string(), "ax-hal".to_string(), "starry-process".to_string(), ]) @@ -180,17 +180,17 @@ mod tests { #[test] fn parses_valid_std_csv() { let packages = - parse_std_crates_csv("package\nax-feat\nax-hal\n", &known_packages()).unwrap(); + parse_std_crates_csv("package\nax-api\nax-hal\n", &known_packages()).unwrap(); - assert_eq!(packages, vec!["ax-feat".to_string(), "ax-hal".to_string()]); + assert_eq!(packages, vec!["ax-api".to_string(), "ax-hal".to_string()]); } #[test] fn parses_std_csv_with_blank_lines() { let packages = - parse_std_crates_csv("\npackage\n\nax-feat\n\nax-hal\n", &known_packages()).unwrap(); + parse_std_crates_csv("\npackage\n\nax-api\n\nax-hal\n", &known_packages()).unwrap(); - assert_eq!(packages, vec!["ax-feat".to_string(), "ax-hal".to_string()]); + assert_eq!(packages, vec!["ax-api".to_string(), "ax-hal".to_string()]); } #[test] @@ -202,7 +202,7 @@ mod tests { #[test] fn rejects_invalid_header() { - let err = parse_std_crates_csv("crate\nax-feat\n", &known_packages()).unwrap_err(); + let err = parse_std_crates_csv("crate\nax-api\n", &known_packages()).unwrap_err(); assert!(err.to_string().contains("invalid header")); } @@ -219,10 +219,9 @@ mod tests { #[test] fn rejects_duplicate_package() { - let err = - parse_std_crates_csv("package\nax-feat\nax-feat\n", &known_packages()).unwrap_err(); + let err = parse_std_crates_csv("package\nax-api\nax-api\n", &known_packages()).unwrap_err(); - assert!(err.to_string().contains("duplicate package `ax-feat`")); + assert!(err.to_string().contains("duplicate package `ax-api`")); } #[test] @@ -241,12 +240,12 @@ mod tests { fn std_test_runner_collects_all_failures() { let root = PathBuf::from("/tmp/workspace"); let packages = vec![ - "ax-feat".to_string(), + "ax-api".to_string(), "ax-hal".to_string(), "starry-process".to_string(), ]; let mut runner = FakeCargoRunner::new(&[ - ("ax-feat", true), + ("ax-api", true), ("ax-hal", false), ("starry-process", false), ]); @@ -260,7 +259,7 @@ mod tests { assert_eq!( runner.invocations, vec![ - (root.clone(), "ax-feat".to_string()), + (root.clone(), "ax-api".to_string()), (root.clone(), "ax-hal".to_string()), (root, "starry-process".to_string()), ] @@ -270,8 +269,8 @@ mod tests { #[test] fn std_test_runner_returns_empty_failures_when_all_pass() { let root = PathBuf::from("/tmp/workspace"); - let packages = vec!["ax-feat".to_string(), "ax-hal".to_string()]; - let mut runner = FakeCargoRunner::new(&[("ax-feat", true), ("ax-hal", true)]); + let packages = vec!["ax-api".to_string(), "ax-hal".to_string()]; + let mut runner = FakeCargoRunner::new(&[("ax-api", true), ("ax-hal", true)]); let failed = run_std_tests(&mut runner, &root, &packages).unwrap(); diff --git a/scripts/test/std_crates.csv b/scripts/test/std_crates.csv index 8000eb1fd9..5f823d301e 100644 --- a/scripts/test/std_crates.csv +++ b/scripts/test/std_crates.csv @@ -43,7 +43,6 @@ ax-ipi ax-log ax-net ax-runtime -ax-feat ax-api rockchip-jpeg rockchip-npu diff --git a/test-suit/arceos/rust/Cargo.toml b/test-suit/arceos/rust/Cargo.toml index 72fb5e2220..bb3adca333 100644 --- a/test-suit/arceos/rust/Cargo.toml +++ b/test-suit/arceos/rust/Cargo.toml @@ -10,8 +10,8 @@ std = [] ax-std = ["dep:ax-driver", "dep:ax-hal", "dep:ax-std"] memtest = ["ax-std", "dep:rand", "ax-std/alloc", "ax-std/multitask"] task-yield = ["ax-std", "ax-std/multitask"] -sched-rr = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/sched-rr"] -sched-cfs = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/sched-cfs"] +rr = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/rr"] +cfs = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/cfs"] task-affinity = ["ax-std", "ax-std/multitask"] task-wait-queue = ["ax-std", "ax-std/multitask", "ax-std/irq"] task-wait-queue-remote-wake = ["ax-std", "ax-std/multitask", "ax-std/irq", "ax-std/ipi"] @@ -24,7 +24,7 @@ task-sleep = ["ax-std", "ax-std/multitask", "ax-std/irq"] task-smp-online = ["ax-std", "ax-std/multitask", "ax-std/irq", "ax-std/ipi"] task-stack-guard-page = ["ax-std", "ax-std/multitask", "ax-std/paging", "ax-std/stack-guard-page"] net-loopback = ["ax-std", "ax-driver/virtio-net", "ax-std/net", "ax-std/dns"] -fs-basic = ["ax-std", "ax-driver/virtio-blk", "ax-std/alloc", "ax-std/fatfs"] +fs-basic = ["ax-std", "ax-driver/virtio-blk", "ax-std/alloc", "ax-std/fat"] debug-backtrace = ["ax-std", "dep:axbacktrace", "ax-std/backtrace"] debug-panic-path = ["ax-std", "dep:axbacktrace", "ax-std/backtrace"] display-basic = ["ax-std", "ax-driver/virtio-gpu", "dep:embedded-graphics", "ax-std/display"] diff --git a/test-suit/arceos/rust/src/lib.rs b/test-suit/arceos/rust/src/lib.rs index 00bbb856e2..d60df1e225 100644 --- a/test-suit/arceos/rust/src/lib.rs +++ b/test-suit/arceos/rust/src/lib.rs @@ -49,8 +49,8 @@ pub mod net; #[cfg(all( feature = "ax-std", any( - feature = "sched-cfs", - feature = "sched-rr", + feature = "cfs", + feature = "rr", feature = "task-affinity", feature = "task-ipi", feature = "task-irq", @@ -111,8 +111,8 @@ test_runner!( test_runner!("lockdep-detect", run_lockdep_detect, lockdep::detect::run); test_runner!("memtest", run_memtest, mem::test::run); test_runner!("net-loopback", run_net_loopback, net::loopback::run); -test_runner!("sched-cfs", run_sched_cfs, task::priority::run); -test_runner!("sched-rr", run_sched_rr, task::priority::run); +test_runner!("cfs", run_sched_cfs, task::priority::run); +test_runner!("rr", run_sched_rr, task::priority::run); test_runner!("task-affinity", run_task_affinity, task::affinity::run); test_runner!("task-ipi", run_task_ipi, task::ipi::run); test_runner!("task-irq", run_task_irq, task::irq::run); @@ -191,14 +191,10 @@ const SELECTED_TESTS: &[TestCase] = &[ "finite network address smoke", run_net_loopback, ), - #[cfg(feature = "sched-cfs")] - TestCase::new("sched-cfs", "CFS scheduling priority smoke", run_sched_cfs), - #[cfg(feature = "sched-rr")] - TestCase::new( - "sched-rr", - "round-robin scheduling priority smoke", - run_sched_rr, - ), + #[cfg(feature = "cfs")] + TestCase::new("cfs", "CFS scheduling priority smoke", run_sched_cfs), + #[cfg(feature = "rr")] + TestCase::new("rr", "round-robin scheduling priority smoke", run_sched_rr), #[cfg(feature = "task-affinity")] TestCase::new("task-affinity", "task CPU affinity", run_task_affinity), #[cfg(feature = "task-ipi")] @@ -207,10 +203,7 @@ const SELECTED_TESTS: &[TestCase] = &[ TestCase::new("task-irq", "task IRQ state", run_task_irq), #[cfg(feature = "task-parallel")] TestCase::new("task-parallel", "parallel computation", run_task_parallel), - #[cfg(all( - feature = "task-priority", - not(any(feature = "sched-cfs", feature = "sched-rr")) - ))] + #[cfg(all(feature = "task-priority", not(any(feature = "cfs", feature = "rr"))))] TestCase::new( "task-priority", "task priority scheduling smoke", diff --git a/test-suit/arceos/rust/src/task/mod.rs b/test-suit/arceos/rust/src/task/mod.rs index e0f68e0112..76d05d78b2 100644 --- a/test-suit/arceos/rust/src/task/mod.rs +++ b/test-suit/arceos/rust/src/task/mod.rs @@ -6,7 +6,7 @@ pub mod ipi; pub mod irq; #[cfg(feature = "task-parallel")] pub mod parallel; -#[cfg(any(feature = "task-priority", feature = "sched-cfs", feature = "sched-rr"))] +#[cfg(any(feature = "task-priority", feature = "cfs", feature = "rr"))] pub mod priority; #[cfg(feature = "task-sleep")] pub mod sleep; diff --git a/test-suit/arceos/rust/src/task/priority.rs b/test-suit/arceos/rust/src/task/priority.rs index 4b909789da..ce249772f1 100644 --- a/test-suit/arceos/rust/src/task/priority.rs +++ b/test-suit/arceos/rust/src/task/priority.rs @@ -72,7 +72,7 @@ pub fn run() -> crate::TestResult { tasks.into_iter().map(|task| task.join().unwrap()).unzip(); let actual = results.iter().sum::(); - if cfg!(feature = "sched-cfs") && thread::available_parallelism().unwrap().get() == 1 { + if cfg!(feature = "cfs") && thread::available_parallelism().unwrap().get() == 1 { assert!( leave_times[0] > leave_times[1] && leave_times[1] > leave_times[2] diff --git a/test-suit/starryos/board-visionfive2/build-riscv64gc-unknown-none-elf.toml b/test-suit/starryos/board-visionfive2/build-riscv64gc-unknown-none-elf.toml index 3a7943906e..d93ef7c797 100644 --- a/test-suit/starryos/board-visionfive2/build-riscv64gc-unknown-none-elf.toml +++ b/test-suit/starryos/board-visionfive2/build-riscv64gc-unknown-none-elf.toml @@ -1,7 +1,7 @@ # Build-time config template for StarryOS on VisionFive2. target = "riscv64gc-unknown-none-elf" features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/rtc", "ax-driver/serial", "ax-driver/starfive-jh7110-dwmmc", diff --git a/test-suit/starryos/qemu-smp1/build-aarch64-unknown-none-softfloat.toml b/test-suit/starryos/qemu-smp1/build-aarch64-unknown-none-softfloat.toml index 891475d9a2..a17dedbb22 100644 --- a/test-suit/starryos/qemu-smp1/build-aarch64-unknown-none-softfloat.toml +++ b/test-suit/starryos/qemu-smp1/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/nvme", "ax-driver/virtio-net", diff --git a/test-suit/starryos/qemu-smp1/build-riscv64gc-unknown-none-elf.toml b/test-suit/starryos/qemu-smp1/build-riscv64gc-unknown-none-elf.toml index 69dbbc4dfc..dcca868d8b 100644 --- a/test-suit/starryos/qemu-smp1/build-riscv64gc-unknown-none-elf.toml +++ b/test-suit/starryos/qemu-smp1/build-riscv64gc-unknown-none-elf.toml @@ -1,5 +1,5 @@ features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/nvme", "ax-driver/virtio-net", diff --git a/test-suit/starryos/qemu-smp4/build-aarch64-unknown-none-softfloat.toml b/test-suit/starryos/qemu-smp4/build-aarch64-unknown-none-softfloat.toml index c08661bf9a..4070a9da38 100644 --- a/test-suit/starryos/qemu-smp4/build-aarch64-unknown-none-softfloat.toml +++ b/test-suit/starryos/qemu-smp4/build-aarch64-unknown-none-softfloat.toml @@ -1,6 +1,6 @@ features = [ - "ax-feat/display", - "ax-feat/rtc", + "ax-runtime/display", + "ax-runtime/rtc", "ax-driver/nvme", "ax-driver/virtio-net", "ax-driver/virtio-gpu", diff --git a/test-suit/starryos/qemu-smp4/build-riscv64gc-unknown-none-elf.toml b/test-suit/starryos/qemu-smp4/build-riscv64gc-unknown-none-elf.toml index 7690f7eead..6a7546308d 100644 --- a/test-suit/starryos/qemu-smp4/build-riscv64gc-unknown-none-elf.toml +++ b/test-suit/starryos/qemu-smp4/build-riscv64gc-unknown-none-elf.toml @@ -1,5 +1,5 @@ features = [ - "ax-feat/rtc", + "ax-runtime/rtc", "ax-driver/serial", "ax-driver/nvme", "ax-driver/virtio-net", From 33e086eb6e7184f43def5be90665750a75bef4b1 Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Mon, 6 Jul 2026 14:03:03 +0800 Subject: [PATCH 2/8] docs: remove ax-feat restructuring design document --- p.md | 839 ----------------------------------------------------------- 1 file changed, 839 deletions(-) delete mode 100644 p.md diff --git a/p.md b/p.md deleted file mode 100644 index 9e2ce0f71f..0000000000 --- a/p.md +++ /dev/null @@ -1,839 +0,0 @@ -# 删除 `ax-feat` 并重建 ArceOS Feature 归属 - -## 目标 - -彻底删除 `os/arceos/api/axfeat`,重新建立 ArceOS feature 的职责层级,使 feature 关系直接、简单、可审计。 - -本方案不保留旧兼容: - -- 删除 `ax-feat` crate。 -- 删除所有 `ax-feat/*` feature 前缀。 -- 删除 `axfeat` 历史别名。 -- 不提供废弃兼容 crate。 -- 不引入新的 feature 聚合 crate 替代 `ax-feat`。 - -最终状态应满足: - -- 每个 feature 只由最贴近真实职责的 crate 拥有。 -- API crate 只控制 API 是否暴露。 -- Runtime crate 只控制系统装配和启动初始化。 -- User library crate 只控制用户侧门面能力。 -- StarryOS、Axvisor 等上层系统直接组合所需底层能力,不再通过 ArceOS API 聚合层转发。 - -## 当前问题 - -`ax-feat` 当前只有 feature 转发,没有实质 API。它把以下职责混在一起: - -- 用户可见 feature 名表。 -- runtime 初始化装配。 -- HAL、task、sync、driver、fs、net、display、input 等模块 feature 转发。 -- StarryOS / LKM / axbuild 的跨系统 feature 前缀入口。 - -这会带来几个问题: - -- feature 的真实所有权不清楚。 -- `ax-std`、`ax-api`、`ax-posix-api` 与 `ax-feat` 重复传递同一批底层 feature。 -- `ax-runtime` 已经有装配逻辑,但 `ax-feat` 又在外层重复描述依赖。 -- 上层系统依赖 `ax-feat` 后,很难判断它实际打开了哪些模块和隐式前置条件。 -- 新能力接入时容易形成“先加到底层,再加到 runtime,再加到 ax-feat,再加到 ax-std”的机械链条。 - -## Feature 保留标准 - -清理 `ax-feat` 时不能只做机械替换,还要重新判断每个 feature 是否有必要存在。 - -一个 feature 只有满足以下任一条件时才应保留: - -- 能显著裁剪镜像体积、依赖集合或初始化路径,例如 `fs`、`net`、`display`、`input`、`multitask`。 -- 选择真实不同的实现、格式、算法或硬件路径,例如 `ax-fs-ng/ext4`、`ax-fs-ng/fat`、`ax-task/rr`、`ax-task/cfs`。 -- 控制上层公开 API 是否存在,例如 `ax-api/fs`、`ax-posix-api/net`、`ax-std/fs`。 -- 控制平台或 CPU 能力,例如 `smp`、`irq`、`fp-simd`、`hv`、`uspace`、`xuantie-c9xx`。 -- 控制可选诊断、调试或加固能力,例如 `lockdep`、`backtrace`、`dwarf`、`stack-guard-page`、`stack-protector`。 - -以下情况不应继续作为 feature: - -- 空 feature,或没有任何行为差异的 marker,例如当前 `ax-fs-ng/std`。 -- 只为了转发另一个 crate 的 feature 而存在的 feature,例如 `ax-feat/*`。 -- crate 正常工作所必需的能力。必选能力应直接成为默认实现,而不是继续暴露给用户选择。 -- 某个上层能力已经必然包含的内部实现细节。例如 FIFO 是 `multitask` 的默认调度器,task stack canary 是 multitask task 栈基础防护时,不应再提供单独 feature。 - -## Feature 命名规则 - -清理后的 feature 名应短、稳定,并且能直接表达真实能力。命名优先级如下: - -- 已形成行业或架构共识的缩写直接保留,例如 `smp`、`irq`、`ipi`、`tls`、`rtc`、`dma`、`hv`。 -- 文件系统格式、调度算法、协议和设备型号直接使用真实名,例如 `ext4`、`fat`、`rr`、`cfs`、`virtio-net`、`aic8800`。 -- 避免为了说明所属层级而加前缀,例如不用 `fs-ext4` / `fs-fat`,因为 feature 已经在具体 crate 下有命名空间,且依赖关系会表达它属于 `fs`。 -- 避免过长的多段连字符名;只有当它是成熟术语、协议名或驱动名时才保留,例如 `stack-protector`、`virtio-net`。 -- 不为“看起来统一”而发明难懂缩写;短名必须仍然能让使用者判断真实含义。 -- Cargo feature 名是 per-crate 的;不同 crate 下的同名 feature 在 Cargo 层面互不相同。本方案允许 `ax-api/fs`、`ax-runtime/fs`、`ax-std/fs` 这类同名 feature 表达同一能力的不同职责切面,但调用关系必须通过各 crate 的 `Cargo.toml` 显式映射审计,不能跨 crate 推断等价性。 - -## 优化后各层 Feature 清单 - -### 应删除或默认化的 Feature - -| Feature | 处理方式 | 原因 | -| --- | --- | --- | -| `ax-feat/*` | 全部删除 | 纯聚合转发,职责重复 | -| `axfeat/*` | 全部删除 | 历史别名,不保留兼容 | -| `ax-fs-ng/std` | 删除 | 当前为空 feature,没有行为差异 | -| `ax-fs-ng/times` | 删除 feature,行为默认启用 | 文件时间戳字段和 POSIX stat 表面是基础文件系统语义;无 wall time provider 时已有 0 时间回退,不应作为编译期开关 | -| `ax-runtime/times` / `ax-std/times` / `ax-libc/times` | 删除 | 时间戳支持不再作为上层可选能力暴露 | -| `ax-runtime/dma` | 删除 | 当前只是 `paging` 别名,runtime 没有独立 DMA 初始化路径 | -| `ax-task/stack-canary` | 删除 feature,行为并入 `multitask` 默认实现 | 当前 `ax-task/multitask` 已强制启用它,不存在真实“不启用 task 栈 canary 的 multitask”配置 | -| `ax-task/fifo` / `ax-std/fifo` / 旧 `sched-fifo` | 删除 feature,FIFO 作为默认调度器 | `ax-task` 在未选择 `rr` / `cfs` 时天然使用 FIFO;单独 feature 只表达默认值,没有裁剪或选择意义 | -| `sched-rr` / `sched-cfs` 旧命名 | 删除旧名 | 改为 `rr` / `cfs`,避免在 `ax-task` 命名空间内重复 `sched-` 前缀 | -| `ax-std/dynld` | 不新增 | `ext-ld` 的真实含义是 external linker,不是 dynamic loader;不引入误导性新名字 | -| `aic8800-wifi` 旧命名 | 删除旧名 | 改为 `aic8800`;设备型号已足够表达真实驱动目标 | -| `dummy-if-not-enabled` 旧命名 | 删除旧名 | 改为 `stubs`,直接表达生成 stub API 的行为 | -| `ext4fs` / `fatfs` 旧命名 | 删除 | 改为统一的 `ext4` / `fat` 命名 | - -### 保留 Feature 必要性复核 - -下表按唯一能力名复核。若同一名字出现在 `ax-runtime`、`ax-std`、`ax-libc` 或 API 门面中,上层 feature 只作为直接映射入口保留,不代表底层能力被重复定义。 - -| Feature / 能力 | 复核结论 | -| --- | --- | -| `smp` | 保留。单核 / 多核启动、per-CPU、调度迁移、C ABI 中 pthread mutex layout 都有真实差异。 | -| `irq` | 保留。中断初始化、timer、IRQ wait/waker、设备 IRQ 注册均可裁剪。 | -| `ipi` | 保留。完整 IPI 队列 / 回调 / TLB shootdown 路径不是 `irq` 的必选子集。 | -| `wake-ipi` | 保留。它是只确认 SGI、唤醒 idle CPU 的轻量路径,可在没有完整 `ax-ipi` 队列时使用。 | -| `fp-simd`、`xuantie-c9xx`、`hv` | 保留。分别对应 CPU 扩展状态、具体 CPU errata / 扩展、虚拟化能力。 | -| `rtc` | 保留。不是所有平台都有 RTC,且会改变设备 probe 与 boot 时间输出。 | -| `paging` | 保留。无页表 / 有页表 runtime 差异巨大,且影响 DMA、framebuffer、地址空间、page fault。 | -| `tls` | 保留。TLS 初始化和 task TLS 字段不是所有配置必需。 | -| `uspace` | 保留。用户地址空间、页表切换 API、HAL / task wiring 都是可选能力。 | -| `multitask` | 保留。单任务和 scheduler runtime 是根本不同的执行模型。 | -| `preempt` | 保留为 `ax-task` 局部能力。抢占计数、抢占调度和 kernel guard 行为可独立于基础 multitask 审计。 | -| `rr`、`cfs` | 保留。它们是真实调度算法选择;FIFO 是默认值,不再作为 feature。 | -| `stack-guard-page` | 保留。guard page 依赖 paging / TLB flush / 诊断路径,成本和语义都不是必选。 | -| `stack-protector` | 保留。它控制 compiler-inserted canary runtime 符号,不是普通 task 栈 canary。 | -| `lockdep` | 保留。诊断能力,会引入锁依赖跟踪状态和跨 crate wiring。 | -| `task-ext`、`tracepoint-hooks` | 保留。它们分别暴露外部 task 扩展接口和 tracepoint hook,不是基础 task 必选行为。 | -| `alloc` | 保留。`ax-api` / `ax-posix-api` / `ax-std` 仍支持无 alloc 的更小 API 表面。 | -| `global-allocator` | 保留为 `ax-alloc` 局部 / `std-compat` 支撑能力;它不是普通应用 feature。 | -| `tlsf`、`buddy-slab` | 保留。它们是真实 allocator 后端选择。 | -| `tracking` | 保留。内存分配跟踪是可选诊断能力。 | -| `fs` | 保留。文件系统 API、block runtime、rootfs 初始化和 fd 集成可整体裁剪。 | -| `vfs` | 保留。它控制 `ax-fs-ng` 高层 VFS / cache / open-options / context API 是否编译。 | -| `ext4`、`fat` | 保留。当前仓库确有两种 rootfs / 磁盘格式实现。 | -| `net` | 保留。网络设备、网络栈和 socket API 可整体裁剪。 | -| `vsock` | 保留。vsock 是网络栈上的可选协议 / 设备路径。 | -| `dns` | 保留为 `ax-std` 网络行为开关。它只控制 `ToSocketAddrs` 是否进行 DNS 查询,并应依赖 `net`。 | -| `display`、`input` | 保留。图形和输入子系统是可选设备能力。 | -| `usb`、`virtio-*`、`aic8800` | 保留。它们是真实设备 / 总线 / 驱动选择。 | -| `dma` | 保留在 API 门面。它暴露显式 DMA 分配 API;runtime 不保留 `dma`,因为 runtime 没有独立 DMA 装配代码,DMA 在 runtime 侧只需要 `paging` 支撑。 | -| `axklib` glue | 不作为用户 feature 暴露。`ax-runtime` 默认提供 `axklib::Klib` glue;没有 `paging` / `irq` 时相关内存映射和 IRQ 操作返回 `Unsupported`。动态平台基础路径会使用 `axklib::mmio`,因此该 glue 不能挂在 `paging`、`fs` 或 `net` 等可选 feature 后面。 | -| `fd`、`pipe`、`select`、`poll`、`epoll` | 保留。POSIX fd 表和 I/O multiplexing API 可分别裁剪,`fs` / `net` 通过 `fd` 组合。 | -| `stubs` | 保留在 `ax-api`。它用于生成未启用 API 的 stub 符号,不是 runtime 能力。 | -| `std-compat` | 保留。它改变 lang items / libc compat / global allocator 入口,属于真实构建模式。 | -| `ext-ld` | 保留。它控制 `ax-runtime/build.rs` 生成可扩展链接脚本 `runtime.x` 而非最终 `linker.x`,Axvisor / StarryOS / LKM 实际依赖该模式追加自定义 section。 | -| `backtrace`、`dwarf` | 保留。基础栈回溯和 DWARF 符号化依赖集合明显不同。 | -| `copy` | 保留为 `ax-mm` 局部能力。它只在需要复制页表映射时启用 `ax-page-table-multiarch/copy-from`。 | - -### ArceOS 底层模块层 - -| Crate | 保留 feature | 默认化 / 删除 | -| --- | --- | --- | -| `ax-hal` | `smp`, `irq`, `ipi`, `fp-simd`, `xuantie-c9xx`, `rtc`, `paging`, `tls`, `uspace`, `hv` | `host-test`、`axvisor-linker` 只作为测试 / 构建内部 feature,不进入用户能力层 | -| `ax-task` | `multitask`, `irq`, `ipi`, `preempt`, `smp`, `stack-guard-page`, `lockdep`, `task-ext`, `tls`, `tracepoint-hooks`, `uspace`, `rr`, `cfs` | 删除 `stack-canary` 独立 feature;删除 `sched-fifo`,FIFO 为默认调度器;`host-test` / `test` 只作为测试内部 feature | -| `ax-sync` | `multitask`, `lockdep` | 无 | -| `ax-alloc` | `global-allocator`, `tlsf`, `buddy-slab`, `tracking` | 无 | -| `ax-mm` | `copy` | 无;仅当调用方需要复制页表映射时启用 | -| `ax-fs-ng` | `vfs`, `ext4`, `fat`, `lockdep` | 删除 `std` 和 `times`;时间戳行为默认编译 | -| `ax-net` | `vsock` 等真实网络栈变体 | 无 | -| `ax-display` | 无 feature,作为 display 能力模块被上层可选依赖 | 无 | -| `ax-input` | 无 feature,作为 input 能力模块被上层可选依赖 | 无 | -| `axbacktrace` | `alloc`, `dwarf` | 无 | - -### `ax-runtime` - -`ax-runtime` 只保留会改变 runtime 初始化或全局系统装配的 feature。 - -| 保留 feature | 含义 | -| --- | --- | -| `irq` | 中断初始化、IRQ 分发、驱动 IRQ 集成 | -| `ipi` | 完整 IPI 队列 / 回调支持;清理时必须补齐 `irq`、`dep:ax-ipi`、`ax-hal/ipi`、`ax-task?/ipi` wiring | -| `wake-ipi` | 轻量 idle wake IPI handler | -| `smp` | 多核启动和 secondary CPU runtime 流程 | -| `uspace` | user address space 相关 HAL / task wiring,包括任务切换页表 API | -| `paging` | 页表、地址空间和 page fault runtime wiring | -| `multitask` | task scheduler runtime 初始化 | -| `tls` | runtime TLS 设置 | -| `fs` | 文件系统 runtime 基础栈:block runtime、rootfs 初始化、`ax-fs-ng/vfs`、page cache、block IRQ / task ops | -| `ext4` | `fs` + `ax-fs-ng/ext4` | -| `fat` | `fs` + `ax-fs-ng/fat` | -| `net` | `irq` + `multitask` + `paging` + 网络设备和网络栈注册 | -| `vsock` | `net` + vsock 设备 / 协议支持 | -| `display` | `paging` + display 设备注册 | -| `input` | `paging` + input 设备注册 | -| `rtc` | RTC 设备支持 | -| `aic8800` | SG2002 AIC8800 Wi-Fi runtime bring-up | -| `std-compat` | Rust std 兼容 runtime hook | -| `ext-ld` | 生成可扩展链接脚本 `runtime.x` 而非最终 `linker.x`,供外层镜像追加 section | -| `lockdep` | runtime 参与的系统层 lockdep wiring,尤其是 `fs` 启用时传播到 `ax-fs-ng/lockdep` | -| `stack-guard-page` | guard page 初始化和诊断路径;承接旧 `ax-feat/stack-guard-page` 的 `ipi` / `multitask` / `paging` 前置条件 | -| `stack-protector` | stack protector runtime hook | - -`ax-runtime` 默认依赖 `axklib` 并提供 `axklib::Klib` glue。这不是用户可选择的能力,而是动态平台和驱动基础路径需要的 runtime glue;未启用 `paging` 或 `irq` 时,相关 `mem_iomap` / IRQ 操作应返回 `Unsupported`,而不是让链接符号缺失。 - -`ax-runtime/fs` 本身表示“文件系统 runtime 栈存在”,不表示具体磁盘格式。当前仓库确实有 `ext4` 和 `fat` 两种文件系统格式,因此具体 rootfs 格式应通过 `ext4` / `fat` 选择。构建可启动 rootfs 时,不应只启用 `fs` 而不启用任何格式 feature。 - -### API 与用户库层 - -| Crate | 保留 feature | 说明 | -| --- | --- | --- | -| `ax-api` | `irq`, `ipi`, `alloc`, `paging`, `dma`, `multitask`, `fs`, `net`, `display`, `stubs` | 只控制 Rust API / 类型是否暴露,不负责 runtime 装配 | -| `ax-posix-api` | `smp`, `irq`, `alloc`, `multitask`, `lockdep`, `fd`, `fs`, `net`, `pipe`, `select`, `poll`, `epoll` | `smp` / `lockdep` 影响 build.rs 生成的 C 头文件和 pthread mutex ABI;该层只控制 POSIX API / C ABI 表面 | -| `ax-std` | `std-compat`, `ext-ld`, `smp`, `fp-simd`, `uspace`, `hv`, `irq`, `ipi`, `wake-ipi`, `alloc`, `paging`, `dma`, `tls`, `multitask`, `lockdep`, `task-ext`, `tracepoint-hooks`, `rr`, `cfs`, `stack-guard-page`, `stack-protector`, `fs`, `ext4`, `fat`, `net`, `vsock`, `aic8800`, `dns`, `fd`, `display`, `input`, `usb`, `rtc`, `backtrace`, `dwarf`, `virtio-*` | Rust 应用侧门面;`fs` 打开文件 API 和基础 runtime fs 栈,但不选择具体 rootfs 格式,格式用 `ext4` / `fat`;`xuantie-c9xx` 这类具体 CPU errata / 扩展由平台或系统集成者直接启用 `ax-hal/xuantie-c9xx`,不放入通用应用门面 | -| `ax-libc` | `smp`, `fp-simd`, `irq`, `alloc`, `tls`, `multitask`, `lockdep`, `stack-protector`, `fs`, `ext4`, `fat`, `net`, `fd`, `pipe`, `select`, `poll`, `epoll` | C 应用侧门面;通过 `ax-posix-api` 暴露 API,通过 `ax-runtime` 装配系统能力 | - -## 目标归属模型 - -### 1. 模块局部 Feature - -每个底层 crate 只拥有本 crate 的局部能力。 - -| Crate | 负责的 feature | -| --- | --- | -| `ax-hal` | `smp`, `irq`, `ipi`, `fp-simd`, `xuantie-c9xx`, `rtc`, `paging`, `tls`, `uspace`, `hv` | -| `ax-task` | `multitask`, `irq`, `ipi`, `preempt`, `smp`, `stack-guard-page`, `task-ext`, `tls`, `tracepoint-hooks`, `uspace`, `rr`, `cfs`, `lockdep` | -| `ax-sync` | `multitask`, `lockdep` | -| `ax-mm` | `copy` | -| `ax-runtime` | runtime 初始化和系统装配 feature | -| `ax-driver` | 具体设备、总线和 probe feature | -| `ax-fs-ng` | `vfs`, `fat`, `ext4`, `lockdep` 等文件系统实现 / API feature | -| `ax-net` | `vsock` 等网络栈 feature | -| `ax-display` | display 子系统 feature | -| `ax-input` | input 子系统 feature | -| `axbacktrace` | `alloc`, `dwarf` | - -规则:crate 不应暴露只用于命名其他层产物概念的 feature。 - -### 2. Runtime 装配 Feature - -`ax-runtime` 拥有系统装配图。只要启用某项能力需要启动期初始化、全局 runtime 状态、设备探测、IRQ 注册、DMA 设置或调度器参与,对应依赖就应放在 `ax-runtime`。 - -目标 `ax-runtime` feature 职责: - -| Feature | 含义 | -| --- | --- | -| `irq` | runtime 中断处理和 driver IRQ 集成 | -| `ipi` | 完整 IPI 队列 / 回调支持,同时包含 IRQ、HAL、task 的 IPI wiring | -| `wake-ipi` | 轻量 idle wake IPI handler | -| `smp` | runtime SMP 启动和 task SMP wiring | -| `uspace` | runtime user address space wiring,同时启用 `ax-hal/uspace` 和 `ax-task?/uspace` | -| `paging` | runtime 页表和内存管理支持 | -| `multitask` | runtime task scheduler 集成 | -| `tls` | runtime TLS 设置 | -| `fs` | runtime block driver、VFS/rootfs、DMA、IRQ、multitask 前置条件 | -| `ext4` | runtime ext4 rootfs 支持 | -| `fat` | runtime FAT rootfs 支持 | -| `net` | runtime 网络驱动和网络栈注册;自带 `irq`、`multitask`、`paging` 前置条件 | -| `vsock` | runtime vsock 支持 | -| `display` | runtime display 设备注册;保留旧 `ax-feat/display` 的 `paging` 前置条件 | -| `input` | runtime input 设备注册;保留旧 `ax-feat/input` 的 `paging` 前置条件 | -| `rtc` | runtime RTC 设备支持 | -| `aic8800` | runtime SG2002 AIC8800 Wi-Fi bring-up | -| `std-compat` | Rust std 兼容 runtime hook | -| `ext-ld` | 生成可扩展链接脚本 `runtime.x` 而非最终 `linker.x`,供外层镜像追加 section | -| `lockdep` | runtime 参与的系统层 lockdep wiring,尤其是 `fs` 启用时传播到 `ax-fs-ng/lockdep` | -| `stack-guard-page` | runtime guard-page 初始化;自带 `ipi`、`multitask`、`paging` 前置条件 | -| `stack-protector` | runtime stack protector hook | - -规则:`ax-runtime` 可以依赖更底层模块。更底层模块不能依赖 user library 或 API facade crate。 - -### 3. API 门面 Feature - -`ax-api` 和 `ax-posix-api` 只描述哪些公开 API 被编译。它们可以启用类型检查和 API 实现所需的直接依赖,但不能再通过全局 feature 聚合层转发。 - -`ax-api` 目标 feature: - -| Feature | 清理后的直接展开 | -| --- | --- | -| `irq` | `ax-task?/irq`;只保持 API 行为和 `WaitQueue::wait_timeout*` 编译所需 task IRQ 能力,不启用 `ax-runtime/irq` | -| `ipi` | `dep:ax-ipi` | -| `alloc` | `dep:ax-alloc` | -| `paging` | `dep:ax-mm` | -| `dma` | `dep:ax-dma` | -| `multitask` | `ax-task/multitask`, `ax-sync/multitask` | -| `fs` | `dep:ax-fs-ng` | -| `net` | `dep:ax-net` | -| `display` | `dep:ax-display` | -| `stubs` | 原 `dummy-if-not-enabled`,用于在真实 API feature 未启用时生成 stub 符号 | - -`ax-posix-api` 目标 feature: - -| Feature | 清理后的直接展开 | -| --- | --- | -| `smp` | 空展开;保留该 feature 让 build.rs 在计算 `pthread_mutex_t` 内存布局时区分 SMP 与非 SMP,并作为 bindgen 的 `AX_CONFIG_SMP` 输入 | -| `irq` | 仅当 POSIX API 代码确实需要 IRQ 符号时保留直接依赖 | -| `alloc` | `dep:ax-alloc` | -| `multitask` | `alloc`, `ax-task/multitask`, `ax-sync/multitask` | -| `lockdep` | `multitask`, `ax-sync/lockdep`, `ax-kspin/lockdep`;同时被 build.rs 用于 `pthread_mutex_t` layout 计算,保证 C ABI 与 Rust 锁布局一致 | -| `fd` | `alloc`, `dep:scope-local` | -| `fs` | `dep:ax-fs-ng`, `fd` | -| `net` | `dep:ax-net`, `fd` | -| `pipe` | `fd` | -| `select` | `fd` | -| `poll` | `fd` | -| `epoll` | `fd` | - -规则:API 门面的 feature 名可以和 runtime feature 名相同,但 API 门面不负责启用 runtime 装配。 - -### 4. 用户库 Feature - -`ax-std` 和 `ax-libc` 成为唯一的 ArceOS 应用侧便利层。 - -`ax-std` feature 策略: - -- Rust 应用选择 `ax-std/*`。 -- `ax-std` 显式组合以下内容: - - 通过 `ax-api/*` 控制 API 可见性。 - - 通过 `ax-posix-api/*` 控制 POSIX 兼容接口。 - - 通过 `ax-runtime/*` 控制 runtime 装配。 - - 只有 `ax-std` 自身直接使用底层符号时,才直接启用底层模块 feature。 - - 只有历史上 `ax-std` 已承诺的默认应用驱动选择,才保留在 `ax-std` 中。 - -目标 `ax-std` 映射: - -| Feature | 清理后的直接展开 | -| --- | --- | -| `std-compat` | `ax-alloc/global-allocator`, `ax-runtime/std-compat` | -| `smp` | `ax-runtime/smp`, `ax-kspin/smp`, `ax-posix-api/smp` | -| `fp-simd` | `ax-hal/fp-simd` | -| `uspace` | `ax-runtime/uspace` | -| `hv` | `ax-hal/hv` | -| `irq` | `ax-api/irq`, `ax-posix-api/irq`, `ax-runtime/irq` | -| `ipi` | `ax-api/ipi`, `ax-runtime/ipi` | -| `wake-ipi` | `ax-runtime/wake-ipi` | -| `ext-ld` | `ax-runtime/ext-ld` | -| `alloc` | `ax-api/alloc`, `ax-io/alloc`, `ax-posix-api/alloc`;`ax-alloc` 仍作为普通依赖存在,不写 `dep:ax-alloc`,除非后续将该依赖 optional 化 | -| `paging` | `alloc`, `ax-runtime/paging` | -| `dma` | `ax-api/dma`, `ax-runtime/paging` | -| `tls` | `ax-runtime/tls` | -| `multitask` | `ax-api/multitask`, `ax-posix-api/multitask`, `ax-runtime/multitask` | -| `lockdep` | `multitask`, `ax-posix-api/lockdep`, `ax-runtime/lockdep` | -| `task-ext` | `ax-task/task-ext` | -| `tracepoint-hooks` | `ax-task/tracepoint-hooks` | -| `rr` | `irq`, `multitask`, `ax-task/rr` | -| `cfs` | `irq`, `multitask`, `ax-task/cfs` | -| `stack-guard-page` | `ax-runtime/stack-guard-page` | -| `stack-protector` | `ax-runtime/stack-protector` | -| `fs` | `ax-api/fs`, `ax-posix-api/fs`, `ax-runtime/fs`, `ax-driver/virtio-blk`, `fd` | -| `ext4` | `fs`, `ax-runtime/ext4` | -| `fat` | `fs`, `ax-runtime/fat` | -| `net` | `ax-api/net`, `ax-posix-api/net`, `ax-runtime/net`, `ax-driver/virtio-net`, `fd` | -| `vsock` | `ax-runtime/vsock` | -| `aic8800` | `ax-runtime/aic8800` | -| `dns` | `net`;仅改变 `ToSocketAddrs` 是否调用 DNS 查询,不单独启用新的底层模块 | -| `fd` | `ax-posix-api/fd`, `ax-posix-api/poll` | -| `display` | `ax-api/display`, `ax-runtime/display` | -| `input` | `ax-runtime/input` | -| `usb` | `irq`, `ax-driver/usb` | -| `rtc` | `ax-runtime/rtc` | -| `backtrace` | `axbacktrace/alloc` | -| `dwarf` | `axbacktrace/dwarf` | -| `virtio-blk` | `ax-driver/virtio-blk` | -| `virtio-net` | `ax-driver/virtio-net` | -| `virtio-gpu` | `ax-driver/virtio-gpu` | -| `virtio-input` | `ax-driver/virtio-input` | -| `virtio-socket` | `ax-driver/virtio-socket` | - -`ax-libc` feature 策略: - -- C 应用选择 `ax-libc/*`。 -- `ax-libc` 直接组合 POSIX API 和 runtime 装配。 -- `ax-libc` 不能依赖 `ax-std`。 - -目标 `ax-libc` 映射: - -| Feature | 清理后的直接展开 | -| --- | --- | -| `smp` | `ax-runtime/smp`, `ax-kspin/smp`, `ax-posix-api/smp` | -| `fp-simd` | `ax-hal/fp-simd` | -| `irq` | `ax-posix-api/irq`, `ax-runtime/irq` | -| `alloc` | `ax-posix-api/alloc` | -| `tls` | `alloc`, `ax-runtime/tls` | -| `multitask` | `ax-posix-api/multitask`, `ax-runtime/multitask` | -| `lockdep` | `ax-posix-api/lockdep`, `ax-runtime/lockdep` | -| `stack-protector` | `ax-runtime/stack-protector` | -| `fs` | `ax-posix-api/fs`, `ax-runtime/fs`, `fd` | -| `ext4` | `fs`, `ax-runtime/ext4` | -| `fat` | `fs`, `ax-runtime/fat` | -| `net` | `ax-posix-api/net`, `ax-runtime/net`, `fd` | -| `fd` | `ax-posix-api/fd` | -| `pipe` | `ax-posix-api/pipe` | -| `select` | `ax-posix-api/select` | -| `poll` | `ax-posix-api/poll` | -| `epoll` | `ax-posix-api/epoll` | - -规则:`ax-std` 和 `ax-libc` 应保持显式,但不要重复展开 `ax-runtime` 已经负责的下层细节。它们的 feature 表应让组合关系清晰可审计。 - -### 5. 上层系统 Feature - -StarryOS 和 Axvisor 不能再依赖 `ax-feat`。 - -StarryOS 目标策略: - -- `starry-kernel` 直接启用所需 ArceOS 基础模块: - - `ax-hal/*` - - `ax-runtime/*` - - `ax-task/*` - - `ax-sync/*` - - `ax-driver/*` - - `ax-fs-ng/*` - - `ax-net/*` - - `axbacktrace/*` -- `starry-kernel` 如果直接使用 `ax_sync::Mutex` 等 sleepable / task-aware 同步原语,应在自身依赖上启用 `ax-sync/multitask`,不能依赖 `starryos` 镜像包或其他上层组合“碰巧”打开。 -- `starryos` 镜像包主要启用 `starry-kernel/*`、平台和具体驱动。 -- LKM crate 依赖与主 StarryOS kernel image 相同的直接底层 feature,不能再导入单独的 feature 聚合路径。 - -Axvisor 目标策略: - -- 只有在构建 ArceOS 风格用户库接口时,才使用 `ax-std/*`。 -- hypervisor / platform 装配使用直接底层 feature: - - `ax-hal/hv` - - `ax-runtime/*` - - `ax-task/*` - - `ax-driver/*` - -规则:上层系统应表现为系统集成者,而不是应用 crate。 - -## 具体清理步骤 - -### 步骤 1:冻结当前 Feature 图 - -改动前先生成基线: - -```bash -cargo metadata --no-deps --format-version 1 > tmp/axfeat-cleanup-metadata-before.json -rg -n "ax-feat|axfeat" . > tmp/axfeat-cleanup-refs-before.txt -``` - -把每个当前 `ax-feat` 引用归入以下类别之一: - -- `ax-std` 映射。 -- `ax-libc` 映射。 -- `ax-api` API 可见性。 -- `ax-posix-api` API 可见性。 -- `ax-runtime` 装配。 -- StarryOS 系统装配。 -- Axvisor 系统装配。 -- axbuild feature 解析。 -- docs / changelog / 生成的组件文档。 - -### 步骤 2:让 API Crate 脱离 `ax-feat` - -编辑: - -- `os/arceos/api/arceos_api/Cargo.toml` -- `os/arceos/api/arceos_posix_api/Cargo.toml` - -必要改动: - -- 删除 `ax-feat.workspace = true`。 -- 将所有 `ax-feat/*` feature 展开替换为上文 API 映射中的直接本地依赖。 -- 保持 optional dependency 仍为 optional。 -- 除非 API 代码确实调用 runtime 符号,否则不要从 API crate 启用 `ax-runtime/*`。 -- 删除 `arceos_api/stack-guard-page` feature;当前 `arceos_api/src` 没有对应 API 符号,stack guard page 的真实处理在 `ax-runtime` 和 `ax-task`。 -- 将 `dummy-if-not-enabled` 重命名为 `stubs`,避免使用描述实现细节的长 feature 名。 - -期望结果: - -```bash -rg -n "ax-feat|axfeat" os/arceos/api/arceos_api os/arceos/api/arceos_posix_api -``` - -除非历史 changelog 按仓库策略需要保留,否则不应再有匹配。 - -### 步骤 3:收敛底层模块和 `ax-runtime` Feature - -编辑: - -- `os/arceos/modules/axtask/Cargo.toml` -- `os/arceos/modules/axfs-ng/Cargo.toml` -- `os/arceos/modules/axfs-ng/src/file/handle.rs` -- `os/arceos/modules/axfs-ng/src/fs/ext4/rsext4/*` -- `os/arceos/modules/axruntime/Cargo.toml` - -必要改动: - -- 删除 `ax-task/sched-fifo` 和 `ax-std/sched-fifo`。FIFO 是 `multitask` 未选择 `rr` / `cfs` 时的默认调度器,不再作为 feature。 -- 将 `ax-task/sched-rr`、`ax-task/sched-cfs` 分别重命名为 `ax-task/rr`、`ax-task/cfs`。这是调度算法自身的真实名字,`sched-` 前缀在 `ax-task` 命名空间内属于冗余。 -- 删除 `ax-task/stack-canary` 独立 feature,并让 task stack canary 成为 `multitask` 的默认实现细节。 -- 保留 `ax-runtime/ext-ld`,因为它通过 `CARGO_FEATURE_EXT_LD` 控制 `axruntime/build.rs` 输出 `runtime.x` 还是 `linker.x`。不要引入 `dynld` 新名,避免把 external linker 误读为 dynamic loader。 -- 将 `ax-runtime/aic8800-wifi` 和 `ax-driver/aic8800-wifi` 重命名为 `aic8800`,并保持 runtime 侧自带 `net`、`ax-driver/aic8800`、`dep:aic8800`、`dep:sdhci-cv1800` 等真实 Wi-Fi bring-up 依赖。 -- `ax-runtime` 默认依赖 `axklib` 并编译 `axklib::Klib` glue。动态平台基础路径会无条件使用 `axklib::mmio`,因此 `axklib` 不能只挂在 `paging`、`fs` 或 `net` 后面;未启用 `paging` / `irq` 时对应操作返回 `Unsupported`。 -- 删除 `dma = ["paging"]`。 -- 将 `fs` feature 中的 `"dma"` 替换为 `"paging"`,避免 `fs` 引用已删除的 runtime feature。 -- 保留 `fs` feature 中的 `"ax-fs-ng/vfs"`,因为它控制 `ax-fs-ng` 高层 VFS / cache / open-options / context API 是否编译。 -- 删除 `ax-fs-ng/times` feature,并把当前 `#[cfg(feature = "times")]` 门控改为默认编译。文件元数据、POSIX stat 字段、`utime` / `utimensat` 语义都天然需要时间戳;无 wall time provider 时保留当前返回 0 的运行时回退即可。 -- 新增 `lockdep = ["ax-fs-ng?/lockdep"]`,让启用 `lockdep + fs` 时文件系统层锁也进入 lockdep 诊断。 -- 新增 `uspace = ["ax-hal/uspace", "ax-task?/uspace"]`,承接旧 `ax-feat/uspace`,避免只启用 HAL 而丢失 `TaskControlBlock::switch_page_table()` 等 task 层 API。 -- 将 `stack-guard-page` 增强为 `["ipi", "multitask", "paging", "ax-task?/stack-guard-page"]`,承接旧 `ax-feat/stack-guard-page` 的完整前置条件,避免 StarryOS 等直接启用 runtime feature 时丢失 IPI TLB shootdown 路径。 -- 将 `net` 改为自包含系统装配 feature,至少包含: - -```toml -net = [ - "irq", - "multitask", - "paging", - "dep:ax-net", - "dep:rd-net", - "dep:spin", - "ax-driver/net", -] -``` - -- 将 `display` 和 `input` 补上 `paging`,保持旧 `ax-feat/display`、`ax-feat/input` 的前置条件语义: - -```toml -display = ["paging", "dep:ax-display", "ax-driver/display"] -input = ["paging", "dep:ax-input", "ax-driver/input"] -``` - -- 增强 `ipi` feature,使它承接旧 `ax-feat/ipi` 的完整 wiring: - -```toml -ipi = ["irq", "dep:ax-ipi", "ax-hal/ipi", "ax-task?/ipi"] -``` - -这样 `ax-std/ipi` 和上层系统只需要启用 `ax-runtime/ipi`,不会丢失 HAL/task IPI 路径。 - -### 步骤 4:让 `ax-std` 脱离 `ax-feat` - -编辑: - -- `os/arceos/ulib/axstd/Cargo.toml` -- `os/arceos/ulib/axstd/src/lib.rs` - -必要改动: - -- 删除 `ax-feat.workspace = true`。 -- 将每个 `ax-feat/*` 展开替换为直接的 `ax-runtime/*`、`ax-hal/*`、`ax-task/*`、`ax-sync/*`、`ax-driver/*`、`axbacktrace/*` 或 API 门面 feature。 -- 更新 crate 文档,删除 “`ax-std` features are exactly the same as those in `ax-feat`” 之类描述。 -- 保持 `ax-std` 作为 ArceOS Rust 应用 feature 门面。 -- `rr` / `cfs` 必须组合 `irq` 和 `multitask`,承接旧 `ax-feat/sched-rr` / `ax-feat/sched-cfs` 的中断前置条件。 -- 这是有意的行为改进,不是等价机械替换:旧 `ax-feat/sched-*` 只会打开 `ax-task` 的调度算法 feature,可能缺少 runtime scheduler 初始化和用户侧 API;清理后用户启用 `ax-std/rr` 或 `ax-std/cfs` 应得到完整可运行的 multitask runtime 栈。FIFO 不需要独立 feature,启用 `multitask` 且不选择 `rr` / `cfs` 即为 FIFO。 - -重要规则: - -- 不要为了缩短 feature 列表而创建 `base-fs`、`runtime-net` 之类辅助别名。显式组合更容易审计。 -- 不要在 `ax-std` 重复展开 `ax-runtime` 已经负责的 `ax-hal`、`ax-task`、`ax-driver` 细节,除非 `ax-std` 自身直接使用对应符号。 - -### 步骤 5:让 `ax-libc` 脱离 `ax-feat` - -编辑: - -- `os/arceos/ulib/axlibc/Cargo.toml` - -必要改动: - -- 删除 `ax-feat.workspace = true`。 -- 新增 `ax-runtime.workspace = true` 和 `ax-kspin.workspace = true`,因为清理后的 `ax-libc` feature 会直接引用 `ax-runtime/*` 和 `ax-kspin/smp`。 -- 将 `fp-simd`、`irq`、`tls`、`multitask`、`lockdep`、`stack-protector` 映射替换为直接模块 / runtime 映射。 -- 保持 libc 专属 feature(`fd`、`pipe`、`select`、`poll`、`epoll`)通过 `ax-posix-api` 路由。 -- 新增 `poll = ["ax-posix-api/poll"]`;当前 `ax-posix-api/poll` 已存在,但 `ax-libc` 尚未暴露同名 feature。 -- 新增 `ext4`、`fat` 两个 C 应用侧 feature,并分别映射到 `fs + ax-runtime/ext4`、`fs + ax-runtime/fat`。 - -### 步骤 6:让 StarryOS 脱离 `ax-feat` - -至少编辑: - -- `os/StarryOS/kernel/Cargo.toml` -- `os/StarryOS/starryos/Cargo.toml` -- `os/StarryOS/lkm/*/Cargo.toml` -- `os/StarryOS/lkm/README.md` -- `os/StarryOS/docs/*` 中提到 `ax-feat` 的引用。 -- `apps/starry/*` 中提到 `ax-feat` 的文档或构建配置。 - -目标替换示例: - -| 旧写法 | 新写法 | -| --- | --- | -| `ax-feat/input` | `ax-runtime/input`,如果代码直接使用 `ax-input` API,再加 `dep:ax-input` | -| `ax-feat/ipi` | `ax-runtime/ipi`,如果 kernel 代码直接使用 IPI API,再加 `dep:ax-ipi` | -| `ax-feat/backtrace` | `axbacktrace/alloc` | -| `ax-feat/fp-simd` | `ax-hal/fp-simd` | -| `ax-feat/xuantie-c9xx` | `ax-hal/xuantie-c9xx` | -| `ax-feat/uspace` | `ax-runtime/uspace` | -| `ax-feat/multitask` | `ax-runtime/multitask`,如果 kernel 代码直接使用 task API,再加 `ax-task/multitask` | -| `ax-feat/task-ext` | `ax-task/task-ext` | -| `ax-feat/tracepoint-hooks` | `ax-task/tracepoint-hooks` | -| `ax-feat/sched-fifo` | 删除,无替代 feature;启用 `ax-runtime/multitask` 且不启用 `rr` / `cfs` 即为 FIFO | -| `ax-feat/sched-rr` | `ax-runtime/irq`, `ax-runtime/multitask`, `ax-task/rr` | -| `ax-feat/sched-cfs` | `ax-runtime/irq`, `ax-runtime/multitask`, `ax-task/cfs` | -| `ax-feat/ext4fs` | `ax-runtime/ext4` | -| `ax-feat/fatfs` | `ax-runtime/fat` | -| `ax-feat/net` | `ax-runtime/net`,如果 kernel 代码直接使用 `ax-net` 符号,保留直接依赖 `ax-net` | -| `ax-feat/vsock` | `ax-runtime/vsock`,如果 kernel 代码直接使用 net 符号,再加 `ax-net/vsock` | -| `ax-feat/usb` | `ax-runtime/irq`, `ax-driver/usb` | -| `ax-feat/aic8800-wifi` | `ax-runtime/aic8800` | -| `ax-feat/stack-guard-page` | `ax-runtime/stack-guard-page`,并保留 Starry 诊断 feature | -| `ax-feat/stack-protector` | `ax-runtime/stack-protector` | -| `ax-feat/fs-times` | 删除,无替代 feature;文件时间戳默认启用 | -| `ax-feat/ext-ld` | `ax-runtime/ext-ld`;若通过 `ax-std` 入口构建,则使用 `ax-std/ext-ld` | -| `ax-feat/rtc` | `ax-runtime/rtc` | -| `ax-feat/display` | `ax-runtime/display` | -| `ax-feat/irq` | `ax-runtime/irq` | -| `ax-feat/smp` | 对用户侧门面映射为 `ax-runtime/smp` + `ax-kspin/smp` + `ax-posix-api/smp`;对内部 crate 则按实际消费的 SMP 能力直接启用对应模块 feature | - -StarryOS 清理后的依赖策略: - -- `starry-kernel` 应显式依赖自己消费的 ArceOS 模块。 -- `starryos` 不应启用底层 ArceOS feature,除非它拥有该 feature 的镜像级集成职责。 -- LKM 示例应直接镜像主 StarryOS kernel 的 feature 表面。 - -### 步骤 7:让 Axvisor 脱离间接 `ax-feat` - -编辑: - -- `os/axvisor/Cargo.toml` -- `virtualization/*/Cargo.toml` 中仍存在 `ax-feat` 引用的文件。 -- 提到 `ax-feat` 的 Axvisor 文档和构建测试。 - -如果 Axvisor 只通过 `ax-std` 间接接收 `ax-feat`,则本步骤主要是在 `ax-std` 清理后做验证。 - -同时替换旧文件系统格式 feature 名: - -- `ax-std/ext4fs` 改为 `ax-std/ext4`。 -- `ax-std/fatfs` 改为 `ax-std/fat`。 - -### 步骤 8:从 Workspace 删除 `ax-feat` - -编辑: - -- 根目录 `Cargo.toml`。 -- 任何 workspace package 列表或 dependency table 中的 `ax-feat` 条目。 -- release / changelog 工具中枚举 package 的位置。 -- std-test whitelist 中的 `ax-feat` 条目。 -- 如果仓库提交了生成文档索引,也要同步清理。 - -删除: - -- `os/arceos/api/axfeat/Cargo.toml` -- `os/arceos/api/axfeat/src/lib.rs` -- `os/arceos/api/axfeat/CHANGELOG.md` -- `os/arceos/api/axfeat/` - -不要添加替代 package。 - -### 步骤 9:删除 `axbuild` 中的 `ax-feat` 支持 - -编辑: - -- `scripts/axbuild/src/build/platform.rs` -- `scripts/axbuild/src/build/info.rs` -- `scripts/axbuild/src/build/std_build.rs` -- `scripts/axbuild/src/arceos/cbuild/features.rs` -- `scripts/axbuild/src/starry/build.rs` -- `scripts/axbuild/src/axvisor/build/features.rs` -- 所有引用 `ax-feat` 或 `axfeat` 的 axbuild 测试。 - -清理后的必要行为: - -- `FEATURES=axfeat/net` 非法。 -- `FEATURES=ax-feat/net` 非法。 -- Build Info 不再自动检测 `AxFeat` 前缀族。 -- 应用包必须依赖 `ax-std`、`ax-libc` 或直接依赖更底层模块。 -- `axbuild` 不再归一化 `axfeat` 别名。 -- `axbuild` 不再剥离 `ax-feat/` 前缀。 -- `axbuild` 不再把 `ext4fs` / `fatfs` 当作可继续传播的旧 feature 名;构建配置必须使用 `ext4` / `fat`。 -- C app feature 映射不再把未知低层系统 feature 回退到 `ax-feat/{unknown}`,而应直接映射到模块 / runtime feature 或拒绝。 - -删除: - -- `AxFeaturePrefixFamily::AxFeat` -- `normalize_legacy_feature_alias()` 中对 `axfeat` 的处理。 -- `is_removed_dynamic_platform_feature()` 中对 `ax-feat/plat-dyn` 的分支。 -- `feature_family_from_existing_features()` 对 `ax-feat/` 的检测。 -- `detect_ax_feature_prefix_family()` 对直接依赖 `ax-feat` 的接受逻辑。 - -简化目标: - -```rust -enum StdFeaturePrefixFamily { - AxStd, -} -``` - -如果该 enum 已经没有实际用途,则直接删除整个 enum。若为了保持现有解析流程清晰而暂时保留单变体 `StdFeaturePrefixFamily::AxStd`,也可接受;关键是不再存在 `AxFeat` 分支或 `axfeat` / `ax-feat` 兼容路径。 - -### 步骤 10:清理文档 - -编辑所有把 `ax-feat` 描述为架构层的文档: - -- `docs/docs/architecture/arceos.md` -- `docs/docs/development/arceos.md` -- `docs/docs/development/components.md` -- `docs/docs/components/layers.md` -- `docs/docs/components/crates/ax-feat.md` -- `docs/docs/components/crates/ax-api.md` -- `docs/docs/components/crates/ax-posix-api.md` -- `docs/docs/components/crates/ax-std.md` -- `docs/docs/components/crates/ax-runtime.md` -- `docs/docs/components/crates/starry-kernel.md` -- `docs/docs/components/crates/starryos.md` -- `docs/docs/build/arceos/build.md` -- `docs/docs/debug/task-stack-guard-page.md` -- `docs/docs/debug/check-mechanisms-summary.md` -- `os/arceos/doc/build.md` - -必要文档改动: - -- 从架构图中移除 `ax-feat`。 -- 删除 `docs/docs/components/crates/ax-feat.md`。 -- 将“API 聚合层包含 axfeat”替换为: - - `ax-api`:Rust API 门面。 - - `ax-posix-api`:POSIX API 门面。 - - `ax-std` / `ax-libc`:应用侧用户库。 - - `ax-runtime`:系统装配和初始化。 -- 记录直接 feature 归属规则。 -- 根据上下文,将构建示例中的 `ax-feat/*` 改为 `ax-std/*`、`ax-libc/*`、`ax-runtime/*` 或直接模块 feature。 - -### 步骤 11:清理测试和生成产物 - -编辑: - -- `scripts/axbuild/src/build/tests/*` -- `scripts/axbuild/src/arceos/build/tests.rs` -- `scripts/axbuild/src/arceos/cbuild/tests.rs` -- `scripts/axbuild/src/starry/test/tests/*` -- `scripts/axbuild/src/test/std.rs` -- `test-suit/arceos/rust/Cargo.toml` 中的 `ax-std/ext4fs` / `ax-std/fatfs` 旧 feature 名。 -- feature 列表中包含 `ax-feat` 的 `test-suit/*` 配置。 - -测试更新必须断言新的行为: - -- `axfeat/*` 不会被归一化。 -- `ax-feat/*` 会被拒绝,或只有在所选 package 真实存在同名 feature 时才原样保留;由于 `ax-feat` 已删除,普通 ArceOS 流程应拒绝它。 -- feature 前缀族检测不再接受 `ax-feat`。 -- C app 映射不再回退生成 `ax-feat/{unknown}`。 -- Starry build 配置不再包含 `ax-feat/plat-dyn`。 -- 测试和示例不再使用 `ax-std/ext4fs` / `ax-std/fatfs`,统一使用 `ax-std/ext4` / `ax-std/fat`。 - -### 步骤 12:最终搜索必须干净 - -完成代码和文档清理后执行: - -```bash -rg -n "ax-feat|axfeat|ax_feat|AxFeat|axfeat/" . -``` - -允许的匹配: - -- 如果仓库策略要求历史 changelog 不可变,则只允许历史 changelog 条目。 -- 本方案文件,直到方案被删除或归档。 - -除此之外,所有匹配都必须删除或改写。 - -## 清理后的依赖规则 - -硬性规则: - -- `os/arceos/api/*` 不能依赖已删除的 feature 聚合 crate。 -- `ax-runtime` 不能依赖 `ax-api`、`ax-posix-api`、`ax-std` 或 `ax-libc`。 -- `ax-api` 和 `ax-posix-api` 不能启用 `ax-runtime/*`,除非它们直接调用 runtime 符号。 -- `ax-std` 可以依赖 `ax-api`、`ax-posix-api`、`ax-runtime` 和更底层模块。 -- `ax-libc` 可以依赖 `ax-posix-api`、`ax-runtime` 和更底层模块。 -- StarryOS 和 Axvisor 在装配 kernel / runtime 内部能力时,不能使用 ArceOS user-library feature 名;只有明确链接 user library 表面时例外。 -- 上层 `Cargo.toml` 依赖 `ax-*` crate 时,如不希望被默认 feature 影响,应显式写 `default-features = false`,然后只开启本镜像实际需要的 feature。 - -期望依赖方向: - -```text -apps / C apps - -> ax-std / ax-libc - -> ax-api / ax-posix-api - -> ax-runtime - -> ax-hal / ax-task / ax-sync / ax-driver / ax-fs-ng / ax-net / ... - -> components / platforms - -StarryOS / Axvisor - -> ax-runtime and lower modules directly -``` - -## 验证计划 - -先运行格式化: - -```bash -cargo fmt -``` - -运行定向 clippy: - -```bash -cargo xtask clippy --package ax-runtime -cargo xtask clippy --package ax-api -cargo xtask clippy --package ax-posix-api -cargo xtask clippy --package ax-std -cargo xtask clippy --package ax-libc -cargo xtask clippy --package starry-kernel -cargo xtask clippy --package starryos -cargo xtask clippy --package axbuild -``` - -运行 axbuild 测试: - -```bash -cargo test -p axbuild -``` - -当前 `cargo xtask test` 子命令不支持 `--package` 过滤;因此 axbuild 单元测试使用原生 Cargo 的 `cargo test -p axbuild`。这属于 xtask 无法表达该精确配置时的等价验证命令。 - -运行代表性 ArceOS 构建: - -```bash -cargo xtask arceos build --package arceos-helloworld --arch aarch64 -cargo xtask arceos build --package arceos-thread-test --arch aarch64 -cargo xtask arceos build --package arceos-fs-shell --arch aarch64 -cargo xtask arceos build --package arceos-net-httpserver --arch aarch64 -``` - -运行代表性 StarryOS 构建: - -```bash -cargo xtask starry build --arch riscv64 -cargo xtask starry build --arch aarch64 -``` - -运行代表性 Axvisor 构建: - -```bash -cargo xtask axvisor build --arch aarch64 -``` - -如果某条命令不符合当前 xtask 语法,先查看 `cargo xtask --help`,使用最接近的 xtask 支持命令。除非 xtask 无法表达对应配置,否则不要对 OS 镜像构建回退到原生 Cargo 命令。 - -## 审查清单 - -合并前检查: - -- `ax-feat` 已从根 workspace dependencies 中移除。 -- `os/arceos/api/axfeat` 目录已删除。 -- 活跃代码路径中不再引用 `ax-feat`、`axfeat`、`AxFeat` 或 `ax_feat`。 -- `axbuild` 中不再存在 `ax-feat` 前缀族。 -- C app feature 映射不再生成 `ax-feat/*`。 -- `ax-std` feature 定义显式且可读。 -- `ax-libc` feature 定义显式且可读。 -- `ax-api` 和 `ax-posix-api` 不再承担 runtime 装配职责。 -- `ax-runtime` 拥有系统装配依赖。 -- StarryOS 使用直接 runtime / module feature。 -- Axvisor 在合适位置使用直接 runtime / module feature。 -- 文档不再把 `ax-feat` 描述为 ArceOS 层级。 -- 所有定向 clippy 检查通过。 -- 代表性 ArceOS、StarryOS 和 Axvisor 构建通过。 - -## 期望最终状态 - -清理完成后,feature 模型应很容易解释: - -- 构建 Rust ArceOS 应用:使用 `ax-std/*`。 -- 构建 C ArceOS 应用:使用 `ax-libc/*`。 -- 暴露 Rust API:使用 `ax-api/*`。 -- 暴露 POSIX API:使用 `ax-posix-api/*`。 -- 需要 runtime 初始化:使用 `ax-runtime/*`。 -- 做 kernel / system 集成:直接依赖需要的具体模块。 - -不再存在单独的顶层 feature crate。Cargo feature 图本身就是唯一事实来源。 From 1fa14e5bf6bb13bfeeeb4180c8beccb3a5cbc1cb Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Mon, 6 Jul 2026 14:16:54 +0800 Subject: [PATCH 3/8] feat(axlibc): add paging feature forwarding to ax-runtime --- os/arceos/ulib/axlibc/Cargo.toml | 1 + scripts/axbuild/src/arceos/cbuild/tests.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/os/arceos/ulib/axlibc/Cargo.toml b/os/arceos/ulib/axlibc/Cargo.toml index 4fb142302b..c3600df32e 100644 --- a/os/arceos/ulib/axlibc/Cargo.toml +++ b/os/arceos/ulib/axlibc/Cargo.toml @@ -32,6 +32,7 @@ irq = ["ax-posix-api/irq", "ax-runtime/irq"] # Memory alloc = ["ax-posix-api/alloc"] +paging = ["ax-runtime/paging"] tls = ["alloc", "ax-runtime/tls"] # Multi-task diff --git a/scripts/axbuild/src/arceos/cbuild/tests.rs b/scripts/axbuild/src/arceos/cbuild/tests.rs index 4d4a7a6eec..2eba26d041 100644 --- a/scripts/axbuild/src/arceos/cbuild/tests.rs +++ b/scripts/axbuild/src/arceos/cbuild/tests.rs @@ -165,6 +165,13 @@ fn map_c_app_features_forwards_multitask_to_runtime_features() { assert!(features.contains(&"multitask".to_string())); } +#[test] +fn map_c_app_features_preserves_paging_facade_feature() { + let features = map_c_app_features(&strings(&["paging"]), &[]); + + assert_eq!(features, vec!["paging".to_string()]); +} + #[test] fn pthread_mutex_header_matches_lockdep_smp_layout() { let header = pthread_mutex_header_contents(&strings(&["multitask", "lockdep", "smp"])); From 2176f8b964abd6d6cde5862a704173fea8e31c9d Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Mon, 6 Jul 2026 14:35:50 +0800 Subject: [PATCH 4/8] chore: remove deprecated and unused feature flags across workspace --- components/axpoll/Cargo.toml | 3 +-- drivers/usb/usb-host/Cargo.toml | 3 +-- os/StarryOS/kernel/Cargo.toml | 2 -- os/StarryOS/starryos/Cargo.toml | 1 - os/arceos/modules/axhal/Cargo.toml | 2 -- os/axvisor/Cargo.toml | 2 +- 6 files changed, 3 insertions(+), 10 deletions(-) diff --git a/components/axpoll/Cargo.toml b/components/axpoll/Cargo.toml index 48d200bbab..0ade946641 100644 --- a/components/axpoll/Cargo.toml +++ b/components/axpoll/Cargo.toml @@ -9,8 +9,7 @@ documentation = "https://docs.rs/axpoll" license = "Apache-2.0" [features] -alloc = [] # Deprecated -default = ["alloc"] +default = [] [dependencies] ax-kspin = { workspace = true } diff --git a/drivers/usb/usb-host/Cargo.toml b/drivers/usb/usb-host/Cargo.toml index cdc2db10e3..f1f6ea0344 100644 --- a/drivers/usb/usb-host/Cargo.toml +++ b/drivers/usb/usb-host/Cargo.toml @@ -10,8 +10,7 @@ repository.workspace = true version = "0.9.10" [features] -aggressive_usb_reset = [] -default = ["aggressive_usb_reset"] +default = [] libusb = ["umod"] umod = ["libusb1-sys"] diff --git a/os/StarryOS/kernel/Cargo.toml b/os/StarryOS/kernel/Cargo.toml index e440aa2093..15be068cfc 100644 --- a/os/StarryOS/kernel/Cargo.toml +++ b/os/StarryOS/kernel/Cargo.toml @@ -16,7 +16,6 @@ license.workspace = true [features] default = ["dynamic_debug"] dev-log = [] -kprobe_test = [] ext4 = ["ax-fs-ng/ext4"] input = ["dep:ax-input", "ax-runtime/input"] ipi = ["ax-runtime/ipi"] @@ -27,7 +26,6 @@ rk3588-pwm = [ "ax-driver/rk3588-pwm", "dep:rdif-pwm", ] -std-compat = [] k230-kpu = ["ax-hal/xuantie-c9xx", "dep:axklib", "dep:k230-kpu"] vsock = ["ax-runtime/vsock"] dynamic_debug = ["ipi"] diff --git a/os/StarryOS/starryos/Cargo.toml b/os/StarryOS/starryos/Cargo.toml index 612f2e688e..b2ae55e612 100644 --- a/os/StarryOS/starryos/Cargo.toml +++ b/os/StarryOS/starryos/Cargo.toml @@ -33,7 +33,6 @@ k230 = [ rknpu = ["ax-driver/rknpu", "starry-kernel/rknpu"] jpeg = ["ax-driver/jpeg", "starry-kernel/jpeg"] rk3588-pwm = ["starry-kernel/rk3588-pwm"] -std-compat = ["starry-kernel/std-compat"] stack-protector = ["ax-std/stack-protector", "starry-kernel/stack-protector"] [[bin]] diff --git a/os/arceos/modules/axhal/Cargo.toml b/os/arceos/modules/axhal/Cargo.toml index 46c8b05d69..6c273f09d5 100644 --- a/os/arceos/modules/axhal/Cargo.toml +++ b/os/arceos/modules/axhal/Cargo.toml @@ -37,8 +37,6 @@ hv = [ "ax-percpu/arm-el2", "axplat-dyn/hv", ] -axvisor-linker = [] - host-test = [] default = [] diff --git a/os/axvisor/Cargo.toml b/os/axvisor/Cargo.toml index 2a0b055010..0a72845c34 100644 --- a/os/axvisor/Cargo.toml +++ b/os/axvisor/Cargo.toml @@ -67,7 +67,7 @@ log = "0.4" # System dependent modules provided by ArceOS. ax-std = { workspace = true, features = ["ext-ld", "paging", "irq", "multitask", "task-ext", "smp", "hv"] } -ax-hal = { workspace = true, features = ["paging", "irq", "smp", "hv", "axvisor-linker"] } +ax-hal = { workspace = true, features = ["paging", "irq", "smp", "hv"] } # System dependent modules provided by ArceOS-Hypervisor (bare-metal only) # ax-runtime = { version = "=0.3.0-preview.1", features = ["alloc", "irq", "paging", "smp", "multitask"] } axvm = { workspace = true, default-features = false } From f67db5f33ff46208f5cff706f74848cdac2926b8 Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Mon, 6 Jul 2026 16:38:41 +0800 Subject: [PATCH 5/8] Rename feature flags across workspace for clarity and consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename `ext4`→`ext4fs`, `fat`→`fatfs`, `cfs`→`sched-cfs`, `rr`→`sched-rr`, `aic8800`→`aic8800-wifi`, and `stubs`→`dummy-if-not-enabled` across all crates, configs, and tests to avoid ambiguity and use more descriptive names. Also remove the redundant `sg2002-wifi` kernel feature in favor of direct `ax-runtime/aic8800-wifi` enablement. --- drivers/ax-driver/Cargo.toml | 2 +- drivers/ax-driver/src/net/mod.rs | 2 +- .../board/licheerv-nano-sg2002-wifi.toml | 3 +- os/StarryOS/kernel/Cargo.toml | 13 ++------ os/StarryOS/kernel/src/pseudofs/dev/loop.rs | 10 +++---- os/StarryOS/kernel/src/pseudofs/dev/mod.rs | 4 +-- os/StarryOS/kernel/src/syscall/fs/mount.rs | 4 +-- os/StarryOS/lkm/hello/Cargo.toml | 2 +- os/StarryOS/lkm/kprobe_test/Cargo.toml | 2 +- os/StarryOS/starryos/Cargo.toml | 2 +- os/arceos/api/arceos_api/Cargo.toml | 2 +- os/arceos/api/arceos_api/src/lib.rs | 2 +- os/arceos/api/arceos_api/src/macros.rs | 6 ++-- os/arceos/modules/axfs-ng/Cargo.toml | 4 +-- os/arceos/modules/axfs-ng/src/block.rs | 24 +++++++-------- .../axfs-ng/src/block_runtime/device.rs | 24 +++++++-------- .../modules/axfs-ng/src/block_runtime/mod.rs | 2 +- os/arceos/modules/axfs-ng/src/file/cache.rs | 30 +++++++++---------- os/arceos/modules/axfs-ng/src/file/mod.rs | 2 +- os/arceos/modules/axfs-ng/src/fs/mod.rs | 30 +++++++++---------- os/arceos/modules/axfs-ng/src/lib.rs | 14 ++++----- os/arceos/modules/axruntime/Cargo.toml | 8 ++--- os/arceos/modules/axruntime/src/lib.rs | 4 +-- os/arceos/modules/axtask/Cargo.toml | 4 +-- os/arceos/modules/axtask/src/api.rs | 4 +-- os/arceos/modules/axtask/src/lib.rs | 4 +-- os/arceos/ulib/axlibc/Cargo.toml | 4 +-- os/arceos/ulib/axstd/Cargo.toml | 10 +++---- os/arceos/ulib/axstd/src/lib.rs | 8 ++--- os/axvisor/Cargo.toml | 2 +- scripts/axbuild/src/arceos/build/tests.rs | 4 +-- scripts/axbuild/src/arceos/cbuild/features.rs | 4 +-- scripts/axbuild/src/arceos/test/mod.rs | 4 +-- scripts/axbuild/src/arceos/test/rust_qemu.rs | 4 +-- scripts/axbuild/src/build/platform.rs | 10 +++---- test-suit/arceos/rust/Cargo.toml | 6 ++-- test-suit/arceos/rust/src/lib.rs | 25 ++++++++++------ test-suit/arceos/rust/src/task/mod.rs | 2 +- test-suit/arceos/rust/src/task/priority.rs | 2 +- 39 files changed, 147 insertions(+), 146 deletions(-) diff --git a/drivers/ax-driver/Cargo.toml b/drivers/ax-driver/Cargo.toml index f932c814d9..69d5c1d1fa 100644 --- a/drivers/ax-driver/Cargo.toml +++ b/drivers/ax-driver/Cargo.toml @@ -45,7 +45,7 @@ cvsd = [ fxmac = ["net", "dep:ax-alloc", "dep:ax-crate-interface", "dep:fxmac_rs"] intel-net = ["net", "pci", "dep:eth-intel"] realtek-rtl8125 = ["net", "pci", "dep:realtek-rtl8125"] -aic8800 = [ +aic8800-wifi = [ "net", "dep:aic8800", "dep:sdhci-cv1800", diff --git a/drivers/ax-driver/src/net/mod.rs b/drivers/ax-driver/src/net/mod.rs index a2c81f8268..d607d71b3b 100644 --- a/drivers/ax-driver/src/net/mod.rs +++ b/drivers/ax-driver/src/net/mod.rs @@ -1,6 +1,6 @@ mod binding; -#[cfg(feature = "aic8800")] +#[cfg(feature = "aic8800-wifi")] pub mod aic8800; #[cfg(feature = "fxmac")] pub mod fxmac; diff --git a/os/StarryOS/configs/board/licheerv-nano-sg2002-wifi.toml b/os/StarryOS/configs/board/licheerv-nano-sg2002-wifi.toml index 707690745a..46f447482e 100644 --- a/os/StarryOS/configs/board/licheerv-nano-sg2002-wifi.toml +++ b/os/StarryOS/configs/board/licheerv-nano-sg2002-wifi.toml @@ -1,5 +1,6 @@ features = [ - "starry-kernel/sg2002-wifi", + "starry-kernel/sg2002", + "ax-runtime/aic8800-wifi", "axplat-dyn/thead-mae", "ax-driver/cvsd", "ax-driver/serial", diff --git a/os/StarryOS/kernel/Cargo.toml b/os/StarryOS/kernel/Cargo.toml index 15be068cfc..8a9555e343 100644 --- a/os/StarryOS/kernel/Cargo.toml +++ b/os/StarryOS/kernel/Cargo.toml @@ -16,7 +16,7 @@ license.workspace = true [features] default = ["dynamic_debug"] dev-log = [] -ext4 = ["ax-fs-ng/ext4"] +ext4fs = ["ax-fs-ng/ext4fs"] input = ["dep:ax-input", "ax-runtime/input"] ipi = ["ax-runtime/ipi"] memtrack = ["axbacktrace/alloc", "ax-alloc/tracking"] @@ -40,13 +40,6 @@ sg2002 = [ "dep:sg200x-bsp", "dep:tock-registers", ] -# SG2002 AIC8800 SoftAP Wi-Fi. The whole bring-up (FDT probe + SoftAP + stack -# registration) now lives in ax-driver / ax-runtime; the kernel just turns the -# feature on. No direct chip-crate deps needed here anymore. -sg2002-wifi = [ - "sg2002", - "ax-runtime/aic8800", -] stack-guard-page = ["ax-runtime/stack-guard-page"] stack-protector = ["ax-runtime/stack-protector"] axtest = [] @@ -71,7 +64,7 @@ ax-runtime = { workspace = true, features = [ "uspace", "multitask", "rtc", - "ext4", + "ext4fs", "net", ] } ax-sync = { workspace = true, features = ["multitask"] } @@ -79,7 +72,7 @@ ax-task = { workspace = true, features = [ "multitask", "task-ext", "tracepoint-hooks", - "rr", + "sched-rr", ] } ax-dma = { workspace = true, optional = true } sg2002-tpu = { workspace = true, optional = true } diff --git a/os/StarryOS/kernel/src/pseudofs/dev/loop.rs b/os/StarryOS/kernel/src/pseudofs/dev/loop.rs index b4942d2d8e..44030ad771 100644 --- a/os/StarryOS/kernel/src/pseudofs/dev/loop.rs +++ b/os/StarryOS/kernel/src/pseudofs/dev/loop.rs @@ -20,7 +20,7 @@ use linux_raw_sys::{ }; use starry_vm::{VmMutPtr, VmPtr}; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] use super::loop_block::BlockCache; use crate::{ file::{FileLike, get_file_like}, @@ -49,7 +49,7 @@ pub struct LoopDevice { exclusive: AtomicBool, /// Block-device data cache. Populated by `as_dyn_block_device()`, /// written back and cleared by `LOOP_CLR_FD`. - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] pub(super) block_cache: Mutex, } @@ -64,7 +64,7 @@ impl LoopDevice { file_name: Mutex::new([0u8; 64]), flags: AtomicU32::new(0), exclusive: AtomicBool::new(false), - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] block_cache: Mutex::new(BlockCache::new()), } } @@ -190,7 +190,7 @@ impl DeviceOps for LoopDevice { // This runs in normal syscall context so CachedFile VFS I/O // (page cache updates) is safe. The cache lock ensures no // concurrent write_block() can race. - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] self.detach_block_cache(guard.as_ref())?; *guard = None; @@ -305,7 +305,7 @@ impl DeviceOps for LoopDevice { // Atomically claim the dirty flag so that a concurrent // write_block() will re-set dirty=true after our snapshot, // guaranteeing its data is flushed on the next attempt. - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] self.flush_block_cache_ioctl()?; } BLKIOMIN => { diff --git a/os/StarryOS/kernel/src/pseudofs/dev/mod.rs b/os/StarryOS/kernel/src/pseudofs/dev/mod.rs index 5361492430..5d56021b61 100644 --- a/os/StarryOS/kernel/src/pseudofs/dev/mod.rs +++ b/os/StarryOS/kernel/src/pseudofs/dev/mod.rs @@ -17,11 +17,11 @@ mod kpu; #[cfg(feature = "dev-log")] mod log; mod r#loop; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] mod loop_block; #[cfg(feature = "jpeg")] mod mpp_service; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] pub use r#loop::LoopDevice; #[cfg(feature = "sg2002")] pub mod ion; diff --git a/os/StarryOS/kernel/src/syscall/fs/mount.rs b/os/StarryOS/kernel/src/syscall/fs/mount.rs index ab87d22d00..d71e5dc02c 100644 --- a/os/StarryOS/kernel/src/syscall/fs/mount.rs +++ b/os/StarryOS/kernel/src/syscall/fs/mount.rs @@ -198,7 +198,7 @@ pub fn sys_mount( mp.set_readonly(true); } } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] "ext4" => { mount_ext4(&source, &target, (flags & MS_RDONLY) != 0)?; } @@ -229,7 +229,7 @@ pub fn sys_mount( Ok(0) } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn mount_ext4(source: &str, target: &str, readonly: bool) -> AxResult<()> { use alloc::{boxed::Box, sync::Arc}; diff --git a/os/StarryOS/lkm/hello/Cargo.toml b/os/StarryOS/lkm/hello/Cargo.toml index cf63cbe368..0e5019f5f5 100644 --- a/os/StarryOS/lkm/hello/Cargo.toml +++ b/os/StarryOS/lkm/hello/Cargo.toml @@ -14,7 +14,7 @@ ax-driver.workspace = true ax-hal.workspace = true ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn = { workspace = true, optional = true } -starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } +starry-kernel = { workspace = true, features = ["dev-log", "ext4fs"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } kmod-tools.workspace = true diff --git a/os/StarryOS/lkm/kprobe_test/Cargo.toml b/os/StarryOS/lkm/kprobe_test/Cargo.toml index ce36e7627f..9b59efeb89 100644 --- a/os/StarryOS/lkm/kprobe_test/Cargo.toml +++ b/os/StarryOS/lkm/kprobe_test/Cargo.toml @@ -14,7 +14,7 @@ ax-driver.workspace = true ax-hal.workspace = true ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn = { workspace = true, optional = true } -starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } +starry-kernel = { workspace = true, features = ["dev-log", "ext4fs"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } ax-log.workspace = true diff --git a/os/StarryOS/starryos/Cargo.toml b/os/StarryOS/starryos/Cargo.toml index b2ae55e612..dbbb21ea07 100644 --- a/os/StarryOS/starryos/Cargo.toml +++ b/os/StarryOS/starryos/Cargo.toml @@ -49,7 +49,7 @@ ax-driver.workspace = true ax-hal.workspace = true ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn.workspace = true -starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } +starry-kernel = { workspace = true, features = ["dev-log", "ext4fs"] } [target.'cfg(any(windows, all(unix, not(target_env = "musl"))))'.dependencies] anyhow = "1.0" diff --git a/os/arceos/api/arceos_api/Cargo.toml b/os/arceos/api/arceos_api/Cargo.toml index a1ac1eafb1..a0a2439d38 100644 --- a/os/arceos/api/arceos_api/Cargo.toml +++ b/os/arceos/api/arceos_api/Cargo.toml @@ -22,7 +22,7 @@ display = ["dep:ax-display"] # Use stub functions if the feature is not enabled. -stubs = [] +dummy-if-not-enabled = [] [dependencies] ax-alloc = { workspace = true, optional = true } diff --git a/os/arceos/api/arceos_api/src/lib.rs b/os/arceos/api/arceos_api/src/lib.rs index bcd1577cfa..47522ec15c 100644 --- a/os/arceos/api/arceos_api/src/lib.rs +++ b/os/arceos/api/arceos_api/src/lib.rs @@ -10,7 +10,7 @@ feature = "fs", feature = "net", feature = "multitask", - feature = "stubs" + feature = "dummy-if-not-enabled" ))] extern crate alloc; diff --git a/os/arceos/api/arceos_api/src/macros.rs b/os/arceos/api/arceos_api/src/macros.rs index 009a7cb12c..7fae100a5e 100644 --- a/os/arceos/api/arceos_api/src/macros.rs +++ b/os/arceos/api/arceos_api/src/macros.rs @@ -12,7 +12,7 @@ macro_rules! define_api_type { $(#[$attr])* $vis use $crate::imp::$name; - #[cfg(all(feature = "stubs", not(feature = $feature)))] + #[cfg(all(feature = "dummy-if-not-enabled", not(feature = $feature)))] $(#[$attr])* $vis struct $name; )+ @@ -48,7 +48,7 @@ macro_rules! define_api { } #[allow(unused_variables)] - #[cfg(all(feature = "stubs", not(feature = $feature)))] + #[cfg(all(feature = "dummy-if-not-enabled", not(feature = $feature)))] $(#[$attr])* $vis fn $name( $($arg : $type),* ) $( -> $ret )? { unimplemented!(stringify!($name)) @@ -67,7 +67,7 @@ macro_rules! define_api { } #[allow(unused_variables)] - #[cfg(all(feature = "stubs", not(feature = $feature)))] + #[cfg(all(feature = "dummy-if-not-enabled", not(feature = $feature)))] $(#[$attr])* $vis unsafe fn $name( $($arg : $type),* ) $( -> $ret )? { unimplemented!(stringify!($name)) diff --git a/os/arceos/modules/axfs-ng/Cargo.toml b/os/arceos/modules/axfs-ng/Cargo.toml index 927ea861e2..d20d2375f9 100644 --- a/os/arceos/modules/axfs-ng/Cargo.toml +++ b/os/arceos/modules/axfs-ng/Cargo.toml @@ -8,8 +8,8 @@ description = "ArceOS filesystem module" license.workspace = true [features] -fat = ["dep:fatfs"] -ext4 = ["dep:rsext4"] +fatfs = ["dep:fatfs"] +ext4fs = ["dep:rsext4"] vfs = [] lockdep = ["axfs-ng-vfs/lockdep"] diff --git a/os/arceos/modules/axfs-ng/src/block.rs b/os/arceos/modules/axfs-ng/src/block.rs index 2a3a80f4c1..205984c721 100644 --- a/os/arceos/modules/axfs-ng/src/block.rs +++ b/os/arceos/modules/axfs-ng/src/block.rs @@ -1,6 +1,6 @@ use alloc::{boxed::Box, sync::Arc}; -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] use ax_errno::AxError; use ax_errno::AxResult; @@ -39,9 +39,9 @@ pub(crate) trait FsBlockDevice: Send { fn num_blocks(&self) -> u64; fn block_size(&self) -> usize; fn read_block(&mut self, block_id: u64, buf: &mut [u8]) -> AxResult; - #[cfg(any(feature = "ext4", feature = "fat"))] + #[cfg(any(feature = "ext4fs", feature = "fatfs"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult; - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn flush(&mut self) -> AxResult; } @@ -62,18 +62,18 @@ impl FsBlockDevice for Box { (**self).read_block(block_id, buf) } - #[cfg(any(feature = "ext4", feature = "fat"))] + #[cfg(any(feature = "ext4fs", feature = "fatfs"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult { (**self).write_block(block_id, buf) } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn flush(&mut self) -> AxResult { (**self).flush() } } -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub(crate) struct RegionBlockDevice { inner: T, region: BlockRegion, @@ -89,7 +89,7 @@ impl NativeHandleBlockDevice { } } -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] impl RegionBlockDevice { pub const fn new(inner: T, region: BlockRegion) -> Self { Self { inner, region } @@ -111,7 +111,7 @@ impl RegionBlockDevice { } } -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] impl FsBlockDevice for RegionBlockDevice { fn name(&self) -> &str { self.inner.name() @@ -135,7 +135,7 @@ impl FsBlockDevice for RegionBlockDevice { self.inner.read_block(physical, buf) } - #[cfg(any(feature = "ext4", feature = "fat"))] + #[cfg(any(feature = "ext4fs", feature = "fatfs"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult { self.check_io_bounds(block_id, buf.len())?; let physical = self @@ -146,7 +146,7 @@ impl FsBlockDevice for RegionBlockDevice { self.inner.write_block(physical, buf) } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn flush(&mut self) -> AxResult { self.inner.flush() } @@ -169,12 +169,12 @@ impl FsBlockDevice for NativeHandleBlockDevice { self.handle.read_blocks(block_id, buf) } - #[cfg(any(feature = "ext4", feature = "fat"))] + #[cfg(any(feature = "ext4fs", feature = "fatfs"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult { self.handle.write_blocks(block_id, buf) } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn flush(&mut self) -> AxResult { self.handle.flush_blocks() } diff --git a/os/arceos/modules/axfs-ng/src/block_runtime/device.rs b/os/arceos/modules/axfs-ng/src/block_runtime/device.rs index af23ea7c9f..5431d3ac70 100644 --- a/os/arceos/modules/axfs-ng/src/block_runtime/device.rs +++ b/os/arceos/modules/axfs-ng/src/block_runtime/device.rs @@ -116,12 +116,12 @@ impl Drop for DataIoGuard<'_> { } } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] struct FlushBarrierGuard<'a> { device: &'a BlockDeviceHandle, } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] impl Drop for FlushBarrierGuard<'_> { fn drop(&mut self) { self.device.flush_active.store(false, Ordering::Release); @@ -559,7 +559,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn poll_one(&self, key: RequestKey) -> bool { let mut poller = DeviceRequestPoller { device: self }; CompletionDrain::new(&self.pending, &mut poller).poll_one(key) @@ -608,14 +608,14 @@ impl BlockDeviceHandle { self.submit_io(RequestOp::Read, block_id, buf, None) } - #[cfg(any(feature = "ext4", feature = "fat"))] + #[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub(crate) fn write_blocks(&self, block_id: u64, buf: &[u8]) -> AxResult { self.check_not_poisoned()?; let mut no_dst = []; self.submit_io(RequestOp::Write, block_id, &mut no_dst, Some(buf)) } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] pub(crate) fn flush_blocks(&self) -> AxResult { self.check_not_poisoned()?; let _barrier = self.acquire_flush_barrier()?; @@ -648,7 +648,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn flush_queue_index(&self) -> Option { self.queues .iter() @@ -656,7 +656,7 @@ impl BlockDeviceHandle { .find_map(|(idx, queue)| queue.lock().info.limits.supports_flush.then_some(idx)) } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn wait_for_all_pending(&self) -> AxResult { loop { let queues = @@ -802,7 +802,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn acquire_flush_barrier(&self) -> AxResult> { loop { if self @@ -838,7 +838,7 @@ impl BlockDeviceHandle { Ok(()) } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn wait_for_active_data_drain(&self) -> AxResult { let task_id = current_task_id().unwrap_or(0); if self.active_data_ops.load(Ordering::Acquire) == 0 { @@ -1163,7 +1163,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn wait_for_completion(&self, key: RequestKey, dst: Option<&mut [u8]>) -> AxResult { let task_id = current_task_id().unwrap_or(0); let observed = self.pending.lock().register_waiter_task(key, task_id); @@ -1487,7 +1487,7 @@ impl RequestPoller for DeviceRequestPoller<'_> { } } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn submit_flush_request(queue: &mut QueueRuntime, info: QueueInfo) -> Result { match &mut queue.queue { RuntimeQueue::Legacy(legacy) => { @@ -1591,7 +1591,7 @@ pub fn map_blk_err_to_ax_err(err: BlkError) -> AxError { } } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn queue_ids_from_bits(bits: u64) -> impl Iterator { (0..u64::BITS as usize).filter(move |queue_id| bits & (1 << queue_id) != 0) } diff --git a/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs b/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs index 0d1adc290a..6362adb25b 100644 --- a/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs +++ b/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs @@ -1780,7 +1780,7 @@ mod tests { } #[test] - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] fn block_device_flush_retries_without_returning_wouldblock() { let _guard = test_task_guard(); let mut queue = MockQueue::with_retry_submits(1); diff --git a/os/arceos/modules/axfs-ng/src/file/cache.rs b/os/arceos/modules/axfs-ng/src/file/cache.rs index 69485b3b48..831890d6bd 100644 --- a/os/arceos/modules/axfs-ng/src/file/cache.rs +++ b/os/arceos/modules/axfs-ng/src/file/cache.rs @@ -1,5 +1,5 @@ use alloc::{boxed::Box, sync::Arc, vec::Vec}; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] use alloc::{collections::BTreeMap, sync::Weak}; #[cfg(feature = "vfs")] use core::sync::atomic::AtomicBool; @@ -9,7 +9,7 @@ use core::{ }; use ax_io::prelude::*; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] use axfs_ng_vfs::FilesystemOps; use axfs_ng_vfs::{FileNode, Location, VfsError, VfsResult}; use intrusive_collections::{LinkedList, LinkedListAtomicLink, intrusive_adapter}; @@ -20,12 +20,12 @@ use crate::os::{memory::PAGE_SIZE, sync::SleepMutex as Mutex}; const DISK_PAGE_CACHE_CAP: usize = 512; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] type CachedFileKey = (usize, u64); -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] type InodeCacheIndex = BTreeMap>; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] static CACHED_FILE_BY_INODE: spin::LazyLock> = spin::LazyLock::new(|| Mutex::new(BTreeMap::new())); @@ -525,12 +525,12 @@ impl CachedFile { } let len = location.len()?; - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] let inode_key = should_share_cached_file_by_inode(&location).then(|| cached_file_key(&location)); - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] let inode_shared = inode_key.and_then(lookup_inode_cached_file); - #[cfg(not(feature = "ext4"))] + #[cfg(not(feature = "ext4fs"))] let inode_shared: Option> = None; let (created, user_data) = if let Some(shared) = inode_shared { (shared.clone(), FileUserData::Strong(shared)) @@ -565,7 +565,7 @@ impl CachedFile { } #[cfg(not(feature = "vfs"))] let _ = is_new; - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] if is_new && let Some(key) = inode_key { insert_inode_cached_file(key, &shared); } @@ -938,22 +938,22 @@ impl CachedFile { } } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn should_share_cached_file_by_inode(location: &Location) -> bool { location.filesystem().name() == "ext4" } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn filesystem_key(filesystem: &dyn FilesystemOps) -> usize { filesystem as *const dyn FilesystemOps as *const () as usize } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn cached_file_key(location: &Location) -> CachedFileKey { (filesystem_key(location.filesystem()), location.inode()) } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn lookup_inode_cached_file(key: CachedFileKey) -> Option> { let mut cache = CACHED_FILE_BY_INODE.lock(); match cache.get(&key).and_then(Weak::upgrade) { @@ -965,14 +965,14 @@ fn lookup_inode_cached_file(key: CachedFileKey) -> Option> } } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn insert_inode_cached_file(key: CachedFileKey, shared: &Arc) { CACHED_FILE_BY_INODE .lock() .insert(key, Arc::downgrade(shared)); } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] pub(crate) fn forget_cached_file_key(filesystem: &dyn FilesystemOps, inode: u64) { if filesystem.name() == "ext4" { CACHED_FILE_BY_INODE diff --git a/os/arceos/modules/axfs-ng/src/file/mod.rs b/os/arceos/modules/axfs-ng/src/file/mod.rs index c96459e6d9..578c95aad0 100644 --- a/os/arceos/modules/axfs-ng/src/file/mod.rs +++ b/os/arceos/modules/axfs-ng/src/file/mod.rs @@ -4,7 +4,7 @@ mod open; mod page; pub use cache::CachedFile; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] pub(crate) use cache::forget_cached_file_key; #[cfg(feature = "vfs")] pub use cache::{page_cache_reclaim, sync_all_cached_files}; diff --git a/os/arceos/modules/axfs-ng/src/fs/mod.rs b/os/arceos/modules/axfs-ng/src/fs/mod.rs index 67009d5cfb..bfddb4a42b 100644 --- a/os/arceos/modules/axfs-ng/src/fs/mod.rs +++ b/os/arceos/modules/axfs-ng/src/fs/mod.rs @@ -1,28 +1,28 @@ -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] use alloc::boxed::Box; use alloc::sync::Arc; use axfs_ng_vfs::{Filesystem, VfsResult}; -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] use crate::FilesystemKind; -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] use crate::block::FsBlockDevice; use crate::{BlockDeviceHandle, block::BlockRegion}; -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] mod ext4; -#[cfg(feature = "fat")] +#[cfg(feature = "fatfs")] mod fat; /// Create a filesystem instance from a block device. -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub fn new_default(dev: Box, region: BlockRegion) -> VfsResult { new_ext4(dev, region) } /// Create a filesystem instance from a detected filesystem kind. -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub(crate) fn new_by_kind( dev: Box, region: BlockRegion, @@ -38,12 +38,12 @@ pub(crate) fn new_by_kind( /// /// Use this for loop devices and other block backends created outside the /// platform probe path. -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub fn new_from_handle(dev: Arc, region: BlockRegion) -> VfsResult { new_default(crate::block::boxed_native_handle_block_device(dev), region) } -#[cfg(any(feature = "ext4", feature = "fat"))] +#[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub(crate) fn new_from_handle_with_kind( dev: Arc, region: BlockRegion, @@ -56,7 +56,7 @@ pub(crate) fn new_from_handle_with_kind( ) } -#[cfg(not(any(feature = "ext4", feature = "fat")))] +#[cfg(not(any(feature = "ext4fs", feature = "fatfs")))] pub fn new_from_handle( _dev: Arc, _region: BlockRegion, @@ -64,7 +64,7 @@ pub fn new_from_handle( panic!("No filesystem feature enabled"); } -#[cfg(not(any(feature = "ext4", feature = "fat")))] +#[cfg(not(any(feature = "ext4fs", feature = "fatfs")))] pub(crate) fn new_from_handle_with_kind( _dev: Arc, _region: BlockRegion, @@ -73,22 +73,22 @@ pub(crate) fn new_from_handle_with_kind( panic!("No filesystem feature enabled"); } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn new_ext4(dev: Box, region: BlockRegion) -> VfsResult { ext4::Ext4Filesystem::new(dev, region) } -#[cfg(all(any(feature = "ext4", feature = "fat"), not(feature = "ext4")))] +#[cfg(all(any(feature = "ext4fs", feature = "fatfs"), not(feature = "ext4fs")))] fn new_ext4(_dev: Box, _region: BlockRegion) -> VfsResult { Err(ax_errno::AxError::Unsupported) } -#[cfg(feature = "fat")] +#[cfg(feature = "fatfs")] fn new_fat(dev: Box, region: BlockRegion) -> VfsResult { fat::FatFilesystem::new(dev, region) } -#[cfg(all(any(feature = "ext4", feature = "fat"), not(feature = "fat")))] +#[cfg(all(any(feature = "ext4fs", feature = "fatfs"), not(feature = "fatfs")))] fn new_fat(_dev: Box, _region: BlockRegion) -> VfsResult { Err(ax_errno::AxError::Unsupported) } diff --git a/os/arceos/modules/axfs-ng/src/lib.rs b/os/arceos/modules/axfs-ng/src/lib.rs index 2a9cfc74ee..9ed4f34526 100644 --- a/os/arceos/modules/axfs-ng/src/lib.rs +++ b/os/arceos/modules/axfs-ng/src/lib.rs @@ -37,7 +37,7 @@ pub use highlevel::*; #[cfg(feature = "vfs")] pub mod vfs { /// Create a filesystem from a native block runtime handle. - #[cfg(any(feature = "ext4", feature = "fat"))] + #[cfg(any(feature = "ext4fs", feature = "fatfs"))] pub use crate::fs::new_from_handle as new_filesystem_from_handle; pub use crate::highlevel::*; } @@ -106,15 +106,15 @@ pub(crate) fn detect_filesystem( dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion, ) -> Option { - #[cfg(not(any(feature = "ext4", feature = "fat")))] + #[cfg(not(any(feature = "ext4fs", feature = "fatfs")))] let _ = (&mut *dev, region); - #[cfg(feature = "ext4")] + #[cfg(feature = "ext4fs")] if region_has_ext4(dev, region) { return Some(FilesystemKind::Ext4); } - #[cfg(feature = "fat")] + #[cfg(feature = "fatfs")] if region_has_fat(dev, region) { return Some(FilesystemKind::Fat); } @@ -122,7 +122,7 @@ pub(crate) fn detect_filesystem( None } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn region_has_ext4(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion) -> bool { const EXT4_SUPERBLOCK_OFFSET: usize = 1024; const EXT4_MAGIC_OFFSET: usize = 0x38; @@ -135,7 +135,7 @@ fn region_has_ext4(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegio ) } -#[cfg(feature = "fat")] +#[cfg(feature = "fatfs")] fn region_has_fat(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion) -> bool { const FAT16_MAGIC: &[u8; 5] = b"FAT16"; const FAT32_MAGIC: &[u8; 5] = b"FAT32"; @@ -160,7 +160,7 @@ fn region_has_fat(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion || buf.get(82..87) == Some(FAT32_MAGIC.as_slice())) } -#[cfg(feature = "ext4")] +#[cfg(feature = "ext4fs")] fn region_has_magic_u16( dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion, diff --git a/os/arceos/modules/axruntime/Cargo.toml b/os/arceos/modules/axruntime/Cargo.toml index 4183f8aad6..501067b0f3 100644 --- a/os/arceos/modules/axruntime/Cargo.toml +++ b/os/arceos/modules/axruntime/Cargo.toml @@ -49,8 +49,8 @@ fs = [ "dep:rdif-block", "ax-driver/block", ] -ext4 = ["fs", "ax-fs-ng/ext4"] -fat = ["fs", "ax-fs-ng/fat"] +ext4fs = ["fs", "ax-fs-ng/ext4fs"] +fatfs = ["fs", "ax-fs-ng/fatfs"] input = ["paging", "dep:ax-input", "ax-driver/input"] net = [ "irq", @@ -63,9 +63,9 @@ net = [ ] # SG2002 AIC8800 SoftAP Wi-Fi. Pulls the FDT probe into ax-driver and installs # the ArceOS runtime glue (the driver cores are OS-independent) before probing. -aic8800 = [ +aic8800-wifi = [ "net", - "ax-driver/aic8800", + "ax-driver/aic8800-wifi", "dep:aic8800", "dep:sdhci-cv1800", ] diff --git a/os/arceos/modules/axruntime/src/lib.rs b/os/arceos/modules/axruntime/src/lib.rs index e760db8e6a..796a1adbd9 100644 --- a/os/arceos/modules/axruntime/src/lib.rs +++ b/os/arceos/modules/axruntime/src/lib.rs @@ -61,7 +61,7 @@ mod registers; #[cfg(all(feature = "net", feature = "fs"))] mod unix_ns; -#[cfg(feature = "aic8800")] +#[cfg(feature = "aic8800-wifi")] mod wifi_glue; pub use ax_hal as hal; @@ -291,7 +291,7 @@ pub fn rust_main(cpu_id: usize, arg: usize) -> ! { // brings the chip up and that needs timing/task capabilities. The cores // declare no ArceOS dependency themselves; this is the adapter layer (see // `wifi_glue`). - #[cfg(feature = "aic8800")] + #[cfg(feature = "aic8800-wifi")] wifi_glue::install_runtime(); devices::probe_all_devices(); diff --git a/os/arceos/modules/axtask/Cargo.toml b/os/arceos/modules/axtask/Cargo.toml index 3dcad843fd..15062c0b50 100644 --- a/os/arceos/modules/axtask/Cargo.toml +++ b/os/arceos/modules/axtask/Cargo.toml @@ -44,8 +44,8 @@ tls = ["ax-hal/tls"] tracepoint-hooks = ["multitask"] uspace = ["ax-hal/uspace"] -cfs = ["multitask", "preempt"] -rr = ["multitask", "preempt"] +sched-cfs = ["multitask", "preempt"] +sched-rr = ["multitask", "preempt"] host-test = [ "ax-hal/host-test", diff --git a/os/arceos/modules/axtask/src/api.rs b/os/arceos/modules/axtask/src/api.rs index c02c540a41..d44f9960e8 100644 --- a/os/arceos/modules/axtask/src/api.rs +++ b/os/arceos/modules/axtask/src/api.rs @@ -46,11 +46,11 @@ pub fn default_task_stack_size() -> usize { } cfg_if::cfg_if! { - if #[cfg(feature = "rr")] { + if #[cfg(feature = "sched-rr")] { const MAX_TIME_SLICE: usize = 5; pub(crate) type AxTask = ax_sched::RRTask; pub(crate) type Scheduler = ax_sched::RRScheduler; - } else if #[cfg(feature = "cfs")] { + } else if #[cfg(feature = "sched-cfs")] { pub(crate) type AxTask = ax_sched::CFSTask; pub(crate) type Scheduler = ax_sched::CFScheduler; } else { diff --git a/os/arceos/modules/axtask/src/lib.rs b/os/arceos/modules/axtask/src/lib.rs index 791cad2980..de77fa901d 100644 --- a/os/arceos/modules/axtask/src/lib.rs +++ b/os/arceos/modules/axtask/src/lib.rs @@ -15,9 +15,9 @@ //! - `preempt`: Enable preemptive scheduling. //! - FIFO cooperative scheduler is the default when no scheduler feature is //! selected. -//! - `rr`: Use the [Round-robin preemptive scheduler][2]. It also enables +//! - `sched-rr`: Use the [Round-robin preemptive scheduler][2]. It also enables //! the `multitask` and `preempt` features if it is enabled. -//! - `cfs`: Use the [Completely Fair Scheduler][3]. It also enables the +//! - `sched-cfs`: Use the [Completely Fair Scheduler][3]. It also enables the //! the `multitask` and `preempt` features if it is enabled. //! - `host-test`: Use host-safe fallbacks for unit tests. //! diff --git a/os/arceos/ulib/axlibc/Cargo.toml b/os/arceos/ulib/axlibc/Cargo.toml index c3600df32e..df76187247 100644 --- a/os/arceos/ulib/axlibc/Cargo.toml +++ b/os/arceos/ulib/axlibc/Cargo.toml @@ -42,8 +42,8 @@ stack-protector = ["ax-runtime/stack-protector"] # File system fs = ["ax-posix-api/fs", "ax-runtime/fs", "fd"] -ext4 = ["fs", "ax-runtime/ext4"] -fat = ["fs", "ax-runtime/fat"] +ext4fs = ["fs", "ax-runtime/ext4fs"] +fatfs = ["fs", "ax-runtime/fatfs"] # Networking net = ["ax-posix-api/net", "ax-runtime/net", "fd"] diff --git a/os/arceos/ulib/axstd/Cargo.toml b/os/arceos/ulib/axstd/Cargo.toml index 1234c626c0..ded61ef49e 100644 --- a/os/arceos/ulib/axstd/Cargo.toml +++ b/os/arceos/ulib/axstd/Cargo.toml @@ -54,8 +54,8 @@ multitask = ["ax-api/multitask", "ax-posix-api/multitask", "ax-runtime/multitask lockdep = ["multitask", "ax-posix-api/lockdep", "ax-runtime/lockdep"] task-ext = ["ax-task/task-ext"] tracepoint-hooks = ["ax-task/tracepoint-hooks"] -rr = ["irq", "multitask", "ax-task/rr"] -cfs = ["irq", "multitask", "ax-task/cfs"] +sched-rr = ["irq", "multitask", "ax-task/sched-rr"] +sched-cfs = ["irq", "multitask", "ax-task/sched-cfs"] stack-guard-page = ["ax-runtime/stack-guard-page"] stack-protector = ["ax-runtime/stack-protector"] @@ -67,8 +67,8 @@ fs = [ "ax-driver/virtio-blk", "fd", ] -ext4 = ["fs", "ax-runtime/ext4"] -fat = ["fs", "ax-runtime/fat"] +ext4fs = ["fs", "ax-runtime/ext4fs"] +fatfs = ["fs", "ax-runtime/fatfs"] # Networking net = [ @@ -79,7 +79,7 @@ net = [ "fd", ] vsock = ["ax-runtime/vsock"] -aic8800 = ["ax-runtime/aic8800"] +aic8800-wifi = ["ax-runtime/aic8800-wifi"] dns = ["net"] # libc compatibility surface used when ax-std is linked as fake libc for Rust std. diff --git a/os/arceos/ulib/axstd/src/lib.rs b/os/arceos/ulib/axstd/src/lib.rs index 8e1a40b090..00aa95e78d 100644 --- a/os/arceos/ulib/axstd/src/lib.rs +++ b/os/arceos/ulib/axstd/src/lib.rs @@ -17,12 +17,12 @@ //! - `tls`: Enable thread-local storage. //! - Task management //! - `multitask`: Enable multi-threading support. -//! - `rr`: Use the Round-robin preemptive scheduler. -//! - `cfs`: Use the Completely Fair Scheduler (CFS) preemptive scheduler. +//! - `sched-rr`: Use the Round-robin preemptive scheduler. +//! - `sched-cfs`: Use the Completely Fair Scheduler (CFS) preemptive scheduler. //! - Upperlayer stacks //! - `fs`: Enable file system support. -//! - `ext4`: Enable the ext4 filesystem. -//! - `fat`: Enable the FAT filesystem. +//! - `ext4fs`: Enable the ext4 filesystem. +//! - `fatfs`: Enable the FAT filesystem. //! - `net`: Enable networking support. //! - `dns`: Enable DNS lookup support. //! - `display`: Enable graphics support. diff --git a/os/axvisor/Cargo.toml b/os/axvisor/Cargo.toml index 0a72845c34..162fc59885 100644 --- a/os/axvisor/Cargo.toml +++ b/os/axvisor/Cargo.toml @@ -42,7 +42,7 @@ required-features = ["axtest"] [features] default = [] axtest = [] -fs = ["ax-std/ext4", "ax-std/fat", "axvm/host-fs"] +fs = ["ax-std/ext4fs", "ax-std/fatfs", "axvm/host-fs"] vmx = ["axvm/vmx"] svm = ["axvm/svm"] sstc = ["axvm/sstc"] diff --git a/scripts/axbuild/src/arceos/build/tests.rs b/scripts/axbuild/src/arceos/build/tests.rs index abb184f134..c68274a00f 100644 --- a/scripts/axbuild/src/arceos/build/tests.rs +++ b/scripts/axbuild/src/arceos/build/tests.rs @@ -347,10 +347,10 @@ log = "Warn" #[test] fn parse_makefile_features_splits_commas_whitespace_and_dedups() { assert_eq!( - build::parse_makefile_features(" lockdep, rr lockdep\tax-runtime/net "), + build::parse_makefile_features(" lockdep, sched-rr lockdep\tax-runtime/net "), vec![ "lockdep".to_string(), - "rr".to_string(), + "sched-rr".to_string(), "ax-runtime/net".to_string() ] ); diff --git a/scripts/axbuild/src/arceos/cbuild/features.rs b/scripts/axbuild/src/arceos/cbuild/features.rs index a17b48b6dc..2df32b742f 100644 --- a/scripts/axbuild/src/arceos/cbuild/features.rs +++ b/scripts/axbuild/src/arceos/cbuild/features.rs @@ -85,8 +85,8 @@ pub(super) fn map_c_app_features( "select", "poll", "epoll", - "ext4", - "fat", + "ext4fs", + "fatfs", ]; let mut features = BTreeSet::new(); diff --git a/scripts/axbuild/src/arceos/test/mod.rs b/scripts/axbuild/src/arceos/test/mod.rs index 4c4c2bff74..a7d0ac2e78 100644 --- a/scripts/axbuild/src/arceos/test/mod.rs +++ b/scripts/axbuild/src/arceos/test/mod.rs @@ -42,8 +42,8 @@ const ARCEOS_RUST_QEMU_FEATURES: &[&str] = &[ ARCEOS_RUST_LOCKDEP_DETECT_FEATURE, "memtest", "net-loopback", - "cfs", - "rr", + "sched-cfs", + "sched-rr", "task-affinity", "task-ipi", "task-irq", diff --git a/scripts/axbuild/src/arceos/test/rust_qemu.rs b/scripts/axbuild/src/arceos/test/rust_qemu.rs index 4224c65624..4488202784 100644 --- a/scripts/axbuild/src/arceos/test/rust_qemu.rs +++ b/scripts/axbuild/src/arceos/test/rust_qemu.rs @@ -357,8 +357,8 @@ mod tests { "lockdep-baseline", ARCEOS_RUST_LOCKDEP_DETECT_FEATURE, "net-loopback", - "cfs", - "rr", + "sched-cfs", + "sched-rr", ARCEOS_RUST_STACK_GUARD_PAGE_FEATURE, ] { let features = rust_qemu_features_for_list(Some(feature), false).unwrap(); diff --git a/scripts/axbuild/src/build/platform.rs b/scripts/axbuild/src/build/platform.rs index 1e2a080406..34812b35ed 100644 --- a/scripts/axbuild/src/build/platform.rs +++ b/scripts/axbuild/src/build/platform.rs @@ -83,16 +83,16 @@ pub(super) fn is_known_axstd_feature(feature: &str) -> bool { | "lockdep" | "task-ext" | "tracepoint-hooks" - | "rr" - | "cfs" + | "sched-rr" + | "sched-cfs" | "stack-guard-page" | "stack-protector" | "fs" - | "ext4" - | "fat" + | "ext4fs" + | "fatfs" | "net" | "vsock" - | "aic8800" + | "aic8800-wifi" | "dns" | "display" | "input" diff --git a/test-suit/arceos/rust/Cargo.toml b/test-suit/arceos/rust/Cargo.toml index bb3adca333..72fb5e2220 100644 --- a/test-suit/arceos/rust/Cargo.toml +++ b/test-suit/arceos/rust/Cargo.toml @@ -10,8 +10,8 @@ std = [] ax-std = ["dep:ax-driver", "dep:ax-hal", "dep:ax-std"] memtest = ["ax-std", "dep:rand", "ax-std/alloc", "ax-std/multitask"] task-yield = ["ax-std", "ax-std/multitask"] -rr = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/rr"] -cfs = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/cfs"] +sched-rr = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/sched-rr"] +sched-cfs = ["ax-std", "ax-std/alloc", "ax-std/multitask", "ax-std/sched-cfs"] task-affinity = ["ax-std", "ax-std/multitask"] task-wait-queue = ["ax-std", "ax-std/multitask", "ax-std/irq"] task-wait-queue-remote-wake = ["ax-std", "ax-std/multitask", "ax-std/irq", "ax-std/ipi"] @@ -24,7 +24,7 @@ task-sleep = ["ax-std", "ax-std/multitask", "ax-std/irq"] task-smp-online = ["ax-std", "ax-std/multitask", "ax-std/irq", "ax-std/ipi"] task-stack-guard-page = ["ax-std", "ax-std/multitask", "ax-std/paging", "ax-std/stack-guard-page"] net-loopback = ["ax-std", "ax-driver/virtio-net", "ax-std/net", "ax-std/dns"] -fs-basic = ["ax-std", "ax-driver/virtio-blk", "ax-std/alloc", "ax-std/fat"] +fs-basic = ["ax-std", "ax-driver/virtio-blk", "ax-std/alloc", "ax-std/fatfs"] debug-backtrace = ["ax-std", "dep:axbacktrace", "ax-std/backtrace"] debug-panic-path = ["ax-std", "dep:axbacktrace", "ax-std/backtrace"] display-basic = ["ax-std", "ax-driver/virtio-gpu", "dep:embedded-graphics", "ax-std/display"] diff --git a/test-suit/arceos/rust/src/lib.rs b/test-suit/arceos/rust/src/lib.rs index d60df1e225..00bbb856e2 100644 --- a/test-suit/arceos/rust/src/lib.rs +++ b/test-suit/arceos/rust/src/lib.rs @@ -49,8 +49,8 @@ pub mod net; #[cfg(all( feature = "ax-std", any( - feature = "cfs", - feature = "rr", + feature = "sched-cfs", + feature = "sched-rr", feature = "task-affinity", feature = "task-ipi", feature = "task-irq", @@ -111,8 +111,8 @@ test_runner!( test_runner!("lockdep-detect", run_lockdep_detect, lockdep::detect::run); test_runner!("memtest", run_memtest, mem::test::run); test_runner!("net-loopback", run_net_loopback, net::loopback::run); -test_runner!("cfs", run_sched_cfs, task::priority::run); -test_runner!("rr", run_sched_rr, task::priority::run); +test_runner!("sched-cfs", run_sched_cfs, task::priority::run); +test_runner!("sched-rr", run_sched_rr, task::priority::run); test_runner!("task-affinity", run_task_affinity, task::affinity::run); test_runner!("task-ipi", run_task_ipi, task::ipi::run); test_runner!("task-irq", run_task_irq, task::irq::run); @@ -191,10 +191,14 @@ const SELECTED_TESTS: &[TestCase] = &[ "finite network address smoke", run_net_loopback, ), - #[cfg(feature = "cfs")] - TestCase::new("cfs", "CFS scheduling priority smoke", run_sched_cfs), - #[cfg(feature = "rr")] - TestCase::new("rr", "round-robin scheduling priority smoke", run_sched_rr), + #[cfg(feature = "sched-cfs")] + TestCase::new("sched-cfs", "CFS scheduling priority smoke", run_sched_cfs), + #[cfg(feature = "sched-rr")] + TestCase::new( + "sched-rr", + "round-robin scheduling priority smoke", + run_sched_rr, + ), #[cfg(feature = "task-affinity")] TestCase::new("task-affinity", "task CPU affinity", run_task_affinity), #[cfg(feature = "task-ipi")] @@ -203,7 +207,10 @@ const SELECTED_TESTS: &[TestCase] = &[ TestCase::new("task-irq", "task IRQ state", run_task_irq), #[cfg(feature = "task-parallel")] TestCase::new("task-parallel", "parallel computation", run_task_parallel), - #[cfg(all(feature = "task-priority", not(any(feature = "cfs", feature = "rr"))))] + #[cfg(all( + feature = "task-priority", + not(any(feature = "sched-cfs", feature = "sched-rr")) + ))] TestCase::new( "task-priority", "task priority scheduling smoke", diff --git a/test-suit/arceos/rust/src/task/mod.rs b/test-suit/arceos/rust/src/task/mod.rs index 76d05d78b2..e0f68e0112 100644 --- a/test-suit/arceos/rust/src/task/mod.rs +++ b/test-suit/arceos/rust/src/task/mod.rs @@ -6,7 +6,7 @@ pub mod ipi; pub mod irq; #[cfg(feature = "task-parallel")] pub mod parallel; -#[cfg(any(feature = "task-priority", feature = "cfs", feature = "rr"))] +#[cfg(any(feature = "task-priority", feature = "sched-cfs", feature = "sched-rr"))] pub mod priority; #[cfg(feature = "task-sleep")] pub mod sleep; diff --git a/test-suit/arceos/rust/src/task/priority.rs b/test-suit/arceos/rust/src/task/priority.rs index ce249772f1..4b909789da 100644 --- a/test-suit/arceos/rust/src/task/priority.rs +++ b/test-suit/arceos/rust/src/task/priority.rs @@ -72,7 +72,7 @@ pub fn run() -> crate::TestResult { tasks.into_iter().map(|task| task.join().unwrap()).unzip(); let actual = results.iter().sum::(); - if cfg!(feature = "cfs") && thread::available_parallelism().unwrap().get() == 1 { + if cfg!(feature = "sched-cfs") && thread::available_parallelism().unwrap().get() == 1 { assert!( leave_times[0] > leave_times[1] && leave_times[1] > leave_times[2] From 5b86155447722af64258bd09b837f3098f13f6e2 Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Mon, 6 Jul 2026 16:55:37 +0800 Subject: [PATCH 6/8] docs: update feature flag names across documentation for consistency --- docs/docs/architecture/arceos.md | 2 +- docs/docs/architecture/driver/features.md | 2 +- docs/docs/components/crates/arceos-affinity.md | 4 ++-- docs/docs/components/crates/arceos-api.md | 12 ++++++------ docs/docs/components/crates/arceos-priority.md | 6 +++--- docs/docs/components/crates/arceos-yield.md | 4 ++-- docs/docs/components/crates/ax-api.md | 2 +- docs/docs/components/crates/ax-fs-ng.md | 2 +- docs/docs/components/crates/ax-sched.md | 2 +- docs/docs/components/crates/ax-task.md | 8 ++++---- docs/docs/components/crates/starry-kernel.md | 2 +- docs/docs/debug/might-sleep-followups.md | 2 +- docs/docs/development/arceos.md | 4 ++-- docs/docs/development/starryos.md | 2 +- os/arceos/modules/axtask/README.md | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/docs/architecture/arceos.md b/docs/docs/architecture/arceos.md index 03ea65191d..f0aeb87ede 100644 --- a/docs/docs/architecture/arceos.md +++ b/docs/docs/architecture/arceos.md @@ -201,7 +201,7 @@ sequenceDiagram ### 任务与调度模型 -`ax-task` 是 ArceOS 并发模型的核心。`multitask` 打开前后,模块会走完全不同的实现路径;调度算法由 `multitask`、`rr`、`cfs` 等 feature 选择。 +`ax-task` 是 ArceOS 并发模型的核心。`multitask` 打开前后,模块会走完全不同的实现路径;调度算法由 `multitask`、`sched-rr`、`sched-cfs` 等 feature 选择。 ```mermaid stateDiagram-v2 diff --git a/docs/docs/architecture/driver/features.md b/docs/docs/architecture/driver/features.md index 5432312902..240b8ee807 100644 --- a/docs/docs/architecture/driver/features.md +++ b/docs/docs/architecture/driver/features.md @@ -61,7 +61,7 @@ VirtIO feature 组合能力边界和 PCI transport: | `fxmac` | `fxmac_rs` | | `intel-net` | `eth-intel` | | `realtek-rtl8125` | `realtek-rtl8125` | -| `aic8800` | `aic8800` + `sdhci-cv1800` + `sdio-host` | +| `aic8800-wifi` | `aic8800` + `sdhci-cv1800` + `sdio-host` | | `rknpu` | `rockchip-npu` | | `rga` | `rockchip-rga` | | `jpeg` | `rockchip-jpeg` | diff --git a/docs/docs/components/crates/arceos-affinity.md b/docs/docs/components/crates/arceos-affinity.md index f849614e66..deb01c163e 100644 --- a/docs/docs/components/crates/arceos-affinity.md +++ b/docs/docs/components/crates/arceos-affinity.md @@ -42,8 +42,8 @@ flowchart LR ### 1.3 feature 与调度器关系 `Cargo.toml` 中的: -- `rr` -- `cfs` +- `sched-rr` +- `sched-cfs` 会透传到 `ax-std` 对应的调度器 feature。这个 crate 本身并不强依赖某一种调度算法,但它确实依赖: diff --git a/docs/docs/components/crates/arceos-api.md b/docs/docs/components/crates/arceos-api.md index d8bbaf624d..55c6073e32 100644 --- a/docs/docs/components/crates/arceos-api.md +++ b/docs/docs/components/crates/arceos-api.md @@ -43,13 +43,13 @@ - `lib.rs` 决定对外暴露什么。 - `imp/*` 决定每个 API 实际调用哪个底层模块。 -### 1.4 `stubs` 的特殊语义 +### 1.4 `dummy-if-not-enabled` 的特殊语义 这是 `ax-api` 非常重要的一个 feature: - 正常情况下,未打开某能力 feature 时,对应 API 根本不会被编译进 crate。 -- 如果同时打开 `stubs`,则未启用能力的 API 也会生成,但函数体会走 `unimplemented!()`,类型则可能退化为空占位 struct。 +- 如果同时打开 `dummy-if-not-enabled`,则未启用能力的 API 也会生成,但函数体会走 `unimplemented!()`,类型则可能退化为空占位 struct。 -这意味着 `stubs` 不是“开启某种退化实现”,而是“强行保留符号表形状,运行时再失败”。文档和调用方都必须清楚这一点,否则很容易把“编译通过”误判成“功能可用”。 +这意味着 `dummy-if-not-enabled` 不是“开启某种退化实现”,而是“强行保留符号表形状,运行时再失败”。文档和调用方都必须清楚这一点,否则很容易把“编译通过”误判成“功能可用”。 ### 1.5 关键公开类型与句柄 - `AxError` / `AxResult`:统一错误类型与返回值约定。 @@ -147,7 +147,7 @@ ax-api = { workspace = true, features = ["alloc", "multitask", "fs", "net"] } 1. 上层应优先使用 `ax-api` 暴露的稳定接口,不要一开始就直接依赖多个 `ax*` 内核模块。 2. 新增 API 时,先在 `lib.rs` 中定义门面,再把具体实现落到 `imp/`,不要反过来让 `imp` 直接成为公开边界。 3. 若某能力必须受 feature 控制,应同时更新 `Cargo.toml`、`lib.rs` 中的宏调用,以及 `imp/` 子模块实现。 -4. `stubs` 仅适用于需要保留符号形状的场景,不能把它当成真正的降级实现。 +4. `dummy-if-not-enabled` 仅适用于需要保留符号形状的场景,不能把它当成真正的降级实现。 ### 4.3 关键开发建议 - 把 `modules` 视为最后兜底手段,而不是常规入口。 @@ -160,13 +160,13 @@ ax-api = { workspace = true, features = ["alloc", "multitask", "fs", "net"] } ### 单元测试 - `define_api!` / `define_api_type!` 在不同 feature 组合下的符号生成行为。 -- `stubs` 路径是否按预期生成占位函数/类型。 +- `dummy-if-not-enabled` 路径是否按预期生成占位函数/类型。 - 任务、DMA、文件系统和网络句柄等薄包装是否保持稳定语义。 ### 集成测试 - 通过 `ax-std` 或最小 ArceOS 应用验证时间、I/O、任务、文件系统、网络等门面 API 的实际可用性。 - 覆盖不同 feature 组合下的编译与运行路径,尤其是 `multitask`、`fs`、`net`、`dma`。 -- 对 `stubs`,至少要验证调用方不会误把占位 API 当成可运行实现。 +- 对 `dummy-if-not-enabled`,至少要验证调用方不会误把占位 API 当成可运行实现。 ### 覆盖率 - 对 `ax-api`,比运行时覆盖率更重要的是“门面完整性覆盖率”。 diff --git a/docs/docs/components/crates/arceos-priority.md b/docs/docs/components/crates/arceos-priority.md index 45be1e2573..43182ee9c1 100644 --- a/docs/docs/components/crates/arceos-priority.md +++ b/docs/docs/components/crates/arceos-priority.md @@ -38,7 +38,7 @@ flowchart LR ### 1.3 为什么顺序断言被限定得很窄 源码只在下面这个条件下做完成顺序断言: -- `cfg!(feature = "cfs")` +- `cfg!(feature = "sched-cfs")` - `available_parallelism() == 1` 这非常重要。它说明当前作者并没有声称“所有环境下优先级都会表现成固定顺序”,而只是说: @@ -85,7 +85,7 @@ graph LR ### 直接依赖 - `ax-std(alloc, multitask)`:需要堆对象、线程和 `join`。 -- `rr` / `cfs`:通过 feature 透传到底层调度器。 +- `sched-rr` / `sched-cfs`:通过 feature 透传到底层调度器。 ### 间接依赖 - `ax_api::task::ax_set_current_priority` @@ -117,7 +117,7 @@ cargo arceos test qemu --target riscv64gc-unknown-none-elf 如果你要真正验证“高优先级更早完成”的行为,建议额外准备: 1. 单核 QEMU 配置 -2. 显式打开 `cfs` +2. 显式打开 `sched-cfs` 3. 保持当前工作负载规模稳定 否则默认 4 核配置下,顺序本来就不应被写死。 diff --git a/docs/docs/components/crates/arceos-yield.md b/docs/docs/components/crates/arceos-yield.md index 32afe677f6..fc0dbc5a03 100644 --- a/docs/docs/components/crates/arceos-yield.md +++ b/docs/docs/components/crates/arceos-yield.md @@ -37,8 +37,8 @@ flowchart LR ### 1.3 feature 条件为什么重要 源码里有两个很关键的条件: -- `#[cfg(all(not(feature = "rr"), not(feature = "cfs")))]` -- `if cfg!(not(feature = "cfs")) && available_parallelism() == 1` +- `#[cfg(all(not(feature = "sched-rr"), not(feature = "sched-cfs")))]` +- `if cfg!(not(feature = "sched-cfs")) && available_parallelism() == 1` 这意味着: diff --git a/docs/docs/components/crates/ax-api.md b/docs/docs/components/crates/ax-api.md index ab64c99fbc..636743a8e4 100644 --- a/docs/docs/components/crates/ax-api.md +++ b/docs/docs/components/crates/ax-api.md @@ -12,7 +12,7 @@ - 目录角色:ArceOS 公共 API/feature 聚合层 - crate 形态:库 crate - 工作区位置:子工作区 `os/arceos` -- feature 视角:主要通过 `alloc`、`display`、`dma`、`stubs`、`fs`、`ipi`、`irq`、`multitask`、`net`、`paging` 控制编译期能力装配。 +- feature 视角:主要通过 `alloc`、`display`、`dma`、`dummy-if-not-enabled`、`fs`、`ipi`、`irq`、`multitask`、`net`、`paging` 控制编译期能力装配。 - 关键数据结构:可直接观察到的关键数据结构/对象包括 `AxTimeValue`、`DMAInfo`、`AxTaskHandle`、`AxWaitQueueHandle`。 ### 模块结构 diff --git a/docs/docs/components/crates/ax-fs-ng.md b/docs/docs/components/crates/ax-fs-ng.md index 739a2cb1b5..f7845a62ba 100644 --- a/docs/docs/components/crates/ax-fs-ng.md +++ b/docs/docs/components/crates/ax-fs-ng.md @@ -12,7 +12,7 @@ - 目录角色:ArceOS 内核模块 - crate 形态:库 crate - 工作区位置:子工作区 `os/arceos` -- feature 视角:主要通过 `ext4`、`fat`、`std`、`times` 控制编译期能力装配。 +- feature 视角:主要通过 `ext4fs`、`fatfs`、`vfs`、`lockdep` 控制编译期能力装配。 - 关键数据结构:可直接观察到的关键数据结构/对象包括 `DefaultFilesystem`、`Initialize`。 ### 模块结构 diff --git a/docs/docs/components/crates/ax-sched.md b/docs/docs/components/crates/ax-sched.md index bd9352132d..8caddcf6fd 100644 --- a/docs/docs/components/crates/ax-sched.md +++ b/docs/docs/components/crates/ax-sched.md @@ -109,7 +109,7 @@ ax-sched = { workspace = true } - CFS 的 vruntime 排序与 `nice` 映射。 ### 集成测试 -- 在 `ax-task` 中分别打开 `multitask`、`rr`、`cfs`,验证系统级调度行为不回归。 +- 在 `ax-task` 中分别打开 `multitask`、`sched-rr`、`sched-cfs`,验证系统级调度行为不回归。 - 检查 `set_priority()` 在上层 API 中的外显行为是否与所选调度器一致。 ### 覆盖率 diff --git a/docs/docs/components/crates/ax-task.md b/docs/docs/components/crates/ax-task.md index 789504c320..a8fe567e70 100644 --- a/docs/docs/components/crates/ax-task.md +++ b/docs/docs/components/crates/ax-task.md @@ -13,7 +13,7 @@ `ax-task` 的设计目标不是提供“单一线程库”,而是构造一个可裁剪的内核任务运行时: - 通过 `multitask` feature 在“真正多任务调度器”和“单任务桩实现”之间切换。 -- 通过 `multitask`、`rr`、`cfs` 在同一套 API 下选择不同调度策略。 +- 通过 `multitask`、`sched-rr`、`sched-cfs` 在同一套 API 下选择不同调度策略。 - 通过 `irq`、`preempt`、`smp`、`tls`、`task-ext` 决定任务系统究竟具备多少内核能力。 因此,`ax-task` 是一个强 feature 驱动的状态机模块,而不是简单的 API 封装。 @@ -45,8 +45,8 @@ `ax-task` 并不自己实现完整调度算法,而是通过 `api.rs` 中的类型别名把 `TaskInner` 适配到 `axsched`: - `multitask`:`FifoScheduler` + `FifoTask`,协作式调度。 -- `rr`:`RRScheduler` + `RRTask`,带时间片,依赖 `preempt`。 -- `cfs`:`CFScheduler` + `CFSTask`,公平调度,同样依赖 `preempt`。 +- `sched-rr`:`RRScheduler` + `RRTask`,带时间片,依赖 `preempt`。 +- `sched-cfs`:`CFScheduler` + `CFSTask`,公平调度,同样依赖 `preempt`。 这层设计的关键好处是: @@ -146,7 +146,7 @@ ax-task = { workspace = true } 常见 feature 组合: - `multitask`:启用完整任务管理。 -- `multitask` / `rr` / `cfs`:选择调度器。 +- `multitask` / `sched-rr` / `sched-cfs`:选择调度器。 - `preempt`:允许基于 timer tick 的抢占。 - `irq`:启用 sleep/timeout 等基于中断的时间能力。 - `smp`:启用多核运行队列与任务迁移。 diff --git a/docs/docs/components/crates/starry-kernel.md b/docs/docs/components/crates/starry-kernel.md index b47027b4e1..8e1cdeda2e 100644 --- a/docs/docs/components/crates/starry-kernel.md +++ b/docs/docs/components/crates/starry-kernel.md @@ -130,7 +130,7 @@ graph LR ``` ### 直接依赖 -- `ax-runtime`:把 `uspace`、`multitask`、`rr`、`fs-ng-ext4`、`net` 等能力一次性装配到内核。 +- `ax-runtime`:把 `uspace`、`multitask`、`sched-rr`、`ext4fs`、`net` 等能力一次性装配到内核。 - `ax-hal`:用户态上下文、页表、trap、时间与控制台基础能力。 - `ax-task`:底层线程调度、`TaskExt` 和阻塞/唤醒机制。 - `ax-fs-ng`、`axfs-ng-vfs`:文件系统与路径解析。 diff --git a/docs/docs/debug/might-sleep-followups.md b/docs/docs/debug/might-sleep-followups.md index 75ec456104..7469ee24dd 100644 --- a/docs/docs/debug/might-sleep-followups.md +++ b/docs/docs/debug/might-sleep-followups.md @@ -379,7 +379,7 @@ rg -n "access_user_memory|handle_page_fault|vm_read|vm_write|IoDst::write" \ 2026-07-02 在实现 MS-1、MS-2 Phase 1 和 MS-3 Phase A/B 时,以下 host 单元测试过滤项出现 SIGSEGV: -- `cargo test -p ax-task --features "test rr" test_fp_state_switch` +- `cargo test -p ax-task --features "test sched-rr" test_fp_state_switch` - `cargo test -p ax-lockdep dynamic_lock_instances_do_not_consume_class_slots` - `cargo test -p ax-lockdep subclass_tracks_same_base_class_nesting` diff --git a/docs/docs/development/arceos.md b/docs/docs/development/arceos.md index 6734b5ab00..11c79c8227 100644 --- a/docs/docs/development/arceos.md +++ b/docs/docs/development/arceos.md @@ -236,8 +236,8 @@ paging = ["alloc", "ax-hal/paging", "ax-runtime/paging"] # 任务 multitask = ["alloc", "ax-task/multitask", "ax-sync/multitask", "ax-runtime/multitask"] multitask = ["ax-task/multitask"] -rr = ["ax-task/rr", "irq"] -cfs = ["ax-task/cfs", "irq"] +sched-rr = ["ax-task/sched-rr", "irq"] +sched-cfs = ["ax-task/sched-cfs", "irq"] # 上层协议栈 fs = ["alloc", "paging", "ax-driver/virtio-blk", "dep:ax-fs", "ax-runtime/fs"] diff --git a/docs/docs/development/starryos.md b/docs/docs/development/starryos.md index 00e374129a..159c5a4216 100644 --- a/docs/docs/development/starryos.md +++ b/docs/docs/development/starryos.md @@ -117,7 +117,7 @@ StarryOS 专用组件(位于 `components/`): | `rknpu` | Rockchip NPU 驱动 | | `vsock` | VSOCK 支持 | -内核默认启用:`fp-simd`, `irq`, `uspace`, `page-alloc-4g`, `alloc-slab`, `multitask`, `task-ext`, `rr`, `rtc`, `fs-ng-ext4`, `net`。 +内核默认启用:`fp-simd`, `irq`, `uspace`, `multitask`, `task-ext`, `sched-rr`, `rtc`, `ext4fs`, `net`。 ### 3.3 KCOV 暂不引入 diff --git a/os/arceos/modules/axtask/README.md b/os/arceos/modules/axtask/README.md index e94d2f5f28..674a6439e6 100644 --- a/os/arceos/modules/axtask/README.md +++ b/os/arceos/modules/axtask/README.md @@ -15,8 +15,8 @@ by cargo features. - `irq`: Enable timer-based APIs such as `sleep`, `sleep_until`, and `WaitQueue::wait_timeout`. - `preempt`: Enable preemptive scheduling. - FIFO cooperative scheduler is the default when no scheduler feature is selected. -- `rr`: Use the Round-robin preemptive scheduler (enables `multitask` and `preempt`). -- `cfs`: Use the Completely Fair Scheduler (enables `multitask` and `preempt`). +- `sched-rr`: Use the Round-robin preemptive scheduler (enables `multitask` and `preempt`). +- `sched-cfs`: Use the Completely Fair Scheduler (enables `multitask` and `preempt`). - `tls`: Enable kernel space thread-local storage support. - `smp`: Enable SMP (symmetric multiprocessing) support. From a9601b7d96ca3d6da65afc1e827a5dc7f10752c6 Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Tue, 7 Jul 2026 08:24:09 +0800 Subject: [PATCH 7/8] Rename `ext4fs` feature flag to `ext4` in starry-kernel for shorter naming Rename the `ext4fs` feature to `ext4` across starry-kernel Cargo.toml, all `#[cfg(feature = "ext4fs")]` sites (loop device, loop_block, mount), LKM crates (hello, kprobe_test), the starryos binary, and documentation. Also adds an untracked design document (p.md) for ArceOS feature ownership redesign. --- docs/docs/components/crates/starry-kernel.md | 2 +- docs/docs/development/starryos.md | 2 +- os/StarryOS/kernel/Cargo.toml | 2 +- os/StarryOS/kernel/src/pseudofs/dev/loop.rs | 10 +++++----- os/StarryOS/kernel/src/pseudofs/dev/mod.rs | 4 ++-- os/StarryOS/kernel/src/syscall/fs/mount.rs | 4 ++-- os/StarryOS/lkm/hello/Cargo.toml | 2 +- os/StarryOS/lkm/kprobe_test/Cargo.toml | 2 +- os/StarryOS/starryos/Cargo.toml | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/docs/components/crates/starry-kernel.md b/docs/docs/components/crates/starry-kernel.md index 8e1cdeda2e..62174b9f2e 100644 --- a/docs/docs/components/crates/starry-kernel.md +++ b/docs/docs/components/crates/starry-kernel.md @@ -130,7 +130,7 @@ graph LR ``` ### 直接依赖 -- `ax-runtime`:把 `uspace`、`multitask`、`sched-rr`、`ext4fs`、`net` 等能力一次性装配到内核。 +- `ax-runtime`:把 `uspace`、`multitask`、`sched-rr`、`ext4`、`net` 等能力一次性装配到内核。 - `ax-hal`:用户态上下文、页表、trap、时间与控制台基础能力。 - `ax-task`:底层线程调度、`TaskExt` 和阻塞/唤醒机制。 - `ax-fs-ng`、`axfs-ng-vfs`:文件系统与路径解析。 diff --git a/docs/docs/development/starryos.md b/docs/docs/development/starryos.md index 159c5a4216..b11d94b5be 100644 --- a/docs/docs/development/starryos.md +++ b/docs/docs/development/starryos.md @@ -117,7 +117,7 @@ StarryOS 专用组件(位于 `components/`): | `rknpu` | Rockchip NPU 驱动 | | `vsock` | VSOCK 支持 | -内核默认启用:`fp-simd`, `irq`, `uspace`, `multitask`, `task-ext`, `sched-rr`, `rtc`, `ext4fs`, `net`。 +内核默认启用:`fp-simd`, `irq`, `uspace`, `multitask`, `task-ext`, `sched-rr`, `rtc`, `ext4`, `net`。 ### 3.3 KCOV 暂不引入 diff --git a/os/StarryOS/kernel/Cargo.toml b/os/StarryOS/kernel/Cargo.toml index 8a9555e343..3c34e23b1e 100644 --- a/os/StarryOS/kernel/Cargo.toml +++ b/os/StarryOS/kernel/Cargo.toml @@ -16,7 +16,7 @@ license.workspace = true [features] default = ["dynamic_debug"] dev-log = [] -ext4fs = ["ax-fs-ng/ext4fs"] +ext4 = ["ax-fs-ng/ext4fs"] input = ["dep:ax-input", "ax-runtime/input"] ipi = ["ax-runtime/ipi"] memtrack = ["axbacktrace/alloc", "ax-alloc/tracking"] diff --git a/os/StarryOS/kernel/src/pseudofs/dev/loop.rs b/os/StarryOS/kernel/src/pseudofs/dev/loop.rs index 44030ad771..b4942d2d8e 100644 --- a/os/StarryOS/kernel/src/pseudofs/dev/loop.rs +++ b/os/StarryOS/kernel/src/pseudofs/dev/loop.rs @@ -20,7 +20,7 @@ use linux_raw_sys::{ }; use starry_vm::{VmMutPtr, VmPtr}; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] use super::loop_block::BlockCache; use crate::{ file::{FileLike, get_file_like}, @@ -49,7 +49,7 @@ pub struct LoopDevice { exclusive: AtomicBool, /// Block-device data cache. Populated by `as_dyn_block_device()`, /// written back and cleared by `LOOP_CLR_FD`. - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] pub(super) block_cache: Mutex, } @@ -64,7 +64,7 @@ impl LoopDevice { file_name: Mutex::new([0u8; 64]), flags: AtomicU32::new(0), exclusive: AtomicBool::new(false), - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] block_cache: Mutex::new(BlockCache::new()), } } @@ -190,7 +190,7 @@ impl DeviceOps for LoopDevice { // This runs in normal syscall context so CachedFile VFS I/O // (page cache updates) is safe. The cache lock ensures no // concurrent write_block() can race. - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] self.detach_block_cache(guard.as_ref())?; *guard = None; @@ -305,7 +305,7 @@ impl DeviceOps for LoopDevice { // Atomically claim the dirty flag so that a concurrent // write_block() will re-set dirty=true after our snapshot, // guaranteeing its data is flushed on the next attempt. - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] self.flush_block_cache_ioctl()?; } BLKIOMIN => { diff --git a/os/StarryOS/kernel/src/pseudofs/dev/mod.rs b/os/StarryOS/kernel/src/pseudofs/dev/mod.rs index 5d56021b61..5361492430 100644 --- a/os/StarryOS/kernel/src/pseudofs/dev/mod.rs +++ b/os/StarryOS/kernel/src/pseudofs/dev/mod.rs @@ -17,11 +17,11 @@ mod kpu; #[cfg(feature = "dev-log")] mod log; mod r#loop; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] mod loop_block; #[cfg(feature = "jpeg")] mod mpp_service; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] pub use r#loop::LoopDevice; #[cfg(feature = "sg2002")] pub mod ion; diff --git a/os/StarryOS/kernel/src/syscall/fs/mount.rs b/os/StarryOS/kernel/src/syscall/fs/mount.rs index d71e5dc02c..ab87d22d00 100644 --- a/os/StarryOS/kernel/src/syscall/fs/mount.rs +++ b/os/StarryOS/kernel/src/syscall/fs/mount.rs @@ -198,7 +198,7 @@ pub fn sys_mount( mp.set_readonly(true); } } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] "ext4" => { mount_ext4(&source, &target, (flags & MS_RDONLY) != 0)?; } @@ -229,7 +229,7 @@ pub fn sys_mount( Ok(0) } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn mount_ext4(source: &str, target: &str, readonly: bool) -> AxResult<()> { use alloc::{boxed::Box, sync::Arc}; diff --git a/os/StarryOS/lkm/hello/Cargo.toml b/os/StarryOS/lkm/hello/Cargo.toml index 0e5019f5f5..cf63cbe368 100644 --- a/os/StarryOS/lkm/hello/Cargo.toml +++ b/os/StarryOS/lkm/hello/Cargo.toml @@ -14,7 +14,7 @@ ax-driver.workspace = true ax-hal.workspace = true ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn = { workspace = true, optional = true } -starry-kernel = { workspace = true, features = ["dev-log", "ext4fs"] } +starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } kmod-tools.workspace = true diff --git a/os/StarryOS/lkm/kprobe_test/Cargo.toml b/os/StarryOS/lkm/kprobe_test/Cargo.toml index 9b59efeb89..ce36e7627f 100644 --- a/os/StarryOS/lkm/kprobe_test/Cargo.toml +++ b/os/StarryOS/lkm/kprobe_test/Cargo.toml @@ -14,7 +14,7 @@ ax-driver.workspace = true ax-hal.workspace = true ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn = { workspace = true, optional = true } -starry-kernel = { workspace = true, features = ["dev-log", "ext4fs"] } +starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } ax-std = { workspace = true, features = ["ext-ld", "fs", "multitask", "irq"] } ax-log.workspace = true diff --git a/os/StarryOS/starryos/Cargo.toml b/os/StarryOS/starryos/Cargo.toml index dbbb21ea07..b2ae55e612 100644 --- a/os/StarryOS/starryos/Cargo.toml +++ b/os/StarryOS/starryos/Cargo.toml @@ -49,7 +49,7 @@ ax-driver.workspace = true ax-hal.workspace = true ax-runtime = { workspace = true, features = ["ext-ld", "irq"] } axplat-dyn.workspace = true -starry-kernel = { workspace = true, features = ["dev-log", "ext4fs"] } +starry-kernel = { workspace = true, features = ["dev-log", "ext4"] } [target.'cfg(any(windows, all(unix, not(target_env = "musl"))))'.dependencies] anyhow = "1.0" From 4d8d8117f40fa5907f1cae4171ff9978858a1604 Mon Sep 17 00:00:00 2001 From: ZCShou <72115@163.com> Date: Tue, 7 Jul 2026 08:32:32 +0800 Subject: [PATCH 8/8] Rename `ext4fs`/`fatfs` feature flags to `ext4`/`fat` in ax-fs-ng for shorter naming --- docs/docs/components/crates/ax-fs-ng.md | 2 +- os/StarryOS/kernel/Cargo.toml | 2 +- os/arceos/modules/axfs-ng/Cargo.toml | 4 +-- os/arceos/modules/axfs-ng/src/block.rs | 24 +++++++-------- .../axfs-ng/src/block_runtime/device.rs | 24 +++++++-------- .../modules/axfs-ng/src/block_runtime/mod.rs | 2 +- os/arceos/modules/axfs-ng/src/file/cache.rs | 30 +++++++++---------- os/arceos/modules/axfs-ng/src/file/mod.rs | 2 +- os/arceos/modules/axfs-ng/src/fs/mod.rs | 30 +++++++++---------- os/arceos/modules/axfs-ng/src/lib.rs | 14 ++++----- os/arceos/modules/axruntime/Cargo.toml | 4 +-- 11 files changed, 69 insertions(+), 69 deletions(-) diff --git a/docs/docs/components/crates/ax-fs-ng.md b/docs/docs/components/crates/ax-fs-ng.md index f7845a62ba..939519c5c9 100644 --- a/docs/docs/components/crates/ax-fs-ng.md +++ b/docs/docs/components/crates/ax-fs-ng.md @@ -12,7 +12,7 @@ - 目录角色:ArceOS 内核模块 - crate 形态:库 crate - 工作区位置:子工作区 `os/arceos` -- feature 视角:主要通过 `ext4fs`、`fatfs`、`vfs`、`lockdep` 控制编译期能力装配。 +- feature 视角:主要通过 `ext4`、`fat`、`vfs`、`lockdep` 控制编译期能力装配。 - 关键数据结构:可直接观察到的关键数据结构/对象包括 `DefaultFilesystem`、`Initialize`。 ### 模块结构 diff --git a/os/StarryOS/kernel/Cargo.toml b/os/StarryOS/kernel/Cargo.toml index 3c34e23b1e..1f582b1974 100644 --- a/os/StarryOS/kernel/Cargo.toml +++ b/os/StarryOS/kernel/Cargo.toml @@ -16,7 +16,7 @@ license.workspace = true [features] default = ["dynamic_debug"] dev-log = [] -ext4 = ["ax-fs-ng/ext4fs"] +ext4 = ["ax-fs-ng/ext4"] input = ["dep:ax-input", "ax-runtime/input"] ipi = ["ax-runtime/ipi"] memtrack = ["axbacktrace/alloc", "ax-alloc/tracking"] diff --git a/os/arceos/modules/axfs-ng/Cargo.toml b/os/arceos/modules/axfs-ng/Cargo.toml index d20d2375f9..927ea861e2 100644 --- a/os/arceos/modules/axfs-ng/Cargo.toml +++ b/os/arceos/modules/axfs-ng/Cargo.toml @@ -8,8 +8,8 @@ description = "ArceOS filesystem module" license.workspace = true [features] -fatfs = ["dep:fatfs"] -ext4fs = ["dep:rsext4"] +fat = ["dep:fatfs"] +ext4 = ["dep:rsext4"] vfs = [] lockdep = ["axfs-ng-vfs/lockdep"] diff --git a/os/arceos/modules/axfs-ng/src/block.rs b/os/arceos/modules/axfs-ng/src/block.rs index 205984c721..2a3a80f4c1 100644 --- a/os/arceos/modules/axfs-ng/src/block.rs +++ b/os/arceos/modules/axfs-ng/src/block.rs @@ -1,6 +1,6 @@ use alloc::{boxed::Box, sync::Arc}; -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] use ax_errno::AxError; use ax_errno::AxResult; @@ -39,9 +39,9 @@ pub(crate) trait FsBlockDevice: Send { fn num_blocks(&self) -> u64; fn block_size(&self) -> usize; fn read_block(&mut self, block_id: u64, buf: &mut [u8]) -> AxResult; - #[cfg(any(feature = "ext4fs", feature = "fatfs"))] + #[cfg(any(feature = "ext4", feature = "fat"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult; - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn flush(&mut self) -> AxResult; } @@ -62,18 +62,18 @@ impl FsBlockDevice for Box { (**self).read_block(block_id, buf) } - #[cfg(any(feature = "ext4fs", feature = "fatfs"))] + #[cfg(any(feature = "ext4", feature = "fat"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult { (**self).write_block(block_id, buf) } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn flush(&mut self) -> AxResult { (**self).flush() } } -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] pub(crate) struct RegionBlockDevice { inner: T, region: BlockRegion, @@ -89,7 +89,7 @@ impl NativeHandleBlockDevice { } } -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] impl RegionBlockDevice { pub const fn new(inner: T, region: BlockRegion) -> Self { Self { inner, region } @@ -111,7 +111,7 @@ impl RegionBlockDevice { } } -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] impl FsBlockDevice for RegionBlockDevice { fn name(&self) -> &str { self.inner.name() @@ -135,7 +135,7 @@ impl FsBlockDevice for RegionBlockDevice { self.inner.read_block(physical, buf) } - #[cfg(any(feature = "ext4fs", feature = "fatfs"))] + #[cfg(any(feature = "ext4", feature = "fat"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult { self.check_io_bounds(block_id, buf.len())?; let physical = self @@ -146,7 +146,7 @@ impl FsBlockDevice for RegionBlockDevice { self.inner.write_block(physical, buf) } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn flush(&mut self) -> AxResult { self.inner.flush() } @@ -169,12 +169,12 @@ impl FsBlockDevice for NativeHandleBlockDevice { self.handle.read_blocks(block_id, buf) } - #[cfg(any(feature = "ext4fs", feature = "fatfs"))] + #[cfg(any(feature = "ext4", feature = "fat"))] fn write_block(&mut self, block_id: u64, buf: &[u8]) -> AxResult { self.handle.write_blocks(block_id, buf) } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn flush(&mut self) -> AxResult { self.handle.flush_blocks() } diff --git a/os/arceos/modules/axfs-ng/src/block_runtime/device.rs b/os/arceos/modules/axfs-ng/src/block_runtime/device.rs index 7f6a21fd9c..755f30e972 100644 --- a/os/arceos/modules/axfs-ng/src/block_runtime/device.rs +++ b/os/arceos/modules/axfs-ng/src/block_runtime/device.rs @@ -125,12 +125,12 @@ impl Drop for DataIoGuard<'_> { } } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] struct FlushBarrierGuard<'a> { device: &'a BlockDeviceHandle, } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] impl Drop for FlushBarrierGuard<'_> { fn drop(&mut self) { self.device.flush_active.store(false, Ordering::Release); @@ -587,7 +587,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn poll_one(&self, key: RequestKey) -> bool { let mut poller = DeviceRequestPoller { device: self }; CompletionDrain::new(&self.pending, &mut poller).poll_one(key) @@ -636,14 +636,14 @@ impl BlockDeviceHandle { self.submit_io(RequestOp::Read, block_id, buf, None) } - #[cfg(any(feature = "ext4fs", feature = "fatfs"))] + #[cfg(any(feature = "ext4", feature = "fat"))] pub(crate) fn write_blocks(&self, block_id: u64, buf: &[u8]) -> AxResult { self.check_not_poisoned()?; let mut no_dst = []; self.submit_io(RequestOp::Write, block_id, &mut no_dst, Some(buf)) } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] pub(crate) fn flush_blocks(&self) -> AxResult { self.check_not_poisoned()?; let _barrier = self.acquire_flush_barrier()?; @@ -676,7 +676,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn flush_queue_index(&self) -> Option { self.queues .iter() @@ -684,7 +684,7 @@ impl BlockDeviceHandle { .find_map(|(idx, queue)| queue.lock().info.limits.supports_flush.then_some(idx)) } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn wait_for_all_pending(&self) -> AxResult { loop { let queues = @@ -830,7 +830,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn acquire_flush_barrier(&self) -> AxResult> { loop { if self @@ -866,7 +866,7 @@ impl BlockDeviceHandle { Ok(()) } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn wait_for_active_data_drain(&self) -> AxResult { let task_id = current_task_id().unwrap_or(0); if self.active_data_ops.load(Ordering::Acquire) == 0 { @@ -1208,7 +1208,7 @@ impl BlockDeviceHandle { } } - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn wait_for_completion(&self, key: RequestKey, dst: Option<&mut [u8]>) -> AxResult { let task_id = current_task_id().unwrap_or(0); let observed = self.pending.lock().register_waiter_task(key, task_id); @@ -1541,7 +1541,7 @@ impl RequestPoller for DeviceRequestPoller<'_> { } } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn submit_flush_request(queue: &mut QueueRuntime, info: QueueInfo) -> Result { match &mut queue.queue { RuntimeQueue::Legacy(legacy) => { @@ -1799,7 +1799,7 @@ mod tests { } } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn queue_ids_from_bits(bits: u64) -> impl Iterator { (0..u64::BITS as usize).filter(move |queue_id| bits & (1 << queue_id) != 0) } diff --git a/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs b/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs index 7ef4d19761..f93a43a54f 100644 --- a/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs +++ b/os/arceos/modules/axfs-ng/src/block_runtime/mod.rs @@ -1980,7 +1980,7 @@ mod tests { } #[test] - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] fn block_device_flush_retries_without_returning_wouldblock() { let _guard = test_task_guard(); let mut queue = MockQueue::with_retry_submits(1); diff --git a/os/arceos/modules/axfs-ng/src/file/cache.rs b/os/arceos/modules/axfs-ng/src/file/cache.rs index 831890d6bd..69485b3b48 100644 --- a/os/arceos/modules/axfs-ng/src/file/cache.rs +++ b/os/arceos/modules/axfs-ng/src/file/cache.rs @@ -1,5 +1,5 @@ use alloc::{boxed::Box, sync::Arc, vec::Vec}; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] use alloc::{collections::BTreeMap, sync::Weak}; #[cfg(feature = "vfs")] use core::sync::atomic::AtomicBool; @@ -9,7 +9,7 @@ use core::{ }; use ax_io::prelude::*; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] use axfs_ng_vfs::FilesystemOps; use axfs_ng_vfs::{FileNode, Location, VfsError, VfsResult}; use intrusive_collections::{LinkedList, LinkedListAtomicLink, intrusive_adapter}; @@ -20,12 +20,12 @@ use crate::os::{memory::PAGE_SIZE, sync::SleepMutex as Mutex}; const DISK_PAGE_CACHE_CAP: usize = 512; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] type CachedFileKey = (usize, u64); -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] type InodeCacheIndex = BTreeMap>; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] static CACHED_FILE_BY_INODE: spin::LazyLock> = spin::LazyLock::new(|| Mutex::new(BTreeMap::new())); @@ -525,12 +525,12 @@ impl CachedFile { } let len = location.len()?; - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] let inode_key = should_share_cached_file_by_inode(&location).then(|| cached_file_key(&location)); - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] let inode_shared = inode_key.and_then(lookup_inode_cached_file); - #[cfg(not(feature = "ext4fs"))] + #[cfg(not(feature = "ext4"))] let inode_shared: Option> = None; let (created, user_data) = if let Some(shared) = inode_shared { (shared.clone(), FileUserData::Strong(shared)) @@ -565,7 +565,7 @@ impl CachedFile { } #[cfg(not(feature = "vfs"))] let _ = is_new; - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] if is_new && let Some(key) = inode_key { insert_inode_cached_file(key, &shared); } @@ -938,22 +938,22 @@ impl CachedFile { } } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn should_share_cached_file_by_inode(location: &Location) -> bool { location.filesystem().name() == "ext4" } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn filesystem_key(filesystem: &dyn FilesystemOps) -> usize { filesystem as *const dyn FilesystemOps as *const () as usize } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn cached_file_key(location: &Location) -> CachedFileKey { (filesystem_key(location.filesystem()), location.inode()) } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn lookup_inode_cached_file(key: CachedFileKey) -> Option> { let mut cache = CACHED_FILE_BY_INODE.lock(); match cache.get(&key).and_then(Weak::upgrade) { @@ -965,14 +965,14 @@ fn lookup_inode_cached_file(key: CachedFileKey) -> Option> } } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn insert_inode_cached_file(key: CachedFileKey, shared: &Arc) { CACHED_FILE_BY_INODE .lock() .insert(key, Arc::downgrade(shared)); } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] pub(crate) fn forget_cached_file_key(filesystem: &dyn FilesystemOps, inode: u64) { if filesystem.name() == "ext4" { CACHED_FILE_BY_INODE diff --git a/os/arceos/modules/axfs-ng/src/file/mod.rs b/os/arceos/modules/axfs-ng/src/file/mod.rs index 578c95aad0..c96459e6d9 100644 --- a/os/arceos/modules/axfs-ng/src/file/mod.rs +++ b/os/arceos/modules/axfs-ng/src/file/mod.rs @@ -4,7 +4,7 @@ mod open; mod page; pub use cache::CachedFile; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] pub(crate) use cache::forget_cached_file_key; #[cfg(feature = "vfs")] pub use cache::{page_cache_reclaim, sync_all_cached_files}; diff --git a/os/arceos/modules/axfs-ng/src/fs/mod.rs b/os/arceos/modules/axfs-ng/src/fs/mod.rs index bfddb4a42b..67009d5cfb 100644 --- a/os/arceos/modules/axfs-ng/src/fs/mod.rs +++ b/os/arceos/modules/axfs-ng/src/fs/mod.rs @@ -1,28 +1,28 @@ -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] use alloc::boxed::Box; use alloc::sync::Arc; use axfs_ng_vfs::{Filesystem, VfsResult}; -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] use crate::FilesystemKind; -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] use crate::block::FsBlockDevice; use crate::{BlockDeviceHandle, block::BlockRegion}; -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] mod ext4; -#[cfg(feature = "fatfs")] +#[cfg(feature = "fat")] mod fat; /// Create a filesystem instance from a block device. -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] pub fn new_default(dev: Box, region: BlockRegion) -> VfsResult { new_ext4(dev, region) } /// Create a filesystem instance from a detected filesystem kind. -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] pub(crate) fn new_by_kind( dev: Box, region: BlockRegion, @@ -38,12 +38,12 @@ pub(crate) fn new_by_kind( /// /// Use this for loop devices and other block backends created outside the /// platform probe path. -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] pub fn new_from_handle(dev: Arc, region: BlockRegion) -> VfsResult { new_default(crate::block::boxed_native_handle_block_device(dev), region) } -#[cfg(any(feature = "ext4fs", feature = "fatfs"))] +#[cfg(any(feature = "ext4", feature = "fat"))] pub(crate) fn new_from_handle_with_kind( dev: Arc, region: BlockRegion, @@ -56,7 +56,7 @@ pub(crate) fn new_from_handle_with_kind( ) } -#[cfg(not(any(feature = "ext4fs", feature = "fatfs")))] +#[cfg(not(any(feature = "ext4", feature = "fat")))] pub fn new_from_handle( _dev: Arc, _region: BlockRegion, @@ -64,7 +64,7 @@ pub fn new_from_handle( panic!("No filesystem feature enabled"); } -#[cfg(not(any(feature = "ext4fs", feature = "fatfs")))] +#[cfg(not(any(feature = "ext4", feature = "fat")))] pub(crate) fn new_from_handle_with_kind( _dev: Arc, _region: BlockRegion, @@ -73,22 +73,22 @@ pub(crate) fn new_from_handle_with_kind( panic!("No filesystem feature enabled"); } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn new_ext4(dev: Box, region: BlockRegion) -> VfsResult { ext4::Ext4Filesystem::new(dev, region) } -#[cfg(all(any(feature = "ext4fs", feature = "fatfs"), not(feature = "ext4fs")))] +#[cfg(all(any(feature = "ext4", feature = "fat"), not(feature = "ext4")))] fn new_ext4(_dev: Box, _region: BlockRegion) -> VfsResult { Err(ax_errno::AxError::Unsupported) } -#[cfg(feature = "fatfs")] +#[cfg(feature = "fat")] fn new_fat(dev: Box, region: BlockRegion) -> VfsResult { fat::FatFilesystem::new(dev, region) } -#[cfg(all(any(feature = "ext4fs", feature = "fatfs"), not(feature = "fatfs")))] +#[cfg(all(any(feature = "ext4", feature = "fat"), not(feature = "fat")))] fn new_fat(_dev: Box, _region: BlockRegion) -> VfsResult { Err(ax_errno::AxError::Unsupported) } diff --git a/os/arceos/modules/axfs-ng/src/lib.rs b/os/arceos/modules/axfs-ng/src/lib.rs index c872b443af..68830858e8 100644 --- a/os/arceos/modules/axfs-ng/src/lib.rs +++ b/os/arceos/modules/axfs-ng/src/lib.rs @@ -37,7 +37,7 @@ pub use highlevel::*; #[cfg(feature = "vfs")] pub mod vfs { /// Create a filesystem from a native block runtime handle. - #[cfg(any(feature = "ext4fs", feature = "fatfs"))] + #[cfg(any(feature = "ext4", feature = "fat"))] pub use crate::fs::new_from_handle as new_filesystem_from_handle; pub use crate::highlevel::*; } @@ -106,15 +106,15 @@ pub(crate) fn detect_filesystem( dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion, ) -> Option { - #[cfg(not(any(feature = "ext4fs", feature = "fatfs")))] + #[cfg(not(any(feature = "ext4", feature = "fat")))] let _ = (&mut *dev, region); - #[cfg(feature = "ext4fs")] + #[cfg(feature = "ext4")] if region_has_ext4(dev, region) { return Some(FilesystemKind::Ext4); } - #[cfg(feature = "fatfs")] + #[cfg(feature = "fat")] if region_has_fat(dev, region) { return Some(FilesystemKind::Fat); } @@ -122,7 +122,7 @@ pub(crate) fn detect_filesystem( None } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn region_has_ext4(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion) -> bool { const EXT4_SUPERBLOCK_OFFSET: usize = 1024; const EXT4_MAGIC_OFFSET: usize = 0x38; @@ -135,7 +135,7 @@ fn region_has_ext4(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegio ) } -#[cfg(feature = "fatfs")] +#[cfg(feature = "fat")] fn region_has_fat(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion) -> bool { const FAT16_MAGIC: &[u8; 5] = b"FAT16"; const FAT32_MAGIC: &[u8; 5] = b"FAT32"; @@ -160,7 +160,7 @@ fn region_has_fat(dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion || buf.get(82..87) == Some(FAT32_MAGIC.as_slice())) } -#[cfg(feature = "ext4fs")] +#[cfg(feature = "ext4")] fn region_has_magic_u16( dev: &mut dyn crate::block::FsBlockDevice, region: BlockRegion, diff --git a/os/arceos/modules/axruntime/Cargo.toml b/os/arceos/modules/axruntime/Cargo.toml index 501067b0f3..a43d64d206 100644 --- a/os/arceos/modules/axruntime/Cargo.toml +++ b/os/arceos/modules/axruntime/Cargo.toml @@ -49,8 +49,8 @@ fs = [ "dep:rdif-block", "ax-driver/block", ] -ext4fs = ["fs", "ax-fs-ng/ext4fs"] -fatfs = ["fs", "ax-fs-ng/fatfs"] +ext4fs = ["fs", "ax-fs-ng/ext4"] +fatfs = ["fs", "ax-fs-ng/fat"] input = ["paging", "dep:ax-input", "ax-driver/input"] net = [ "irq",