File: mounts.rs

package info (click to toggle)
rust-procfs 0.17.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 652 kB
  • sloc: makefile: 2
file content (19 lines) | stat: -rw-r--r-- 686 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// List mountpoints listed in /proc/mounts

fn main() {
let width = 15;
    for mount_entry in procfs::mounts().unwrap() {
        println!("Device: {}", mount_entry.fs_spec);
        println!("{:>width$}: {}", "Mount point", mount_entry.fs_file);
        println!("{:>width$}: {}","FS type", mount_entry.fs_vfstype);
        println!("{:>width$}: {}", "Dump", mount_entry.fs_freq);
        println!("{:>width$}: {}", "Check", mount_entry.fs_passno);
        print!("{:>width$}: ", "Options");
        for (name, entry) in mount_entry.fs_mntops {
            if let Some(entry) = entry {
                print!("{name}: {entry} ");
            }
        }
        println!("");
    }
}