Skip to content

Commit 909ece6

Browse files
committed
blockdev: Get more properties
- Add `partlabel` in prep for ppc64le bootloader bits - Add `maj_min` and `start` which we want for s390x - Clearly move the filesystesm-related bits to a separate section Signed-off-by: Colin Walters <[email protected]>
1 parent 6ba4025 commit 909ece6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/src/blockdev.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@ pub(crate) struct Device {
2727
pub(crate) name: String,
2828
pub(crate) serial: Option<String>,
2929
pub(crate) model: Option<String>,
30-
pub(crate) label: Option<String>,
31-
pub(crate) fstype: Option<String>,
30+
pub(crate) partlabel: Option<String>,
3231
pub(crate) children: Option<Vec<Device>>,
3332
pub(crate) size: Option<String>,
33+
#[serde(rename = "maj:min")]
34+
pub(crate) maj_min: Option<String>,
35+
// NOTE this one is not available on older util-linux, and
36+
// will also not exist for whole blockdevs (as opposed to partitions).
37+
pub(crate) start: Option<u64>,
38+
39+
// Filesystem-related properties
40+
pub(crate) label: Option<String>,
41+
pub(crate) fstype: Option<String>,
3442
}
3543

3644
impl Device {
@@ -56,7 +64,7 @@ pub(crate) fn wipefs(dev: &Utf8Path) -> Result<()> {
5664

5765
fn list_impl(dev: Option<&Utf8Path>) -> Result<Vec<Device>> {
5866
let o = Command::new("lsblk")
59-
.args(["-J", "-o", "NAME,SERIAL,MODEL,LABEL,FSTYPE,SIZE"])
67+
.args(["-J", "-O"])
6068
.args(dev)
6169
.output()?;
6270
if !o.status.success() {

0 commit comments

Comments
 (0)