Skip to content

Commit

Permalink
blockdev: Add maj_min filed in Device
Browse files Browse the repository at this point in the history
This patch introduces a new field in the Device struct
for major and minor device numbers.

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
  • Loading branch information
yoheiueda committed Jul 11, 2024
1 parent 0d92f30 commit d9e8c14
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/blockdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub(crate) struct Device {
pub(crate) fstype: Option<String>,
pub(crate) children: Option<Vec<Device>>,
pub(crate) size: Option<String>,
#[serde(rename = "maj:min")]
pub(crate) maj_min: Option<String>,
}

impl Device {
Expand All @@ -56,7 +58,7 @@ pub(crate) fn wipefs(dev: &Utf8Path) -> Result<()> {

fn list_impl(dev: Option<&Utf8Path>) -> Result<Vec<Device>> {
let o = Command::new("lsblk")
.args(["-J", "-o", "NAME,SERIAL,MODEL,LABEL,FSTYPE,SIZE"])
.args(["-J", "-o", "NAME,SERIAL,MODEL,LABEL,FSTYPE,SIZE,MAJ:MIN"])
.args(dev)
.output()?;
if !o.status.success() {
Expand Down

0 comments on commit d9e8c14

Please sign in to comment.