clean debug messages

This commit is contained in:
Samuka007 2024-10-14 12:20:46 +00:00
parent 8fe49e190e
commit bca536ec9b
8 changed files with 18 additions and 19 deletions

View File

@ -257,7 +257,7 @@ impl Device for VirtIONetDevice {
impl VirtIODevice for VirtIONetDevice {
fn handle_irq(&self, _irq: IrqNumber) -> Result<IrqReturn, SystemError> {
log::warn!("VirtioInterface: poll_ifaces_try_lock_onetime -> poll_ifaces");
// log::warn!("VirtioInterface: poll_ifaces_try_lock_onetime -> poll_ifaces");
poll_ifaces();
return Ok(IrqReturn::Handled);
}

View File

@ -1,7 +1,6 @@
use alloc::vec::Vec;
use alloc::{string::String, sync::Arc};
use log::debug;
use system_error::SystemError;
use crate::libs::spinlock::SpinLock;
@ -43,14 +42,14 @@ impl Buffer {
let len = core::cmp::min(buf.len(), read_buffer.len());
buf[..len].copy_from_slice(&read_buffer[..len]);
let _ = read_buffer.split_off(len);
log::debug!("recv buf {}", String::from_utf8_lossy(buf));
// log::debug!("recv buf {}", String::from_utf8_lossy(buf));
return Ok(len);
}
pub fn write_read_buffer(&self, buf: &[u8]) -> Result<usize, SystemError> {
let mut buffer = self.read_buffer.lock_irqsave();
log::debug!("send buf {}", String::from_utf8_lossy(buf));
// log::debug!("send buf {}", String::from_utf8_lossy(buf));
let len = buf.len();
if self.metadata.buf_size - buffer.len() < len {
return Err(SystemError::ENOBUFS);

View File

@ -45,7 +45,7 @@ impl BoundInner {
// iface
// }
// 强绑VirtualIO
log::debug!("Not bind to any iface, bind to virtIO");
// log::debug!("Not bind to any iface, bind to virtIO");
let iface = NET_DEVICES
.read_irqsave()
.get(&0)

View File

@ -126,7 +126,7 @@ impl Init {
} else {
smoltcp::wire::IpListenEndpoint::from(local)
};
log::debug!("listen at {:?}", listen_addr);
// log::debug!("listen at {:?}", listen_addr);
let mut inners = Vec::new();
if let Err(err) = || -> Result<(), SystemError> {
for _ in 0..(backlog - 1) {

View File

@ -11,7 +11,7 @@ fn create_inet_socket(
socket_type: Type,
protocol: smoltcp::wire::IpProtocol,
) -> Result<Arc<dyn Socket>, SystemError> {
log::debug!("type: {:?}, protocol: {:?}", socket_type, protocol);
// log::debug!("type: {:?}, protocol: {:?}", socket_type, protocol);
use smoltcp::wire::IpProtocol::*;
use Type::*;
match socket_type {

View File

@ -27,7 +27,7 @@ impl family::Family for Unix {
impl Unix {
pub fn new_pairs(socket_type: Type) -> Result<(Arc<Inode>, Arc<Inode>), SystemError> {
log::debug!("socket_type {:?}", socket_type);
// log::debug!("socket_type {:?}", socket_type);
match socket_type {
Type::SeqPacket => seqpacket::SeqpacketSocket::new_pairs(),
Type::Stream | Type::Datagram => stream::StreamSocket::new_pairs(),

View File

@ -256,7 +256,7 @@ impl Socket for SeqpacketSocket {
}
fn close(&self) -> Result<(), SystemError> {
log::debug!("seqpacket close");
// log::debug!("seqpacket close");
self.shutdown.recv_shutdown();
self.shutdown.send_shutdown();
Ok(())
@ -398,7 +398,7 @@ impl Socket for SeqpacketSocket {
flags: MessageFlag,
_address: Option<Endpoint>,
) -> Result<(usize, Endpoint), SystemError> {
log::debug!("recvfrom flags {:?}", flags);
// log::debug!("recvfrom flags {:?}", flags);
if flags.contains(MessageFlag::OOB) {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
@ -413,7 +413,7 @@ impl Socket for SeqpacketSocket {
match &*self.inner.write() {
Inner::Connected(connected) => match connected.recv_slice(buffer) {
Ok(usize) => {
log::debug!("recvs from successfully");
// log::debug!("recvs from successfully");
return Ok((usize, connected.peer_endpoint().unwrap().clone()));
}
Err(_) => continue,

View File

@ -41,18 +41,18 @@ impl Syscall {
protocol: usize,
) -> Result<usize, SystemError> {
// 打印收到的参数
log::debug!(
"socket: address_family={:?}, socket_type={:?}, protocol={:?}",
address_family,
socket_type,
protocol
);
// log::debug!(
// "socket: address_family={:?}, socket_type={:?}, protocol={:?}",
// address_family,
// socket_type,
// protocol
// );
let address_family = socket::AddressFamily::try_from(address_family as u16)?;
let type_arg = SysArgSocketType::from_bits_truncate(socket_type as u32);
let is_nonblock = type_arg.is_nonblock();
let is_close_on_exec = type_arg.is_cloexec();
let stype = socket::Type::try_from(type_arg)?;
log::debug!("type_arg {:?} stype {:?}", type_arg, stype);
// log::debug!("type_arg {:?} stype {:?}", type_arg, stype);
let inode = socket::create_socket(
address_family,
@ -256,7 +256,7 @@ impl Syscall {
let socket: Arc<socket::Inode> = ProcessManager::current_pcb()
.get_socket(fd as i32)
.ok_or(SystemError::EBADF)?;
log::debug!("bind: socket={:?}", socket);
// log::debug!("bind: socket={:?}", socket);
socket.bind(endpoint)?;
Ok(0)
}