From f601b2a8ce1d01f84c87c52cb9e23b41f0711525 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 7 Nov 2022 18:12:03 -0700 Subject: [PATCH] 0.5.3 - make log optional --- Cargo.toml | 4 ++-- src/transaction.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 50c9f5beee..95c473d2ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "redoxfs" description = "The Redox Filesystem" repository = "https://gitlab.redox-os.org/redox-os/redoxfs" -version = "0.5.2" +version = "0.5.3" license-file = "LICENSE" readme = "README.md" authors = ["Jeremy Soller "] @@ -37,7 +37,7 @@ base64ct = { version = "1", default-features = false } env_logger = { version = "0.9.0", optional = true } getrandom = { version = "0.2.5", optional = true } libc = "0.2" -log = { version = "0.4.14", default-features = false } +log = { version = "0.4.14", default-features = false, optional = true} redox_syscall = "0.2.12" seahash = { version = "4.1.0", default-features = false } termion = { version = "1.5.6", optional = true } diff --git a/src/transaction.rs b/src/transaction.rs index 994c6f780c..fe07ccfd37 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -201,6 +201,7 @@ impl<'a, D: Disk> Transaction<'a, D> { let count = unsafe { self.fs.disk.write_at(self.fs.block + addr, &raw)? }; if count != mem::size_of::() { // Read wrong number of bytes + #[cfg(feature = "log")] log::error!("SYNC WRITE_CACHE: WRONG NUMBER OF BYTES"); return Err(Error::new(EIO)); } @@ -223,6 +224,7 @@ impl<'a, D: Disk> Transaction<'a, D> { }; if count != mem::size_of_val(&self.header) { // Read wrong number of bytes + #[cfg(feature = "log")] log::error!("SYNC: WRONG NUMBER OF BYTES"); return Err(Error::new(EIO)); } @@ -237,6 +239,7 @@ impl<'a, D: Disk> Transaction<'a, D> { ) -> Result> { if ptr.is_null() { // Pointer is invalid (should this return None?) + #[cfg(feature = "log")] log::error!("READ_BLOCK: POINTER IS NULL"); return Err(Error::new(ENOENT)); } @@ -252,6 +255,7 @@ impl<'a, D: Disk> Transaction<'a, D> { }; if count != mem::size_of::() { // Read wrong number of bytes + #[cfg(feature = "log")] log::error!("READ_BLOCK: WRONG NUMBER OF BYTES"); return Err(Error::new(EIO)); } @@ -262,6 +266,7 @@ impl<'a, D: Disk> Transaction<'a, D> { let block_ptr = block.create_ptr(); if block_ptr.hash() != ptr.hash() { // Incorrect hash + #[cfg(feature = "log")] log::error!( "READ_BLOCK: INCORRECT HASH {} != {} for block {}", block_ptr.hash(), @@ -316,6 +321,7 @@ impl<'a, D: Disk> Transaction<'a, D> { ) -> Result> { if block.addr() == 0 { // Pointer is invalid + #[cfg(feature = "log")] log::error!("WRITE_BLOCK: POINTER IS NULL"); return Err(Error::new(ENOENT)); } @@ -334,6 +340,7 @@ impl<'a, D: Disk> Transaction<'a, D> { ) -> Result> { if ptr.is_null() { // ID is invalid (should this return None?) + #[cfg(feature = "log")] log::error!("READ_TREE: ID IS NULL"); return Err(Error::new(ENOENT)); } @@ -406,6 +413,7 @@ impl<'a, D: Disk> Transaction<'a, D> { let ptr = node.ptr(); if ptr.is_null() { // ID is invalid + #[cfg(feature = "log")] log::error!("SYNC_TREE: ID IS NULL"); return Err(Error::new(ENOENT)); }