Эх сурвалжийг харах

Don't implement Debug for volatile memory.

It doesn't make much sense, and could result in memory being read
incorrectly.
Andrew Walbran 2 жил өмнө
parent
commit
b3d1040add
2 өөрчлөгдсөн 3 нэмэгдсэн , 13 устгасан
  1. 0 10
      src/gpu.rs
  2. 3 3
      src/volatile.rs

+ 0 - 10
src/gpu.rs

@@ -3,7 +3,6 @@ use crate::queue::VirtQueue;
 use crate::transport::Transport;
 use crate::volatile::{volread, ReadOnly, Volatile, WriteOnly};
 use bitflags::*;
-use core::fmt;
 use log::*;
 
 /// A virtio based graphics adapter.
@@ -300,15 +299,6 @@ struct Config {
     num_scanouts: Volatile<u32>,
 }
 
-impl fmt::Debug for Config {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_struct("Config")
-            .field("events_read", &self.events_read)
-            .field("num_scanouts", &self.num_scanouts)
-            .finish()
-    }
-}
-
 /// Display configuration has changed.
 const EVENT_DISPLAY: u32 = 1 << 0;
 

+ 3 - 3
src/volatile.rs

@@ -1,5 +1,5 @@
 /// An MMIO register which can only be read from.
-#[derive(Debug, Default)]
+#[derive(Default)]
 #[repr(transparent)]
 pub struct ReadOnly<T: Copy>(T);
 
@@ -11,12 +11,12 @@ impl<T: Copy> ReadOnly<T> {
 }
 
 /// An MMIO register which can only be written to.
-#[derive(Debug, Default)]
+#[derive(Default)]
 #[repr(transparent)]
 pub struct WriteOnly<T: Copy>(T);
 
 /// An MMIO register which may be both read and written.
-#[derive(Debug, Default)]
+#[derive(Default)]
 #[repr(transparent)]
 pub struct Volatile<T: Copy>(T);