Skip to content

Commit 4108ccd

Browse files
gexuyangbergwolf
authored andcommitted
log: print some variables in hexadecimal
HEX is more readable for some data, like nodeid/offset/length. Signed-off-by: gexuyang <[email protected]>
1 parent e0e4da7 commit 4108ccd

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/abi/fuse_abi.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
#![allow(missing_docs)]
88

9+
use std::fmt::{Debug, Formatter};
910
use std::mem;
1011

1112
use bitflags::bitflags;
@@ -1169,7 +1170,7 @@ pub struct FallocateIn {
11691170
unsafe impl ByteValued for FallocateIn {}
11701171

11711172
#[repr(C)]
1172-
#[derive(Debug, Default, Copy, Clone)]
1173+
#[derive(Default, Copy, Clone)]
11731174
pub struct InHeader {
11741175
pub len: u32,
11751176
pub opcode: u32,
@@ -1182,6 +1183,16 @@ pub struct InHeader {
11821183
}
11831184
unsafe impl ByteValued for InHeader {}
11841185

1186+
impl Debug for InHeader {
1187+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
1188+
write!(
1189+
f,
1190+
"InHeader {{ len: {}, opcode: {}, unique: {}, nodeid: 0x{:x}, uid: {}, gid: {}, pid: {}, padding: {} }}",
1191+
self.len, self.opcode, self.unique, self.nodeid, self.uid, self.gid, self.pid, self.padding
1192+
)
1193+
}
1194+
}
1195+
11851196
#[repr(C)]
11861197
#[derive(Debug, Default, Copy, Clone)]
11871198
pub struct OutHeader {

src/passthrough/sync_io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
607607
vu_req: &mut dyn FsCacheReqHandler,
608608
) -> io::Result<()> {
609609
debug!(
610-
"fuse: setupmapping ino {:?} foffset {} len {} flags {} moffset {}",
610+
"fuse: setupmapping ino {:?} foffset 0x{:x} len 0x{:x} flags 0x{:x} moffset 0x{:x}",
611611
inode, foffset, len, flags, moffset
612612
);
613613

0 commit comments

Comments
 (0)