This commit is contained in:
火花 2025-03-18 20:42:09 +08:00 committed by GitHub
parent 17aa298971
commit 95f5e0807e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 15 additions and 2 deletions

View File

@ -37,6 +37,7 @@ impl Syscall {
Ok(check)
}
#[allow(unused)]
pub fn sys_setns(_fd: i32, flags: u64) -> Result<usize, SystemError> {
let check = check_unshare_flags(flags)?;

View File

@ -30,10 +30,12 @@ impl Buffer {
return self.metadata.buf_size - self.read_buffer.lock().len() == 0;
}
#[allow(unused)]
pub fn is_write_buf_empty(&self) -> bool {
return self.write_buffer.lock().is_empty();
}
#[allow(unused)]
pub fn is_write_buf_full(&self) -> bool {
return self.write_buffer.lock().len() >= self.metadata.buf_size;
}
@ -60,6 +62,7 @@ impl Buffer {
Ok(len)
}
#[allow(unused)]
pub fn write_write_buffer(&self, buf: &[u8]) -> Result<usize, SystemError> {
let mut buffer = self.write_buffer.lock_irqsave();

View File

@ -138,6 +138,7 @@ pub struct Connected {
impl Connected {
/// 默认的缓冲区大小
#[allow(unused)]
pub const DEFAULT_BUF_SIZE: usize = 64 * 1024;
pub fn new_pair(
@ -158,10 +159,12 @@ impl Connected {
(this, peer)
}
#[allow(unused)]
pub fn set_peer_inode(&mut self, peer_epoint: Option<Endpoint>) {
self.peer_inode = peer_epoint;
}
#[allow(unused)]
pub fn set_inode(&mut self, epoint: Option<Endpoint>) {
self.inode = epoint;
}

View File

@ -25,6 +25,7 @@ pub struct SeqpacketSocket {
impl SeqpacketSocket {
/// 默认的元数据缓冲区大小
#[allow(unused)]
pub const DEFAULT_METADATA_BUF_SIZE: usize = 1024;
/// 默认的缓冲区大小
pub const DEFAULT_BUF_SIZE: usize = 64 * 1024;
@ -50,6 +51,7 @@ impl SeqpacketSocket {
return Ok(inode);
}
#[allow(unused)]
pub fn new_connected(connected: Connected, is_nonblocking: bool) -> Arc<Self> {
Arc::new_cyclic(|me| Self {
inner: RwLock::new(Inner::Connected(connected)),

View File

@ -90,6 +90,7 @@ impl Connected {
self.addr.as_ref()
}
#[allow(unused)]
pub fn set_addr(&mut self, addr: Option<Endpoint>) {
self.addr = addr;
}
@ -98,6 +99,7 @@ impl Connected {
self.peer_addr.as_ref()
}
#[allow(unused)]
pub fn set_peer_addr(&mut self, peer: Option<Endpoint>) {
self.peer_addr = peer;
}
@ -164,7 +166,7 @@ impl Connected {
return Err(SystemError::EINVAL);
}
}
#[allow(unused)]
pub fn shutdown(&self, how: ShutdownTemp) -> Result<(), SystemError> {
if how.is_empty() {
return Err(SystemError::EINVAL);
@ -212,6 +214,7 @@ impl Listener {
return Ok(());
}
#[allow(unused)]
pub fn pop_incoming(&self) -> Option<Arc<Inode>> {
let mut incoming_connects = self.incoming_connects.lock();

View File

@ -31,6 +31,7 @@ pub struct StreamSocket {
impl StreamSocket {
/// 默认的元数据缓冲区大小
#[allow(unused)]
pub const DEFAULT_METADATA_BUF_SIZE: usize = 1024;
/// 默认的缓冲区大小
pub const DEFAULT_BUF_SIZE: usize = 64 * 1024;
@ -60,7 +61,7 @@ impl StreamSocket {
return Ok((inode0, inode1));
}
#[allow(unused)]
pub fn new_connected(connected: Connected) -> Arc<Self> {
Arc::new_cyclic(|me| Self {
inner: RwLock::new(Inner::Connected(connected)),