mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
fix(df): Linux: Fix the mount path and type
This commit is contained in:
parent
8f6770401d
commit
c85756e509
2 changed files with 11 additions and 2 deletions
|
@ -356,11 +356,13 @@ impl MountInfo {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
fn new(file_name: &str, raw: Vec<&str>) -> Option<MountInfo> {
|
fn new(file_name: &str, raw: Vec<&str>) -> Option<MountInfo> {
|
||||||
match file_name {
|
match file_name {
|
||||||
|
// Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
|
||||||
|
// "man proc" for more details
|
||||||
"/proc/self/mountinfo" => {
|
"/proc/self/mountinfo" => {
|
||||||
let mut m = MountInfo {
|
let mut m = MountInfo {
|
||||||
dev_id: "".to_string(),
|
dev_id: "".to_string(),
|
||||||
dev_name: raw[8].to_string(),
|
dev_name: raw[9].to_string(),
|
||||||
fs_type: raw[7].to_string(),
|
fs_type: raw[8].to_string(),
|
||||||
mount_root: raw[3].to_string(),
|
mount_root: raw[3].to_string(),
|
||||||
mount_dir: raw[4].to_string(),
|
mount_dir: raw[4].to_string(),
|
||||||
mount_option: raw[5].to_string(),
|
mount_option: raw[5].to_string(),
|
||||||
|
|
|
@ -6,4 +6,11 @@ fn test_df_compatible() {
|
||||||
let result = ucmd.arg("-ah").run();
|
let result = ucmd.arg("-ah").run();
|
||||||
assert!(result.success);
|
assert!(result.success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_df_compatible_type() {
|
||||||
|
let (_, mut ucmd) = at_and_ucmd!();
|
||||||
|
let result = ucmd.arg("-aT").run();
|
||||||
|
assert!(result.success);
|
||||||
|
}
|
||||||
// TODO
|
// TODO
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue