Add Debug support for some fs components

This commit is contained in:
LI Qing
2023-08-04 12:00:22 +08:00
committed by Tate, Hongliang Tian
parent acfbc7efdc
commit 55267f0d81
10 changed files with 100 additions and 1 deletions

View File

@ -474,11 +474,21 @@ impl Dentry {
}
}
impl Debug for Dentry {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dentry")
.field("abs_path", &self.abs_path())
.field("vnode", &self.vnode)
.field("flags", &self.flags())
.finish()
}
}
/// DentryKey is the unique identifier for Dentry in DCACHE.
///
/// For none-root dentries, it uses self's name and parent's pointer to form the key,
/// meanwhile, the root dentry uses "/" and self's pointer to form the key.
#[derive(Clone, Hash, PartialOrd, Ord, Eq, PartialEq)]
#[derive(Debug, Clone, Hash, PartialOrd, Ord, Eq, PartialEq)]
pub struct DentryKey {
name: String,
parent_ptr: usize,