Remove unneeded debugging statements

This commit is contained in:
Brian Tarricone 2024-10-23 03:16:40 -07:00
parent 2e4934e986
commit 4747327b8e
2 changed files with 2 additions and 13 deletions

View File

@ -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;
}

View File

@ -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()),