0.5.3 - make log optional

This commit is contained in:
Jeremy Soller
2022-11-07 18:12:03 -07:00
parent 63bde95462
commit f601b2a8ce
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -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 <jackpot51@gmail.com>"]
@@ -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 }
+8
View File
@@ -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::<BlockRaw>() {
// 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<BlockData<T>> {
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::<T>() {
// 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<BlockPtr<T>> {
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<TreeData<T>> {
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));
}