Support 16 bit device numbers
This commit is contained in:
parent
96f7e8be7c
commit
f665490a4d
@ -10,8 +10,8 @@ use libcitadel::{Result, util};
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct DiskPartition {
|
pub struct DiskPartition {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
major: u8,
|
major: u16,
|
||||||
minor: u8,
|
minor: u16,
|
||||||
blocks: usize,
|
blocks: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,15 +55,15 @@ impl DiskPartition {
|
|||||||
bail!("could not parse");
|
bail!("could not parse");
|
||||||
}
|
}
|
||||||
Ok(DiskPartition::from_line_components(
|
Ok(DiskPartition::from_line_components(
|
||||||
v[0].parse::<u8>()?, // Major
|
v[0].parse::<u16>()?, // Major
|
||||||
v[1].parse::<u8>()?, // Minor
|
v[1].parse::<u16>()?, // Minor
|
||||||
v[2].parse::<usize>()?, // number of blocks
|
v[2].parse::<usize>()?, // number of blocks
|
||||||
v[3],
|
v[3],
|
||||||
)) // device name
|
)) // device name
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new `DiskPartion` from parsed components of line from /proc/partitions
|
// create a new `DiskPartion` from parsed components of line from /proc/partitions
|
||||||
fn from_line_components(major: u8, minor: u8, blocks: usize, name: &str) -> DiskPartition {
|
fn from_line_components(major: u16, minor: u16, blocks: usize, name: &str) -> DiskPartition {
|
||||||
DiskPartition {
|
DiskPartition {
|
||||||
path: PathBuf::from("/dev").join(name),
|
path: PathBuf::from("/dev").join(name),
|
||||||
major,
|
major,
|
||||||
|
Loading…
Reference in New Issue
Block a user