diff --git a/rcore-fs-sefs/src/lib.rs b/rcore-fs-sefs/src/lib.rs index 7a22479..91c8d27 100644 --- a/rcore-fs-sefs/src/lib.rs +++ b/rcore-fs-sefs/src/lib.rs @@ -195,6 +195,7 @@ impl vfs::INode for INodeImpl { uid: disk_inode.uid as usize, gid: disk_inode.gid as usize, blk_size: 0x1000, + rdev: 0, }) } fn set_metadata(&self, metadata: &vfs::Metadata) -> vfs::Result<()> { diff --git a/rcore-fs-sfs/src/lib.rs b/rcore-fs-sfs/src/lib.rs index de16713..2acb580 100644 --- a/rcore-fs-sfs/src/lib.rs +++ b/rcore-fs-sfs/src/lib.rs @@ -67,7 +67,7 @@ pub struct INodeImpl { fs: Arc, /// Char/block device id (major, minor) /// e.g. crw-rw-rw- 1 root wheel 3, 2 May 13 16:40 /dev/null - device_inode_id: usize, + device_inode_id: usize, } impl Debug for INodeImpl { @@ -470,6 +470,7 @@ impl vfs::INode for INodeImpl { uid: 0, gid: 0, blk_size: BLKSIZE, + rdev: self.device_inode_id, }) } fn set_metadata(&self, _metadata: &vfs::Metadata) -> vfs::Result<()> { diff --git a/rcore-fs-sfs/src/tests.rs b/rcore-fs-sfs/src/tests.rs index cde4174..58235ef 100644 --- a/rcore-fs-sfs/src/tests.rs +++ b/rcore-fs-sfs/src/tests.rs @@ -57,6 +57,7 @@ fn create_file() -> Result<()> { gid: 0, blk_size: 4096, dev: 0, + rdev: 100, // dummo why 100 here, maybe legacy data? } ); diff --git a/rcore-fs/src/vfs.rs b/rcore-fs/src/vfs.rs index 4c7f0cb..62c5ef5 100644 --- a/rcore-fs/src/vfs.rs +++ b/rcore-fs/src/vfs.rs @@ -160,7 +160,7 @@ pub struct PollStatus { #[derive(Debug, Eq, PartialEq)] pub struct Metadata { /// Device ID - pub dev: usize, + pub dev: usize, // (major << 8) | minor /// Inode number pub inode: usize, /// Size in bytes @@ -192,6 +192,9 @@ pub struct Metadata { pub uid: usize, /// Group ID pub gid: usize, + /// Raw device id + /// e.g. /dev/null: makedev(0x1, 0x3) + pub rdev: usize, // (major << 8) | minor } #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]