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,
gid: disk_inode.gid as usize,
blk_size: 0x1000,
rdev: 0,
})
}
fn set_metadata(&self, metadata: &vfs::Metadata) -> vfs::Result<()> {

@ -67,7 +67,7 @@ pub struct INodeImpl {
fs: Arc<SimpleFileSystem>,
/// 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<()> {

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

@ -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)]

Loading…
Cancel
Save