From 9e28791c2bccb14abeb56bac3d9f82fecf7a5ce0 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 7 Feb 2026 12:19:41 +0100 Subject: [PATCH] Fix a couple of warnings --- bootstrap/src/exec.rs | 1 - bootstrap/src/initfs.rs | 4 ++-- bootstrap/src/initnsmgr.rs | 8 +++----- bootstrap/src/procmgr.rs | 16 ++++++---------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/bootstrap/src/exec.rs b/bootstrap/src/exec.rs index 5c0ed91700..9cb2e15fcb 100644 --- a/bootstrap/src/exec.rs +++ b/bootstrap/src/exec.rs @@ -1,4 +1,3 @@ -use alloc::borrow::ToOwned; use alloc::sync::Arc; use alloc::vec::Vec; use core::ffi::CStr; diff --git a/bootstrap/src/initfs.rs b/bootstrap/src/initfs.rs index 54b042169a..516aa39e3c 100644 --- a/bootstrap/src/initfs.rs +++ b/bootstrap/src/initfs.rs @@ -118,7 +118,7 @@ impl SchemeSync for InitFsScheme { path: &str, flags: usize, _fcntl_flags: u32, - ctx: &CallerCtx, + _ctx: &CallerCtx, ) -> Result { if !matches!( self.handles.get(&dirfd).ok_or(Error::new(EBADF))?, @@ -363,7 +363,7 @@ impl SchemeSync for InitFsScheme { let data = match Self::get_inode(&self.fs, node.inode)?.kind() { InodeKind::File(file) => file.data().map_err(|_| Error::new(EIO))?, InodeKind::Dir(_) => return Err(Error::new(EISDIR)), - InodeKind::Link(link) => return Err(Error::new(ELOOP)), + InodeKind::Link(_) => return Err(Error::new(ELOOP)), InodeKind::Unknown => return Err(Error::new(EIO)), }; diff --git a/bootstrap/src/initnsmgr.rs b/bootstrap/src/initnsmgr.rs index 690a57f8d4..335ce111b2 100644 --- a/bootstrap/src/initnsmgr.rs +++ b/bootstrap/src/initnsmgr.rs @@ -108,15 +108,13 @@ impl<'sock> NamespaceScheme<'sock> { schemes: HashMap, scheme_creation_cap: usize, ) -> Self { - let mut scheme = Self { + Self { socket, handles: HashMap::new(), root_namespace: Namespace { schemes }, next_id: 0, scheme_creation_cap, - }; - - scheme + } } fn add_namespace(&mut self, id: usize, schemes: Namespace, permission: NsPermissions) { @@ -431,7 +429,7 @@ impl<'sock> SchemeSync for NamespaceScheme<'sock> { Ok(buf) } - fn fstat(&mut self, id: usize, stat: &mut Stat, ctx: &CallerCtx) -> Result<()> { + fn fstat(&mut self, id: usize, stat: &mut Stat, _ctx: &CallerCtx) -> Result<()> { let resource_stat = match self.handles.get(&id).ok_or(Error::new(EBADF))? { Handle::List(_) => Stat { st_mode: 0o444 | syscall::MODE_DIR, diff --git a/bootstrap/src/procmgr.rs b/bootstrap/src/procmgr.rs index eb2051b733..73beba4a53 100644 --- a/bootstrap/src/procmgr.rs +++ b/bootstrap/src/procmgr.rs @@ -188,7 +188,7 @@ pub fn run( log::trace!("--THREAD DIED {}, {}", event.data, thread.pid.0); if let Err(err) = scheme.queue.unsubscribe(event.data, event.data) { - log::error!("failed to unsubscribe from fd {}", event.data); + log::error!("failed to unsubscribe from fd {}: {err}", event.data); } scheme.thread_lookup.remove(&event.data); proc.threads.retain(|rc| !Rc::ptr_eq(rc, &thread_rc)); @@ -960,9 +960,6 @@ impl<'a> ProcScheme<'a> { log::trace!("Invalid proc call: {metadata:?}"); return Response::ready_err(EINVAL, op); }; - fn cvt_u32(u: u32) -> Option { - if u == u32::MAX { None } else { Some(u) } - } match verb { ProcCall::Exit => self.on_exit_start( fd_pid, @@ -1083,7 +1080,6 @@ impl<'a> ProcScheme<'a> { // setrens is no longer implemented as procmgr call // FIXME remove this ProcCall variant ProcCall::Setrens => Response::ready_err(EINVAL, op), - } } Handle::Ps(_) => Response::ready_err(EOPNOTSUPP, op), @@ -1406,7 +1402,7 @@ impl<'a> ProcScheme<'a> { let recv_nonblock = |waitpid: &mut BTreeMap, key: &WaitpidKey| -> Option<(ProcessId, WaitpidStatus)> { - if let Some((pid, mut sts)) = waitpid.get(key).map(|(k, v)| (*k, *v)) { + if let Some((pid, sts)) = waitpid.get(key).map(|(k, v)| (*k, *v)) { waitpid.remove(key); /*while let Some((_, new_sts)) = waitpid.remove(&WaitpidKey { pid: Some(pid), pgid: None }) { sts = new_sts; @@ -1641,7 +1637,7 @@ impl<'a> ProcScheme<'a> { awoken: &mut VecDeque, ) -> Poll { let req_id = *state_entry.key(); - let mut state = state_entry.get_mut(); + let state = state_entry.get_mut(); let this_state = core::mem::replace(state, PendingState::Placeholder); match this_state { PendingState::Placeholder => return Pending, // unreachable!(), @@ -1847,8 +1843,8 @@ impl<'a> ProcScheme<'a> { } } fn debug(&self) { - log::trace!("PROCESSES\n{:#?}", self.processes,); - log::trace!("HANDLES\n{:#?}", self.handles,); + log::trace!("PROCESSES\n{:#?}", self.processes); + log::trace!("HANDLES\n{:#?}", self.handles); } fn on_kill_thread( &mut self, @@ -2542,7 +2538,7 @@ impl<'a> ProcScheme<'a> { // Useful for debugging memory leaks. log::trace!("NEXT FD: {}", { let nextfd = syscall::dup(0, &[]).unwrap(); - syscall::close(nextfd); + let _ = syscall::close(nextfd); nextfd }); log::trace!("{} processes", self.processes.len());