Skip to content

Commit 5c8fa32

Browse files
committed
refactor: axpoll
1 parent 9adc5cb commit 5c8fa32

File tree

26 files changed

+80
-46
lines changed

26 files changed

+80
-46
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ axtask = { path = "arceos/modules/axtask", features = ["task-ext"] }
4444

4545
axbacktrace = "0.1"
4646
axerrno = "0.1"
47-
axfs-ng-vfs = { git = "https://github.com/Starry-OS/axfs-ng-vfs.git", rev = "e3e83d6" }
47+
axfs-ng-vfs = "0.1"
4848
axio = "0.1"
49+
axpoll = "0.1"
4950
starry-process = "0.2"
5051
starry-signal = "0.2"
5152
starry-vm = "0.1"
@@ -146,11 +147,13 @@ optional = true
146147
axbacktrace = { git = "https://github.com/Starry-OS/axbacktrace.git", rev = "09c22b6" }
147148
axcpu = { git = "https://github.com/Starry-OS/axcpu.git", rev = "53455db" }
148149
axerrno = { git = "https://github.com/Starry-OS/axerrno.git", rev = "58be232" }
149-
axio = { git = "https://github.com/Starry-OS/axio.git", rev = "f7a2dfe" }
150+
axfs-ng-vfs = { git = "https://github.com/Starry-OS/axfs-ng-vfs.git", rev = "6cf8893" }
151+
axio = { git = "https://github.com/Starry-OS/axio.git", rev = "ebb0c6b" }
150152
axplat = { git = "https://github.com/Starry-OS/axplat_crates.git", rev = "243fdc9" }
151153
axplat-aarch64-qemu-virt = { git = "https://github.com/Starry-OS/axplat_crates.git", rev = "243fdc9" }
152154
axplat-riscv64-qemu-virt = { git = "https://github.com/Starry-OS/axplat_crates.git", rev = "243fdc9" }
153155
axplat-loongarch64-qemu-virt = { git = "https://github.com/Starry-OS/axplat_crates.git", rev = "243fdc9" }
156+
axpoll = { git = "https://github.com/Starry-OS/axpoll.git", rev = "258cb5f" }
154157
page_table_entry = { git = "https://github.com/Starry-OS/page_table_multiarch.git", rev = "3f697c8" }
155158
page_table_multiarch = { git = "https://github.com/Starry-OS/page_table_multiarch.git", rev = "3f697c8" }
156159
starry-process = { git = "https://github.com/Starry-OS/starry-process.git", rev = "6327455" }

api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ axmm.workspace = true
2828
axnet.workspace = true
2929
axsync.workspace = true
3030
axtask.workspace = true
31+
axpoll.workspace = true
3132

3233
starry-core.workspace = true
3334

api/src/file/epoll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use core::{
1212
};
1313

1414
use axerrno::{AxError, AxResult};
15-
use axio::{IoEvents, PollSet, Pollable};
15+
use axpoll::{IoEvents, PollSet, Pollable};
1616
use bitflags::bitflags;
1717
use hashbrown::HashMap;
1818
use kspin::SpinNoPreempt;
@@ -222,7 +222,7 @@ impl Epoll {
222222
let (event, still_ready) = interest.poll(file.as_ref());
223223
if let Some(event) = event {
224224
*slot = epoll_event {
225-
events: event.events.bits() as u32,
225+
events: event.events.bits(),
226226
data: event.user_data,
227227
};
228228
result += 1;

api/src/file/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use core::{
66
};
77

88
use axerrno::AxError;
9-
use axio::{Buf, BufMut, IoEvents, PollSet, Pollable, Read, Write};
9+
use axio::{Buf, BufMut, Read, Write};
10+
use axpoll::{IoEvents, PollSet, Pollable};
1011
use axtask::future::Poller;
1112

1213
use crate::file::{FileLike, Kstat, SealedBuf, SealedBufMut};

api/src/file/fs.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@ use core::{
1010
use axerrno::{AxError, AxResult};
1111
use axfs_ng::{FS_CONTEXT, FsContext};
1212
use axfs_ng_vfs::{Location, Metadata, NodeFlags};
13-
use axio::{IoEvents, Pollable};
13+
use axpoll::{IoEvents, Pollable};
1414
use axsync::Mutex;
1515
use axtask::future::Poller;
1616
use linux_raw_sys::general::{AT_EMPTY_PATH, AT_FDCWD, AT_SYMLINK_NOFOLLOW};
1717

1818
use super::{FileLike, Kstat, get_file_like};
1919
use crate::file::{SealedBuf, SealedBufMut};
2020

21-
pub fn with_fs<R>(
22-
dirfd: c_int,
23-
f: impl FnOnce(&mut FsContext) -> AxResult<R>,
24-
) -> AxResult<R> {
21+
pub fn with_fs<R>(dirfd: c_int, f: impl FnOnce(&mut FsContext) -> AxResult<R>) -> AxResult<R> {
2522
let mut fs = FS_CONTEXT.lock();
2623
if dirfd == AT_FDCWD {
2724
f(&mut fs)

api/src/file/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use core::{any::Any, ffi::c_int, time::Duration};
1111
use axerrno::{AxError, AxResult};
1212
use axfs_ng::{FS_CONTEXT, OpenOptions};
1313
use axfs_ng_vfs::DeviceId;
14-
use axio::{Buf, BufMut, Pollable, Read, Write};
14+
use axio::{Buf, BufMut, Read, Write};
15+
use axpoll::Pollable;
1516
use axtask::current;
1617
use flatten_objects::FlattenObjects;
1718
use inherit_methods_macro::inherit_methods;

api/src/file/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use alloc::{borrow::Cow, format, sync::Arc};
22
use core::{ffi::c_int, ops::Deref, task::Context};
33

44
use axerrno::{AxError, AxResult};
5-
use axio::{IoEvents, Pollable};
65
use axnet::{
76
SocketOps,
87
options::{Configurable, GetSocketOption, SetSocketOption},
98
};
9+
use axpoll::{IoEvents, Pollable};
1010
use linux_raw_sys::general::S_IFSOCK;
1111

1212
use super::{FileLike, Kstat};

api/src/file/pidfd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use alloc::{
55
use core::task::Context;
66

77
use axerrno::{AxError, AxResult};
8-
use axio::{IoEvents, PollSet, Pollable};
8+
use axpoll::{IoEvents, PollSet, Pollable};
99
use starry_core::task::ProcessData;
1010

1111
use crate::file::{FileLike, Kstat, SealedBuf, SealedBufMut};

api/src/file/pipe.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use core::{
77
};
88

99
use axerrno::{AxError, AxResult};
10-
use axio::{Buf, BufMut, IoEvents, PollSet, Pollable, Read, Write};
10+
use axio::{Buf, BufMut, Read, Write};
11+
use axpoll::{IoEvents, PollSet, Pollable};
1112
use axsync::Mutex;
1213
use axtask::{current, future::Poller};
1314
use linux_raw_sys::{general::S_IFIFO, ioctl::FIONREAD};

0 commit comments

Comments
 (0)