File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ use std::io::BufReader;
15
15
use std:: process;
16
16
17
17
use stats:: Stats ;
18
- use util:: { bargraph, iec} ;
18
+ use util:: { bargraph, iec, is_virtual } ;
19
19
20
20
const FS_SPEC : usize = 0 ;
21
21
const FS_FILE : usize = 1 ;
@@ -48,6 +48,9 @@ fn main() {
48
48
match line {
49
49
Ok ( line) => {
50
50
let fields: Vec < & str > = line. split_whitespace ( ) . collect ( ) ;
51
+ if !matches. is_present ( "all" ) && is_virtual ( fields[ FS_SPEC ] ) {
52
+ continue ;
53
+ }
51
54
let statvfs = match statvfs ( fields[ FS_FILE ] ) {
52
55
Ok ( s) => s,
53
56
Err ( err) => {
Original file line number Diff line number Diff line change @@ -46,6 +46,13 @@ pub fn bargraph(mut percent: f64) -> String {
46
46
format ! ( "{}{}" , bar1, bar2)
47
47
}
48
48
49
+ pub fn is_virtual ( fs : & str ) -> bool {
50
+ match fs {
51
+ "devtmpfs" | "portal" | "tmpfs" => true ,
52
+ _ => fs. starts_with ( "/dev/loop" ) || fs. starts_with ( "systemd-" ) ,
53
+ }
54
+ }
55
+
49
56
#[ cfg( test) ]
50
57
mod tests {
51
58
use super :: shorten_lv;
You can’t perform that action at this time.
0 commit comments