line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package System::Introspector::Probe::MountPoints; |
2
|
1
|
|
|
1
|
|
28153
|
use Moo; |
|
1
|
|
|
|
|
24922
|
|
|
1
|
|
|
|
|
7
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
|
|
439
|
use System::Introspector::Util qw( |
5
|
|
|
|
|
|
|
handle_from_file |
6
|
|
|
|
|
|
|
transform_exceptions |
7
|
1
|
|
|
1
|
|
3110
|
); |
|
1
|
|
|
|
|
3
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub gather { |
10
|
1
|
|
|
1
|
0
|
53
|
my ($self) = @_; |
11
|
|
|
|
|
|
|
return { |
12
|
|
|
|
|
|
|
mtab => transform_exceptions { |
13
|
1
|
|
|
1
|
|
5
|
return { entries |
14
|
|
|
|
|
|
|
=> $self->_parse_tab_fh($self->_open_fh('/etc/mtab')) }; |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
fstab => transform_exceptions { |
17
|
1
|
|
|
1
|
|
3
|
return { entries |
18
|
|
|
|
|
|
|
=> $self->_parse_tab_fh($self->_open_fh('/etc/fstab')) }; |
19
|
|
|
|
|
|
|
}, |
20
|
1
|
|
|
|
|
9
|
}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _open_fh { |
24
|
2
|
|
|
2
|
|
4
|
my ($self, $file) = @_; |
25
|
2
|
|
|
|
|
8
|
return handle_from_file $file; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _parse_tab_fh { |
29
|
2
|
|
|
2
|
|
5
|
my ($self, $fh) = @_; |
30
|
2
|
|
|
|
|
2
|
my @mounts; |
31
|
2
|
|
|
|
|
70
|
while (defined( my $line = <$fh> )) { |
32
|
19
|
|
|
|
|
21
|
chomp $line; |
33
|
19
|
100
|
66
|
|
|
132
|
next if $line =~ m{^\s*$} |
34
|
|
|
|
|
|
|
or $line =~ m{^\s*#}; |
35
|
18
|
|
|
|
|
65
|
my ($device, $point, $type, $opt, $dump, $pass) |
36
|
|
|
|
|
|
|
= split m{\s+}, $line; |
37
|
79
|
|
|
|
|
124
|
push @mounts, { |
38
|
|
|
|
|
|
|
device_name => $device, |
39
|
|
|
|
|
|
|
mount_point => $point, |
40
|
|
|
|
|
|
|
fs_type => $type, |
41
|
|
|
|
|
|
|
dump_freq => $dump, |
42
|
|
|
|
|
|
|
pass_num => $pass, |
43
|
|
|
|
|
|
|
options => { |
44
|
|
|
|
|
|
|
map { |
45
|
18
|
|
|
|
|
64
|
my ($name, $value) = split m{=}, $_, 2; |
46
|
79
|
100
|
|
|
|
143
|
$value = 1 |
47
|
|
|
|
|
|
|
unless defined $value; |
48
|
79
|
|
|
|
|
274
|
($name => $value); |
49
|
|
|
|
|
|
|
} split m{,}, $opt, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
1
|
|
|
1
|
|
9
|
no warnings 'uninitialized'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
54
|
57
|
50
|
|
|
|
119
|
return [ sort { |
55
|
2
|
|
|
|
|
11
|
($a->{device_name} cmp $b->{device_name}) |
56
|
|
|
|
|
|
|
|| |
57
|
|
|
|
|
|
|
($a->{mount_point} cmp $b->{mount_point}) |
58
|
|
|
|
|
|
|
} @mounts ]; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |