Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to nightly-2024-02-15 #1071

Merged
merged 9 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-01-15"
channel = "nightly-2024-02-15"
components = [
"llvm-tools",
"rust-src",
Expand Down
36 changes: 0 additions & 36 deletions src/arch/riscv64/mm/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ struct PageTable<L> {
/// This additional trait is necessary to make use of Rust's specialization feature and provide a default
/// implementation of some methods.
trait PageTableMethods {
fn get_page_table_entry<S: PageSize>(&self, page: Page<S>) -> Option<PageTableEntry>;
fn map_page_in_this_table<S: PageSize>(
&mut self,
page: Page<S>,
Expand Down Expand Up @@ -390,21 +389,6 @@ impl<L: PageTableLevel> PageTableMethods for PageTable<L> {
}
}

/// Returns the PageTableEntry for the given page if it is present, otherwise returns None.
///
/// This is the default implementation called only for L0Table.
/// It is overridden by a specialized implementation for all tables with sub tables (all except L0Table).
default fn get_page_table_entry<S: PageSize>(&self, page: Page<S>) -> Option<PageTableEntry> {
assert_eq!(L::LEVEL, S::MAP_LEVEL);
let index = page.table_index::<L>();

if self.entries[index].is_present() {
Some(self.entries[index])
} else {
None
}
}

/// Maps a single page to the given physical address.
///
/// This is the default implementation that just calls the map_page_in_this_table method.
Expand All @@ -423,26 +407,6 @@ impl<L: PageTableLevelWithSubtables> PageTableMethods for PageTable<L>
where
L::SubtableLevel: PageTableLevel,
{
/// Returns the PageTableEntry for the given page if it is present, otherwise returns None.
///
/// This is the implementation for all tables with subtables (L1, L2).
/// It overrides the default implementation above.
fn get_page_table_entry<S: PageSize>(&self, page: Page<S>) -> Option<PageTableEntry> {
assert!(L::LEVEL >= S::MAP_LEVEL);
let index = page.table_index::<L>();

if self.entries[index].is_present() {
if L::LEVEL > S::MAP_LEVEL {
let subtable = self.subtable::<S>(page);
subtable.get_page_table_entry::<S>(page)
} else {
Some(self.entries[index])
}
} else {
None
}
}

/// Maps a single page to the given physical address.
///
/// This is the implementation for all tables with subtables (L1, L2).
Expand Down
8 changes: 8 additions & 0 deletions src/arch/x86_64/mm/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ pub trait PageTableEntryFlagsExt {

fn normal(&mut self) -> &mut Self;

#[cfg(feature = "acpi")]
fn read_only(&mut self) -> &mut Self;

fn writable(&mut self) -> &mut Self;

fn execute_disable(&mut self) -> &mut Self;

#[cfg(feature = "common-os")]
fn execute_enable(&mut self) -> &mut Self;

#[cfg(feature = "common-os")]
fn user(&mut self) -> &mut Self;

#[cfg(feature = "common-os")]
fn kernel(&mut self) -> &mut Self;
}

Expand All @@ -44,6 +48,7 @@ impl PageTableEntryFlagsExt for PageTableEntryFlags {
self
}

#[cfg(feature = "acpi")]
fn read_only(&mut self) -> &mut Self {
self.remove(PageTableEntryFlags::WRITABLE);
self
Expand All @@ -59,16 +64,19 @@ impl PageTableEntryFlagsExt for PageTableEntryFlags {
self
}

#[cfg(feature = "common-os")]
fn execute_enable(&mut self) -> &mut Self {
self.remove(PageTableEntryFlags::NO_EXECUTE);
self
}

#[cfg(feature = "common-os")]
fn user(&mut self) -> &mut Self {
self.insert(PageTableEntryFlags::USER_ACCESSIBLE);
self
}

#[cfg(feature = "common-os")]
fn kernel(&mut self) -> &mut Self {
self.remove(PageTableEntryFlags::USER_ACCESSIBLE);
self
Expand Down
1 change: 1 addition & 0 deletions src/drivers/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub(crate) trait NetworkDriver {
where
F: FnOnce(&mut [u8]) -> R;
/// Check if a packet is available
#[allow(dead_code)]
fn has_packet(&self) -> bool;
/// Enable / disable the polling mode of the network interface
fn set_polling_mode(&mut self, value: bool);
Expand Down
1 change: 1 addition & 0 deletions src/drivers/net/virtio_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ impl NetworkDriver for VirtioNetDriver {
self.checksums.clone()
}

#[allow(dead_code)]
fn has_packet(&self) -> bool {
self.recv_vqs.poll();
!self.recv_vqs.poll_queue.borrow().is_empty()
Expand Down
7 changes: 2 additions & 5 deletions src/drivers/virtio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ pub mod features {

impl PartialEq<Features> for u64 {
fn eq(&self, other: &Features) -> bool {
self == other
*self == u64::from(*other)
}
}

impl PartialEq<u64> for Features {
fn eq(&self, other: &u64) -> bool {
self == other
u64::from(*self) == *other
}
}

Expand Down Expand Up @@ -206,7 +206,4 @@ pub mod device {
}
}
}

/// Empty trait to unify all device specific configuration structs.
pub trait DevCfg {}
}
2 changes: 1 addition & 1 deletion src/drivers/virtio/virtqueue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ impl BitAnd<DescrFlags> for u16 {

impl PartialEq<DescrFlags> for u16 {
fn eq(&self, other: &DescrFlags) -> bool {
self == other
*self == u16::from(*other)
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ impl Wake for TaskNotify {
}

pub(crate) fn run() {
let waker = Waker::noop();
let mut cx = Context::from_waker(&waker);
let mut cx = Context::from_waker(Waker::noop());

without_interrupts(|| {
async_tasks().retain_mut(|task| {
Expand Down Expand Up @@ -126,8 +125,7 @@ where
};

let start = now();
let waker = core::task::Waker::noop();
let mut cx = Context::from_waker(&waker);
let mut cx = Context::from_waker(Waker::noop());
let mut future = pin!(future);

loop {
Expand Down
4 changes: 4 additions & 0 deletions src/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ pub(crate) trait ObjectInterface: Sync + Send + core::fmt::Debug + DynClone {
}

/// `unlink` removes file entry
#[allow(dead_code)]
fn unlink(&self, _path: &str) -> Result<(), IoError> {
Err(IoError::EINVAL)
}

/// `rmdir` removes directory entry
#[allow(dead_code)]
fn rmdir(&self, _path: &str) -> Result<(), IoError> {
Err(IoError::EINVAL)
}
Expand All @@ -196,6 +198,7 @@ pub(crate) trait ObjectInterface: Sync + Send + core::fmt::Debug + DynClone {
}

/// `mkdir` creates a directory entry
#[allow(dead_code)]
fn mkdir(&self, _path: &str, _mode: u32) -> Result<(), IoError> {
Err(IoError::EINVAL)
}
Expand Down Expand Up @@ -244,6 +247,7 @@ pub(crate) trait ObjectInterface: Sync + Send + core::fmt::Debug + DynClone {

/// `getpeername` get address of connected peer
#[cfg(all(any(feature = "tcp", feature = "udp"), not(feature = "newlib")))]
#[allow(dead_code)]
fn getpeername(&self) -> Option<IpEndpoint> {
None
}
Expand Down
7 changes: 1 addition & 6 deletions src/fd/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ fn get_ephemeral_port() -> u16 {
LOCAL_ENDPOINT.fetch_add(1, Ordering::SeqCst)
}

#[derive(Debug)]
pub struct IPv4;

#[derive(Debug)]
pub struct IPv6;

#[derive(Debug)]
pub struct Socket {
handle: Handle,
Expand Down Expand Up @@ -341,6 +335,7 @@ impl ObjectInterface for Socket {
}
}

#[allow(dead_code)]
fn getpeername(&self) -> Option<IpEndpoint> {
self.with(|socket| socket.remote_endpoint())
}
Expand Down
2 changes: 2 additions & 0 deletions src/fs/fuse_abi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

#[cfg(all(feature = "fuse", feature = "pci"))]
pub(crate) const ROOT_ID: u64 = 1;

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
allow(incomplete_features)
)]
#![cfg_attr(target_arch = "x86_64", feature(abi_x86_interrupt))]
#![cfg_attr(target_arch = "riscv64", feature(offset_of))]
#![feature(allocator_api)]
#![feature(asm_const)]
#![feature(exposed_provenance)]
Expand Down
8 changes: 4 additions & 4 deletions src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub extern "C" fn sys_fstat(fd: FileDescriptor, stat: *mut FileAttr) -> i32 {

extern "C" fn __sys_opendir(name: *const u8) -> FileDescriptor {
if let Ok(name) = unsafe { CStr::from_ptr(name as _) }.to_str() {
crate::fs::opendir(name).map_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap(), |v| v)
crate::fs::opendir(name).unwrap_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap())
} else {
-crate::errno::EINVAL
}
Expand All @@ -234,7 +234,7 @@ extern "C" fn __sys_open(name: *const u8, flags: i32, mode: u32) -> FileDescript

if let Ok(name) = unsafe { CStr::from_ptr(name as _) }.to_str() {
crate::fd::open(name, flags, mode)
.map_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap(), |v| v)
.unwrap_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap())
} else {
-crate::errno::EINVAL
}
Expand Down Expand Up @@ -426,7 +426,7 @@ pub extern "C" fn sys_getdents64(fd: FileDescriptor, dirp: *mut Dirent64, count:
}

extern "C" fn __sys_dup(fd: i32) -> i32 {
dup_object(fd).map_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap(), |v| v)
dup_object(fd).unwrap_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap())
}

#[no_mangle]
Expand Down Expand Up @@ -464,7 +464,7 @@ pub extern "C" fn sys_poll(fds: *mut PollFd, nfds: usize, timeout: i32) -> i32 {
extern "C" fn __sys_eventfd(initval: u64, flags: i16) -> i32 {
if let Some(flags) = EventFlags::from_bits(flags) {
crate::fd::eventfd(initval, flags)
.map_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap(), |v| v)
.unwrap_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap())
} else {
-crate::errno::EINVAL
}
Expand Down