Skip to content

Commit cfc5f30

Browse files
authored
refactor: split starry into multiple crates and pass all basic testcases(#22)
* refactor: split starry into three crates * fix doc * test: enable all basic testcases
1 parent 418355e commit cfc5f30

40 files changed

+400
-277
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
arch: x86_64
2828
- name: Build docs
2929
continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }}
30-
run: make doc_check_missing
30+
run: make doc
3131
- name: Deploy to Github Pages
3232
if: ${{ github.ref == env.default-branch }}
3333
uses: JamesIves/github-pages-deploy-action@v4

Cargo.lock

Lines changed: 37 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,77 @@
1-
[package]
2-
name = "starry"
1+
[workspace]
2+
resolver = "2"
3+
members = ["api", "core"]
4+
exclude = [".arceos", "apps"]
5+
6+
[workspace.package]
37
version = "0.1.0"
48
edition = "2024"
5-
authors = ["Azure-stars <Azure_stars@126.com>", "Yuekai Jia <equation618@gmail.com>"]
9+
authors = [
10+
"Azure-stars <Azure_stars@126.com>",
11+
"Yuekai Jia <equation618@gmail.com>",
12+
]
613
homepage = "https://github.com/arceos-org/arceos"
714
repository = "https://github.com/arceos-org/starry-next"
815

9-
[features]
10-
lwext4_rs = ["axstd/lwext4_rs"]
11-
12-
[dependencies]
13-
log = "0.4"
14-
linkme = "0.3"
15-
axerrno = "0.1"
16-
memory_addr = "0.3"
17-
xmas-elf = "0.9"
18-
spin = "0.9"
19-
crate_interface = "0.1"
20-
bitflags = "2.6"
21-
percpu = "0.2.0"
22-
23-
kernel-elf-parser = "0.3"
24-
num_enum = { version = "0.7", default-features = false }
25-
syscalls = { version = "0.6", default-features = false }
26-
numeric-enum-macro = "0.2.0"
27-
static_assertions = "1.1.0"
28-
macro_rules_attribute = "0.2.0"
16+
[workspace.dependencies]
17+
axfeat = { git = "https://github.com/oscomp/arceos.git" }
18+
arceos_posix_api = { git = "https://github.com/oscomp/arceos.git", features = [
19+
"uspace",
20+
"smp",
21+
"irq",
22+
"fs",
23+
"multitask",
24+
"net",
25+
"pipe",
26+
"select",
27+
"epoll",
28+
] }
2929

3030
axconfig = { git = "https://github.com/oscomp/arceos.git" }
3131
axfs = { git = "https://github.com/oscomp/arceos.git" }
32-
axstd = { git = "https://github.com/oscomp/arceos.git", features = ["paging"] }
3332
axhal = { git = "https://github.com/oscomp/arceos.git", features = ["uspace"] }
33+
axlog = { git = "https://github.com/oscomp/arceos.git" }
3434
axmm = { git = "https://github.com/oscomp/arceos.git" }
35-
axtask = { git = "https://github.com/oscomp/arceos.git" }
35+
axns = { git = "https://github.com/oscomp/arceos.git", features = [
36+
"thread-local",
37+
] }
3638
axsync = { git = "https://github.com/oscomp/arceos.git" }
37-
axruntime = { git = "https://github.com/oscomp/arceos.git", features = ["multitask"] }
38-
arceos_posix_api = { git = "https://github.com/oscomp/arceos.git", features = ["uspace", "smp", "irq", "fs", "multitask", "net", "pipe", "select", "epoll"] }
39-
axns = { git = "https://github.com/oscomp/arceos.git", features = ["thread-local"] }
39+
axtask = { git = "https://github.com/oscomp/arceos.git" }
40+
41+
axerrno = "0.1"
42+
bitflags = "2.6"
43+
linkme = "0.3"
44+
memory_addr = "0.3"
45+
46+
starry-core = { path = "./core" }
47+
starry-api = { path = "./api" }
48+
49+
[package]
50+
name = "starry"
51+
version.workspace = true
52+
edition.workspace = true
53+
authors.workspace = true
54+
homepage.workspace = true
55+
repository.workspace = true
56+
57+
[features]
58+
lwext4_rs = ["axfeat/lwext4_rs"]
59+
60+
[dependencies]
61+
axfeat.workspace = true
62+
63+
axhal.workspace = true
64+
axlog.workspace = true
65+
axtask.workspace = true
66+
67+
axerrno.workspace = true
68+
linkme.workspace = true
69+
70+
starry-core.workspace = true
71+
starry-api.workspace = true
72+
73+
syscalls = { git = "https://github.com/jasonwhite/syscalls.git", rev = "92624de", default-features = false }
4074

4175
[patch.crates-io]
42-
syscalls = { git = "https://github.com/jasonwhite/syscalls.git", rev = "92624de"}
4376
page_table_multiarch = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "19ededd" }
4477
page_table_entry = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "19ededd" }
45-
46-
[target.'cfg(target_arch = "x86_64")'.dependencies]
47-
x86 = "0.52"
48-
49-
[build-dependencies]
50-
toml_edit = "0.22"

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ LOG ?= off
55
AX_TESTCASES_LIST=$(shell cat ./apps/$(AX_TESTCASE)/testcase_list | tr '\n' ',')
66
FEATURES ?= fp_simd
77

8+
export NO_AXSTD := y
9+
export AX_LIB := axfeat
10+
811
RUSTDOCFLAGS := -Z unstable-options --enable-index-page -D rustdoc::broken_intra_doc_links -D missing-docs
912
EXTRA_CONFIG ?= $(PWD)/configs/$(ARCH).toml
1013
ifneq ($(filter $(MAKECMDGOALS),doc_check_missing),) # make doc_check_missing
@@ -68,7 +71,7 @@ clean: ax_root
6871
done
6972
@cargo clean
7073

71-
doc_check_missing:
72-
@cargo doc --no-deps --all-features --workspace
74+
doc: defconfig
75+
@AX_CONFIG_PATH=$(PWD)/.axconfig.toml cargo doc --no-deps --all-features --workspace
7376

7477
.PHONY: all ax_root build run justrun debug disasm clean test_build

api/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "starry-api"
3+
version.workspace = true
4+
edition.workspace = true
5+
authors.workspace = true
6+
homepage.workspace = true
7+
repository.workspace = true
8+
9+
[dependencies]
10+
axconfig.workspace = true
11+
axfs.workspace = true
12+
axhal.workspace = true
13+
axlog.workspace = true
14+
axsync.workspace = true
15+
axtask.workspace = true
16+
arceos_posix_api.workspace = true
17+
18+
axerrno.workspace = true
19+
bitflags.workspace = true
20+
memory_addr.workspace = true
21+
22+
starry-core.workspace = true
23+
24+
macro_rules_attribute = "0.2"
25+
num_enum = { version = "0.7", default-features = false }
26+
static_assertions = "1.1"
27+
28+
[target.'cfg(target_arch = "x86_64")'.dependencies]
29+
x86 = "0.52"

src/syscall_imp/fs/ctl.rs renamed to api/src/imp/fs/ctl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use macro_rules_attribute::apply;
77

88
use crate::{
99
ptr::{PtrWrapper, UserConstPtr, UserPtr},
10-
syscall_imp::syscall_instrument,
10+
syscall_instrument,
1111
};
1212

1313
/// The ioctl() system call manipulates the underlying device parameters
@@ -32,7 +32,7 @@ pub fn sys_chdir(path: UserConstPtr<c_char>) -> LinuxResult<isize> {
3232
})
3333
}
3434

35-
pub(crate) fn sys_mkdirat(dirfd: i32, path: UserConstPtr<c_char>, mode: u32) -> LinuxResult<isize> {
35+
pub fn sys_mkdirat(dirfd: i32, path: UserConstPtr<c_char>, mode: u32) -> LinuxResult<isize> {
3636
let path = path.get_as_str()?;
3737

3838
if !path.starts_with("/") && dirfd != AT_FDCWD as i32 {
File renamed without changes.

src/syscall_imp/fs/io.rs renamed to api/src/imp/fs/io.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ use axerrno::LinuxResult;
55

66
use crate::ptr::{PtrWrapper, UserConstPtr, UserPtr};
77

8-
pub(crate) fn sys_read(fd: i32, buf: UserPtr<c_void>, count: usize) -> LinuxResult<isize> {
8+
pub fn sys_read(fd: i32, buf: UserPtr<c_void>, count: usize) -> LinuxResult<isize> {
99
let buf = buf.get_as_bytes(count)?;
1010
Ok(api::sys_read(fd, buf, count))
1111
}
1212

13-
pub(crate) fn sys_write(fd: i32, buf: UserConstPtr<c_void>, count: usize) -> LinuxResult<isize> {
13+
pub fn sys_write(fd: i32, buf: UserConstPtr<c_void>, count: usize) -> LinuxResult<isize> {
1414
let buf = buf.get_as_bytes(count)?;
1515
Ok(api::sys_write(fd, buf, count))
1616
}
1717

18-
pub(crate) fn sys_writev(
18+
pub fn sys_writev(
1919
fd: i32,
2020
iov: UserConstPtr<api::ctypes::iovec>,
2121
iocnt: i32,
@@ -24,7 +24,7 @@ pub(crate) fn sys_writev(
2424
unsafe { Ok(api::sys_writev(fd, iov, iocnt)) }
2525
}
2626

27-
pub(crate) fn sys_openat(
27+
pub fn sys_openat(
2828
dirfd: i32,
2929
path: UserConstPtr<c_char>,
3030
flags: i32,
@@ -34,12 +34,7 @@ pub(crate) fn sys_openat(
3434
Ok(api::sys_openat(dirfd, path.as_ptr(), flags, modes) as _)
3535
}
3636

37-
#[cfg(target_arch = "x86_64")]
38-
pub(crate) fn sys_open(
39-
path: UserConstPtr<c_char>,
40-
flags: i32,
41-
modes: mode_t,
42-
) -> LinuxResult<isize> {
37+
pub fn sys_open(path: UserConstPtr<c_char>, flags: i32, modes: mode_t) -> LinuxResult<isize> {
4338
use arceos_posix_api::AT_FDCWD;
4439
sys_openat(AT_FDCWD as _, path, flags, modes)
4540
}

api/src/imp/fs/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
mod ctl;
2+
mod fd_ops;
3+
mod io;
4+
mod mount;
5+
mod pipe;
6+
mod stat;
7+
8+
pub use self::ctl::*;
9+
pub use self::fd_ops::*;
10+
pub use self::io::*;
11+
pub use self::mount::*;
12+
pub use self::pipe::*;
13+
pub use self::stat::*;
File renamed without changes.

0 commit comments

Comments
 (0)