From 4747327b8e036e56b59f1b70904d41d5d9e9b8a8 Mon Sep 17 00:00:00 2001 From: "Brian J. Tarricone" Date: Wed, 23 Oct 2024 03:16:40 -0700 Subject: [PATCH] Remove unneeded debugging statements --- src/fs.rs | 14 ++------------ src/main.rs | 1 - 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/fs.rs b/src/fs.rs index e661c68..5ba806c 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -46,7 +46,7 @@ struct File { impl File { fn as_file_attr(&self) -> FileAttr { let nlink = if self.ino == ROOT_INODE { 2 } else { 1 }; - let attr = FileAttr { + FileAttr { ino: self.ino, size: self.data.len().try_into().unwrap(), blocks: block_count(self.data.len()), @@ -62,9 +62,7 @@ impl File { rdev: 0, blksize: BLOCK_SIZE, flags: 0, - }; - debug!("attr: {:?}", attr); - attr + } } } @@ -198,7 +196,6 @@ impl Filesystem for CorruptFs { } fn getattr(&mut self, _req: &fuser::Request<'_>, ino: u64, reply: fuser::ReplyAttr) { - debug!("getattr"); if let Some(file) = self.files.get(&ino) { reply.attr(&TTL, &file.as_file_attr()); } else { @@ -210,7 +207,6 @@ impl Filesystem for CorruptFs { if req.uid() != getuid().as_raw() { reply.error(EPERM); } else if self.files.contains_key(&ino) { - debug!("returning OK to access request"); reply.ok(); } else { reply.error(ENOENT); @@ -288,7 +284,6 @@ impl Filesystem for CorruptFs { } else if (flags & O_DIRECT) != 0 && !self.allow_direct_io { reply.error(EINVAL); } else { - debug!("create with mode {:o}", mode); let now = SystemTime::now(); let file = File { ino: self.next_inode(), @@ -451,17 +446,14 @@ impl Filesystem for CorruptFs { fn opendir(&mut self, req: &fuser::Request<'_>, ino: u64, flags: i32, reply: fuser::ReplyOpen) { if req.uid() != getuid().as_raw() { - debug!("opendir: bad user"); reply.error(EPERM); } else if ino != ROOT_INODE { - debug!("opendir: bad ino"); if self.files.contains_key(&ino) { reply.error(ENOTDIR); } else { reply.error(ENOENT); } } else { - debug!("opendir: ok"); let fh = self.next_fh(); let open_file = OpenFile { ino: ROOT_INODE, @@ -483,7 +475,6 @@ impl Filesystem for CorruptFs { if self.is_open_dir(fh) { for (i, (name, inode)) in self.inode_map.iter().skip(offset as usize).enumerate() { let file = self.files.get(inode).unwrap(); - debug!("readdir: adding file {:?}", name); if reply.add(*inode, (i + 1) as i64, file.kind, name) { break; } @@ -505,7 +496,6 @@ impl Filesystem for CorruptFs { if self.is_open_dir(fh) { for (i, (name, inode)) in self.inode_map.iter().skip(offset as usize).enumerate() { let file = self.files.get(inode).unwrap(); - debug!("readdirplus: adding file {:?}", name); if reply.add(*inode, (i + 1) as i64, name, &TTL, &file.as_file_attr(), 0) { break; } diff --git a/src/main.rs b/src/main.rs index c6e9181..4db26d2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,6 @@ fn main() { env_logger::init_from_env(Env::new().filter("CORRUPTFS_LOG")); let args = Args::parse(); - debug!("extra options: {:?}", args.options); let mut options = vec![ MountOption::FSName("corruptfs".to_string()),