Skip to content

Commit f65851d

Browse files
committed
abi: add with_flags function to create linux_abi::Attr
This function can specify the flags when creating the Attr Signed-off-by: hugh.gxy <[email protected]>
1 parent 8ed7c6b commit f65851d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/abi/linux_abi.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ unsafe impl ByteValued for Attr {}
540540

541541
impl From<libc::stat64> for Attr {
542542
fn from(st: libc::stat64) -> Attr {
543+
Attr::with_flags(st, 0)
544+
}
545+
}
546+
547+
impl Attr {
548+
pub fn with_flags(st: libc::stat64, flags: u32) -> Attr {
543549
Attr {
544550
ino: st.st_ino,
545551
size: st.st_size as u64,
@@ -556,7 +562,7 @@ impl From<libc::stat64> for Attr {
556562
gid: st.st_gid,
557563
rdev: st.st_rdev as u32,
558564
blksize: st.st_blksize as u32,
559-
..Default::default()
565+
flags: flags as u32,
560566
}
561567
}
562568
}

0 commit comments

Comments
 (0)