Expose device id via rdev in metadata

master
Jiajie Chen 6 years ago
parent e6c4590a93
commit 7629e287cb

@ -195,6 +195,7 @@ impl vfs::INode for INodeImpl {
uid: disk_inode.uid as usize, uid: disk_inode.uid as usize,
gid: disk_inode.gid as usize, gid: disk_inode.gid as usize,
blk_size: 0x1000, blk_size: 0x1000,
rdev: 0,
}) })
} }
fn set_metadata(&self, metadata: &vfs::Metadata) -> vfs::Result<()> { fn set_metadata(&self, metadata: &vfs::Metadata) -> vfs::Result<()> {

@ -470,6 +470,7 @@ impl vfs::INode for INodeImpl {
uid: 0, uid: 0,
gid: 0, gid: 0,
blk_size: BLKSIZE, blk_size: BLKSIZE,
rdev: self.device_inode_id,
}) })
} }
fn set_metadata(&self, _metadata: &vfs::Metadata) -> vfs::Result<()> { fn set_metadata(&self, _metadata: &vfs::Metadata) -> vfs::Result<()> {

@ -57,6 +57,7 @@ fn create_file() -> Result<()> {
gid: 0, gid: 0,
blk_size: 4096, blk_size: 4096,
dev: 0, dev: 0,
rdev: 100, // dummo why 100 here, maybe legacy data?
} }
); );

@ -160,7 +160,7 @@ pub struct PollStatus {
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct Metadata { pub struct Metadata {
/// Device ID /// Device ID
pub dev: usize, pub dev: usize, // (major << 8) | minor
/// Inode number /// Inode number
pub inode: usize, pub inode: usize,
/// Size in bytes /// Size in bytes
@ -192,6 +192,9 @@ pub struct Metadata {
pub uid: usize, pub uid: usize,
/// Group ID /// Group ID
pub gid: usize, 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)] #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]

Loading…
Cancel
Save