From 080f2003cd065bcc9a290230ede06da0a1ea0502 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Sat, 5 Apr 2025 16:39:46 +0200 Subject: [PATCH] Rustfmt, add CallFlags::CONSUME. --- src/arch/riscv64.rs | 6 ++---- src/data.rs | 5 ++++- src/flag.rs | 21 ++++++++++++--------- src/schemev2.rs | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/arch/riscv64.rs b/src/arch/riscv64.rs index 4f6a0832d2..845d0e86cb 100644 --- a/src/arch/riscv64.rs +++ b/src/arch/riscv64.rs @@ -1,15 +1,13 @@ +use super::error::{Error, Result}; +use core::arch::asm; use core::{ mem, ops::{Deref, DerefMut}, slice, }; -use core::arch::asm; -use super::error::{Error, Result}; - pub const PAGE_SIZE: usize = 4096; - #[cfg(feature = "userspace")] macro_rules! syscall { ($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => { diff --git a/src/data.rs b/src/data.rs index 3fb9a51517..c6967f9ce1 100644 --- a/src/data.rs +++ b/src/data.rs @@ -383,7 +383,10 @@ impl Deref for RtSigInfo { impl DerefMut for RtSigInfo { fn deref_mut(&mut self) -> &mut [u8] { unsafe { - slice::from_raw_parts_mut(self as *mut RtSigInfo as *mut u8, mem::size_of::()) + slice::from_raw_parts_mut( + self as *mut RtSigInfo as *mut u8, + mem::size_of::(), + ) } } } diff --git a/src/flag.rs b/src/flag.rs index 8d468b1b42..489997ae8e 100644 --- a/src/flag.rs +++ b/src/flag.rs @@ -335,14 +335,17 @@ bitflags! { } bitflags! { pub struct CallFlags: usize { - // unused - const BIT0 = 1 << 0; - const BIT1 = 1 << 1; - const BIT2 = 1 << 2; - const BIT3 = 1 << 3; - const BIT4 = 1 << 4; - const BIT5 = 1 << 5; - const BIT6 = 1 << 6; - const BIT7 = 1 << 7; + // reserved + const RSVD0 = 1 << 0; + const RSVD1 = 1 << 1; + const RSVD2 = 1 << 2; + const RSVD3 = 1 << 3; + const RSVD4 = 1 << 4; + const RSVD5 = 1 << 5; + const RSVD6 = 1 << 6; + const RSVD7 = 1 << 7; + + /// Remove the fd from the caller's file table before sending the message. + const CONSUME = 1 << 8; } } diff --git a/src/schemev2.rs b/src/schemev2.rs index 328c971d9c..e225bb7fc1 100644 --- a/src/schemev2.rs +++ b/src/schemev2.rs @@ -130,7 +130,7 @@ pub enum Opcode { CloseMsg = 27, Call = 28, - OpenAt = 29, // fd, buf_ptr, buf_len, flags + OpenAt = 29, // fd, buf_ptr, buf_len, flags } impl Opcode {