From bb56af20ed036bed8d9d2f8bf68376ce4d55e79a Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Wed, 24 Aug 2022 19:33:08 -0700 Subject: Rename to serial print --- src/util/fifo_queue.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/util/fifo_queue.rs') diff --git a/src/util/fifo_queue.rs b/src/util/fifo_queue.rs index 42d63ac..6748ab4 100644 --- a/src/util/fifo_queue.rs +++ b/src/util/fifo_queue.rs @@ -3,7 +3,7 @@ //! Provides the FIFO queue structure for allocations use crate::sync::interface::Mutex; use crate::sync::NullLock; -use crate::vprintln; +use crate::serial_vprintln; use core::fmt; use core::fmt::{Debug, Formatter}; @@ -102,9 +102,9 @@ impl<'a, T: Sized, const COUNT: usize> QueueAllocator<'a, T, COUNT> { /// All of the internal elements point to the next /// one and the final element points to `None` pub fn init(&self) { - vprintln!("QA: Initializing Queue Allocator!"); + serial_vprintln!("QA: Initializing Queue Allocator!"); self.inner.lock(|queue| { - vprintln!("QA: Clearing internal references..."); + serial_vprintln!("QA: Clearing internal references..."); for idx in 2..COUNT { if idx != COUNT - 1 { queue[idx].next = Some(&mut queue[idx + 1] as *mut QueueItem<'a, T>); @@ -112,11 +112,11 @@ impl<'a, T: Sized, const COUNT: usize> QueueAllocator<'a, T, COUNT> { queue[idx].next = None; } } - vprintln!("QA: Initializing head and tail..."); + serial_vprintln!("QA: Initializing head and tail..."); queue[0].next = Some(&mut queue[2] as *mut QueueItem<'a, T>); queue[1].next = Some(&mut queue[COUNT - 1] as *mut QueueItem<'a, T>); }); - vprintln!("QA: Initialized Queue Allocator!"); + serial_vprintln!("QA: Initialized Queue Allocator!"); } /// # Allocate Data @@ -125,10 +125,10 @@ impl<'a, T: Sized, const COUNT: usize> QueueAllocator<'a, T, COUNT> { /// return it, otherwise return `None` #[allow(dead_code)] pub fn alloc(&self) -> Option<&mut QueueItem<'a, T>> { - vprintln!("QA: Allocating chunk!"); + serial_vprintln!("QA: Allocating chunk!"); return self.inner.lock(|pool| { if let Some(entry) = pool[0].next { - vprintln!("QA: Found chunk!"); + serial_vprintln!("QA: Found chunk!"); pool[0].next = unsafe { (*entry).next }; unsafe { (*entry).next = None; @@ -137,12 +137,12 @@ impl<'a, T: Sized, const COUNT: usize> QueueAllocator<'a, T, COUNT> { None => pool[1].next = None, _ => {} } - vprintln!("QA: \x1b[92mAllocated {:x}\x1b[0m", unsafe { + serial_vprintln!("QA: \x1b[92mAllocated {:x}\x1b[0m", unsafe { (*entry).ptr() as usize }); return Some(unsafe { &mut *entry as &mut QueueItem<'a, T> }); } else { - vprintln!("QA: No chunks available!"); + serial_vprintln!("QA: No chunks available!"); return None; } }); @@ -154,7 +154,7 @@ impl<'a, T: Sized, const COUNT: usize> QueueAllocator<'a, T, COUNT> { /// If there were no items, set it as the head. #[allow(dead_code)] pub fn free(&self, freed_item: &mut QueueItem<'a, T>) { - vprintln!("QA: Deallocating chunk!"); + serial_vprintln!("QA: Deallocating chunk!"); self.inner.lock(|pool| { freed_item.next = None; match pool[1].next { @@ -166,7 +166,7 @@ impl<'a, T: Sized, const COUNT: usize> QueueAllocator<'a, T, COUNT> { }, } pool[1].next = Some(freed_item as *mut QueueItem<'a, T>); - vprintln!( + serial_vprintln!( "QA: \x1b[91mDeallocated {:x}\x1b[0m", freed_item.ptr() as usize ); -- cgit v1.2.1