« blib/lib/Langertha/Holmgang/Sim/Linux/Http.pm
↑ Summary
blib/lib/Langertha/Holmgang/Sim/Linux/Git.pm »
| 1 | package Langertha::Holmgang::Sim::Linux::Storage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Disks and file systems on a simulated Linux server — LVM, mount, fstab, swap, mdadm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use JSON::MaybeXS (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | my $T = JSON::MaybeXS::true(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | my $F = JSON::MaybeXS::false(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 129 | ▶ | sub _lx { 'Langertha::Holmgang::Sim::Linux' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lx: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 129 | ▶ | sub _L { my $n = shift; return _lx()->can($n)->(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_L: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 73 | ▶ | sub _b { _L( '_bytes', @_ ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_b: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 13 | ▶ | sub _h { _L( '_human', @_ ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_h: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 489 | ▶ | sub _st { $_[0]{storage} //= {} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_st: called CC=2 SCAR=7.6
Condition50%1/2
$_[0]{"storage"} //= {}
MC/DC0%0/1
$_[0]{"storage"} //= {}
$_[0]{"storage"}
Truth table50%1/2
A
A= $_[0]{"storage"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # --- Geräte ----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # alle Geräte mit Dateisystem-Merkmalen: kanonischer Pfad => Eintrag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 438 | ▶ | sub _all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_all: called CC=9 SCAR=22.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 438 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 438 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 438 | my %d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 438 | ▶ | $d{$_} = $s->{disks}{$_} for keys %{ $s->{disks} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'disks'} || {}
MC/DC0%0/1
$$s{'disks'} || {}
$$s{'disks'}
Truth table50%1/2
A
A= $$s{'disks'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 438 | ▶ | $d{$_} = $s->{md}{$_} for keys %{ $s->{md} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'md'} || {}
MC/DC0%0/1
$$s{'md'} || {}
$$s{'md'}
Truth table50%1/2
A
A= $$s{'md'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 438 | ▶ | for my $vg ( keys %{ $s->{vgs} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'} || {}
MC/DC0%0/1
$$s{'vgs'} || {}
$$s{'vgs'}
Truth table50%1/2
A
A= $$s{'vgs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 438 | ▶ | my $lvs = $s->{vgs}{$vg}{lvs} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'}{$vg}{'lvs'} || {}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'lvs'} || {}
$$s{'vgs'}{$vg}{'lvs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'lvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 438 | $d{"/dev/mapper/$vg-$_"} = $lvs->{$_} for keys %$lvs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 438 | return \%d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 389 | ▶ | sub canon { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canon: called CC=12 SCAR=25.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 389 | my ( $dev, $p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 389 | ▶ | return undef unless defined $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 389 | $p =~ s{/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 389 | my $all = _all($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 389 | ▶ | return $p if $all->{$p}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 30 | ▶ | if ( $p =~ m{\A/dev/([\w.-]+)/([\w.+-]+)\z} && $1 ne 'mapper' && $1 ne 'disk' ) { my $c = "/dev/mapper/$1-$2"; return $c if $all->{$c} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
$p =~ m[\A/dev/([\w.-]+)/([\w.+-]+)\z] and $1 ne "mapper" and $1 ne "disk"
$p =~ m[\A/dev/([\w.-]+)/([\w.+-]+)\z] and $1 ne "mapper"
MC/DC33%1/3
$p =~ m[\A/dev/([\w.-]+)/([\w.+-]+)\z] and $1 ne "mapper" and $1 ne "disk"
$p =~ m[\A/dev/([\w.-]+)/([\w.+-]+)\z]
$1 ne "mapper"
$1 ne "disk"
Truth table50%2/4
A and B and C
A= $p =~ m[\A/dev/([\w.-]+)/([\w.+-]+)\z]B= $1 ne "mapper"C= $1 ne "disk"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 28 | ▶ | if ( $p =~ m{\A([\w.-]+)/([\w.+-]+)\z} ) { my $c = "/dev/mapper/$1-$2"; return $c if $all->{$c} } # vg/lv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 27 | ▶ | if ( $p =~ /\A(UUID|LABEL)=["']?([^"']+)["']?\z/i || $p =~ m{\A/dev/disk/by-(uuid|label)/(.+)\z} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$p =~ /\A(UUID|LABEL)=["']?([^"']+)["']?\z/i or $p =~ m[\A/dev/disk/by-(uuid|label)/(.+)\z]
MC/DC50%1/2
$p =~ /\A(UUID|LABEL)=["']?([^"']+)["']?\z/i or $p =~ m[\A/dev/disk/by-(uuid|label)/(.+)\z]
$p =~ /\A(UUID|LABEL)=["']?([^"']+)["']?\z/i
$p =~ m[\A/dev/disk/by-(uuid|label)/(.+)\z]
Truth table66%2/3
A or B
A= $p =~ /\A(UUID|LABEL)=["']?([^"']+)["']?\z/iB= $p =~ m[\A/dev/disk/by-(uuid|label)/(.+)\z]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 5 | my ( $k, $v ) = ( lc $1, $2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 5 | ▶ | my ($hit) = grep { ( $all->{$_}{$k} // '' ) eq $v } sort keys %$all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$all{$_}{$k} // ""
MC/DC100%1/1
$$all{$_}{$k} // ""
$$all{$_}{$k}
Truth table100%2/2
A
A= $$all{$_}{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 5 | return $hit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 22 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 47 | ▶ | sub _bd { my ( $dev, $p ) = @_; my $c = canon( $dev, $p ) // return; return ( $c, _all($dev)->{$c} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bd: called CC=2 SCAR=6.9
Condition100%2/2
canon($dev, $p) // (return)
MC/DC100%1/1
canon($dev, $p) // (return)
canon($dev, $p)
Truth table100%2/2
A
A= canon($dev, $p)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | ▶ | sub _fssize { my ($e) = @_; return _b( $e->{fssize} // $e->{size} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fssize: called CC=2 SCAR=8.1
Condition33%1/3
$$e{"fssize"} // $$e{"size"}
MC/DC0%0/2
$$e{"fssize"} // $$e{"size"}
$$e{"fssize"}
$$e{"size"}
Truth table33%1/3
A // B
A= $$e{"fssize"}B= $$e{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 36 | ▶ | sub _mounted_at { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mounted_at: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 36 | my ( $dev, $c ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 36 | ▶ | my $m = $dev->{mounts} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table50%1/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 36 | ▶ | return grep { defined canon( $dev, $m->{$_}{dev} ) && canon( $dev, $m->{$_}{dev} ) eq $c } sort keys %$m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined canon($dev, $$m{$_}{'dev'}) && canon($dev, $$m{$_}{'dev'}) eq $c
MC/DC50%1/2
defined canon($dev, $$m{$_}{'dev'}) && canon($dev, $$m{$_}{'dev'}) eq $c
defined canon($dev, $$m{$_}{'dev'})
canon($dev, $$m{$_}{'dev'}) eq $c
Truth table66%2/3
A && B
A= defined canon($dev, $$m{$_}{'dev'})B= canon($dev, $$m{$_}{'dev'}) eq $c
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 5 | ▶ | sub _vg_of_pv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_vg_of_pv: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 5 | my ( $dev, $pv ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 5 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 5 | ▶ | for my $vg ( sort keys %{ $s->{vgs} || {} } ) { return $vg if grep { $_ eq $pv } @{ $s->{vgs}{$vg}{pvs} || [] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$s{'vgs'} || {}
$$s{'vgs'}{$vg}{'pvs'} || []
MC/DC0%0/1
$$s{'vgs'} || {}
$$s{'vgs'}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'pvs'} || []
$$s{'vgs'}{$vg}{'pvs'}
Truth table50%1/2
A
A= $$s{'vgs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'pvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | ▶ | sub _vg_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_vg_size: called CC=6 SCAR=18.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | my ( $dev, $vg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 4 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | my $size = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 4 | ▶ | $size += _b( $s->{disks}{$_}{size} // 0 ) for @{ $s->{vgs}{$vg}{pvs} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$s{'vgs'}{$vg}{'pvs'} || []
$$s{"disks"}{$_}{"size"} // 0
MC/DC0%0/1
$$s{'vgs'}{$vg}{'pvs'} || []
$$s{'vgs'}{$vg}{'pvs'}
MC/DC0%0/1
$$s{"disks"}{$_}{"size"} // 0
$$s{"disks"}{$_}{"size"}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'pvs'}
Truth table50%1/2
A
A= $$s{"disks"}{$_}{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 4 | my $used = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 4 | ▶ | $used += _b( $_->{size} ) for values %{ $s->{vgs}{$vg}{lvs} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'}{$vg}{'lvs'} || {}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'lvs'} || {}
$$s{'vgs'}{$vg}{'lvs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'lvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | return ( $size, $size - $used ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 10 | ▶ | sub _parts { my ( $dev, $disk ) = @_; my $d = _st($dev)->{disks} || {}; return sort grep { ( $d->{$_}{parent} // '' ) eq $disk } keys %$d } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parts: called CC=3 SCAR=11.0
Condition75%3/4
_st($dev)->{'disks'} || {}
$$d{$_}{"parent"} // ""
MC/DC0%0/1
_st($dev)->{'disks'} || {}
_st($dev)->{'disks'}
MC/DC100%1/1
$$d{$_}{"parent"} // ""
$$d{$_}{"parent"}
Truth table50%1/2
A
A= _st($dev)->{'disks'}
Truth table100%2/2
A
A= $$d{$_}{"parent"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 5 | ▶ | sub _gib { my ($b) = @_; return sprintf '%.2f GiB', $b / 1024**3 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gib: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | ▶ | sub _g { my ($b) = @_; my $x = $b / 1024**3; return $x == int $x ? "${x}g" : sprintf( '%.2fg', $x ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 6 | ▶ | sub prepare { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=15 SCAR=30.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 6 | my ( $dev, $ctx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 6 | ▶ | my $s = $dev->{storage} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 6 | ▶ | for my $mp ( keys %{ $dev->{mounts} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table50%1/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 24 | my $m = $dev->{mounts}{$mp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 24 | my ( $c, $e ) = _bd( $dev, $m->{dev} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 24 | ▶ | next unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 24 | ▶ | $m->{fstype} //= $e->{fstype} if defined $e->{fstype}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$m{"fstype"} //= $$e{"fstype"}
MC/DC0%0/2
$$m{"fstype"} //= $$e{"fstype"}
$$m{"fstype"}
$$e{"fstype"}
Truth table33%1/3
A //= B
A= $$m{"fstype"}B= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 24 | ▶ | $m->{opts} //= 'rw,relatime'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$m{"opts"} //= "rw,relatime"
MC/DC0%0/1
$$m{"opts"} //= "rw,relatime"
$$m{"opts"}
Truth table50%1/2
A
A= $$m{"opts"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 24 | ▶ | $e->{reserved_pct} //= $m->{reserved_pct} if defined $m->{reserved_pct}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$e{"reserved_pct"} //= $$m{"reserved_pct"}
MC/DC0%0/2
$$e{"reserved_pct"} //= $$m{"reserved_pct"}
$$e{"reserved_pct"}
$$m{"reserved_pct"}
Truth table33%1/3
A //= B
A= $$e{"reserved_pct"}B= $$m{"reserved_pct"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 6 | ▶ | $s->{fstab_loaded} //= _L( '_file_text', $dev, '/etc/fstab' ) // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$s{"fstab_loaded"} //= _L("_file_text", $dev, "/etc/fstab") // ""
_L("_file_text", $dev, "/etc/fstab") // ""
MC/DC0%0/1
$$s{"fstab_loaded"} //= _L("_file_text", $dev, "/etc/fstab") // ""
$$s{"fstab_loaded"}
Truth table50%1/2
A
A= $$s{"fstab_loaded"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # Einhaengepunkte sind Verzeichnisse, auch wenn gerade nichts eingehaengt ist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 6 | ▶ | $dev->{dirs}{$_} //= {} for grep { m{\A/.} } ( keys %{ $dev->{mounts} || {} } ), map { $_->{mp} =~ s{(?<=.)/+\z}{}r } _fstab($dev); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$$dev{'mounts'} || {}
$$dev{"dirs"}{$_} //= {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
MC/DC100%1/1
$$dev{"dirs"}{$_} //= {}
$$dev{"dirs"}{$_}
Truth table50%1/2
A
A= $$dev{'mounts'}
Truth table100%2/2
A
A= $$dev{"dirs"}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # --- fstab, mount ------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 11 | ▶ | sub _fstab { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fstab: called CC=6 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 11 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 11 | my @e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 11 | my $n = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 11 | ▶ | for my $l ( split /\n/, _L( '_file_text', $dev, '/etc/fstab' ) // '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_L("_file_text", $dev, "/etc/fstab") // ""
MC/DC0%0/1
_L("_file_text", $dev, "/etc/fstab") // ""
_L("_file_text", $dev, "/etc/fstab")
Truth table50%1/2
A
A= _L("_file_text", $dev, "/etc/fstab")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 25 | $n++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 25 | ▶ | next if $l =~ /\A\s*(?:#|\z)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 25 | my @f = split ' ', $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 25 | ▶ | push @e, { src => $f[0], mp => $f[1], type => $f[2] // 'auto', opts => $f[3] // 'defaults', line => $n }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$f[2] // "auto"
$f[3] // "defaults"
MC/DC0%0/1
$f[2] // "auto"
$f[2]
MC/DC0%0/1
$f[3] // "defaults"
$f[3]
Truth table50%1/2
A
A= $f[2]
Truth table50%1/2
A
A= $f[3]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 11 | return @e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | ▶ | sub _merge_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_merge_opts: called CC=12 SCAR=26.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 4 | my ( $old, $new ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 4 | ▶ | my @o = grep { length && $_ ne 'defaults' } split /,/, $old // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
length $_ && $_ ne 'defaults'
$old // ""
MC/DC0%0/2
length $_ && $_ ne 'defaults'
length $_
$_ ne 'defaults'
MC/DC0%0/1
$old // ""
$old
Truth table33%1/3
A && B
A= length $_B= $_ ne 'defaults'
Truth table50%1/2
A
A= $old
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 4 | my %pair = ( ro => 'rw', rw => 'ro', exec => 'noexec', noexec => 'exec', suid => 'nosuid', nosuid => 'suid', dev => 'nodev', nodev => 'dev', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | atime => 'noatime', noatime => 'atime' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | ▶ | for my $x ( grep { length && !/\A(?:remount|defaults|nofail|noauto|auto|_netdev|user|nouser|x-.*|comment=.*)\z/ } split /,/, $new // '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
length $_ && !/\A(?:remount|defaults|nofail|noauto|auto|_netdev|user|nouser|x-.*|comment=.*)\z/
$new // ""
MC/DC50%1/2
length $_ && !/\A(?:remount|defaults|nofail|noauto|auto|_netdev|user|nouser|x-.*|comment=.*)\z/
length $_
!/\A(?:remount|defaults|nofail|noauto|auto|_netdev|user|nouser|x-.*|comment=.*)\z/
MC/DC100%1/1
$new // ""
$new
Truth table66%2/3
A && not(B)
A= length $_B= !/\A(?:remount|defaults|nofail|noauto|auto|_netdev|user|nouser|x-.*|comment=.*)\z/
Truth table100%2/2
A
A= $new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | ▶ | @o = grep { $_ ne $x && $_ ne ( $pair{$x} // '' ) } @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$_ ne $x && $_ ne ($pair{$x} // '')
$pair{$x} // ""
MC/DC0%0/2
$_ ne $x && $_ ne ($pair{$x} // '')
$_ ne $x
$_ ne ($pair{$x} // '')
MC/DC0%0/1
$pair{$x} // ""
$pair{$x}
Truth table33%1/3
A && B
A= $_ ne $xB= $_ ne ($pair{$x} // '')
Truth table50%1/2
A
A= $pair{$x}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | push @o, $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 4 | ▶ | unshift @o, 'rw' unless grep { $_ eq 'ro' || $_ eq 'rw' } @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_ eq 'ro' || $_ eq 'rw'
MC/DC50%1/2
$_ eq 'ro' || $_ eq 'rw'
$_ eq 'ro'
$_ eq 'rw'
Truth table66%2/3
A || B
A= $_ eq 'ro'B= $_ eq 'rw'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | @o = ( ( grep { $_ eq 'ro' || $_ eq 'rw' } @o ), grep { $_ ne 'ro' && $_ ne 'rw' } @o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$_ eq 'ro' || $_ eq 'rw'
$_ ne 'ro' && $_ ne 'rw'
MC/DC50%1/2
$_ eq 'ro' || $_ eq 'rw'
$_ eq 'ro'
$_ eq 'rw'
MC/DC50%1/2
$_ ne 'ro' && $_ ne 'rw'
$_ ne 'ro'
$_ ne 'rw'
Truth table66%2/3
A || B
A= $_ eq 'ro'B= $_ eq 'rw'
Truth table66%2/3
A && B
A= $_ ne 'ro'B= $_ ne 'rw'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | return join ',', @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 4 | ▶ | sub _do_mount { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_mount: called CC=23 SCAR=39.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | my ( $dev, $src, $mp, $type, $opts ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 4 | my ( $c, $e ) = _bd( $dev, $src ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 4 | ▶ | return "mount: $mp: special device $src does not exist." unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | $mp =~ s{(?<=.)/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | ▶ | return "mount: $mp: mount point does not exist." unless _L( '_is_dir', $dev, $mp ) || ( $dev->{dirs} || {} )->{$mp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
_L("_is_dir", $dev, $mp) or ($$dev{"dirs"} || {})->{$mp}
$$dev{'dirs'} || {}
MC/DC0%0/2
_L("_is_dir", $dev, $mp) or ($$dev{"dirs"} || {})->{$mp}
_L("_is_dir", $dev, $mp)
$$dev{'dirs'}
Truth table33%1/3
A or B
A= _L("_is_dir", $dev, $mp)B= $$dev{'dirs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | my ($already) = _mounted_at( $dev, $c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | ▶ | return "mount: $mp: $src already mounted on $already." if defined $already; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | return "mount: $mp: $mp already mounted or mount point busy." if ( $dev->{mounts} || {} )->{$mp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table50%1/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 2 | my $fs = $e->{fstype}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | ▶ | return "mount: $mp: wrong fs type, bad option, bad superblock on $c, missing codepage or helper program, or other error." unless $fs && $fs !~ /\A(?:swap|LVM2_member|linux_raid_member)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$fs and not $fs =~ /\A(?:swap|LVM2_member|linux_raid_member)\z/
MC/DC0%0/2
$fs and not $fs =~ /\A(?:swap|LVM2_member|linux_raid_member)\z/
$fs
not $fs =~ /\A(?:swap|LVM2_member|linux_raid_member)\z/
Truth table33%1/3
A and not(B)
A= $fsB= not $fs =~ /\A(?:swap|LVM2_member|linux_raid_member)\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 2 | ▶ | return "mount: $mp: unknown filesystem type '$type'." if defined $type && $type ne 'auto' && $type ne $fs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $type and $type ne "auto" and $type ne $fs
defined $type and $type ne "auto"
MC/DC0%0/3
defined $type and $type ne "auto" and $type ne $fs
defined $type
$type ne "auto"
$type ne $fs
Truth table50%2/4
A and B and C
A= defined $typeB= $type ne "auto"C= $type ne $fs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # was unter dem Einhängepunkt lag, wird verdeckt; das Dateisystem bringt seine Dateien mit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | ▶ | my $off = delete $e->{offline} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $$e{'offline'} || {}
MC/DC0%0/1
delete $$e{'offline'} || {}
delete $$e{'offline'}
Truth table50%1/2
A
A= delete $$e{'offline'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | for my $p ( _L( '_under', $dev, $mp ) ) { $e->{hidden}{$p} = delete $dev->{files}{$p} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $hid = $e->{hidden} ? { %{ $e->{hidden} } } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | delete $e->{hidden}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | ▶ | for my $rel ( keys %{ $off->{files} || {} } ) { $dev->{files}{ ( $mp eq '/' ? '' : $mp ) . $rel } = $off->{files}{$rel} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$off{'files'} || {}
MC/DC0%0/1
$$off{'files'} || {}
$$off{'files'}
Truth table50%1/2
A
A= $$off{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $dev->{mounts}{$mp} = { dev => $c, size => _h( _fssize($e) ), used => $off->{used} // '100M', fstype => $fs, opts => _merge_opts( 'rw,relatime', $opts ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | ▶ | ( defined $e->{reserved_pct} ? ( reserved_pct => $e->{reserved_pct} ) : () ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$off{"used"} // "100M"
MC/DC0%0/1
$$off{"used"} // "100M"
$$off{"used"}
Truth table50%1/2
A
A= $$off{"used"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | ▶ | _st($dev)->{covered}{$mp} = $hid if $hid && %$hid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hid and %$hid
MC/DC0%0/2
$hid and %$hid
$hid
%$hid
Truth table33%1/3
A and B
A= $hidB= %$hid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | ▶ | sub _do_umount { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_umount: called CC=17 SCAR=31.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | my ( $dev, $mp, $lazy ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 4 | my $m = $dev->{mounts}{$mp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 4 | ▶ | for my $n ( sort keys %{ $dev->{services} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'services'} || {}
MC/DC0%0/1
$$dev{'services'} || {}
$$dev{'services'}
Truth table50%1/2
A
A= $$dev{'services'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 4 | my $svc = $dev->{services}{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 4 | ▶ | next unless $svc->{active}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | ▶ | return "umount: $mp: target is busy." if grep { $_ eq $mp || index( $_, "$mp/" ) == 0 } @{ $svc->{uses} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$_ eq $mp || index($_, "$mp/") == 0
$$svc{'uses'} || []
MC/DC0%0/2
$_ eq $mp || index($_, "$mp/") == 0
$_ eq $mp
index($_, "$mp/") == 0
MC/DC0%0/1
$$svc{'uses'} || []
$$svc{'uses'}
Truth table33%1/3
A || B
A= $_ eq $mpB= index($_, "$mp/") == 0
Truth table50%1/2
A
A= $$svc{'uses'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | my ( $c, $e ) = _bd( $dev, $m->{dev} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | my %files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 3 | ▶ | for my $p ( _L( '_under', $dev, $mp ) ) { $files{ substr( $p, length( $mp eq '/' ? '' : $mp ) ) } = delete $dev->{files}{$p} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 3 | ▶ | if ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 3 | ▶ | $e->{offline} = { used => $m->{used}, ( %files ? ( files => \%files ) : () ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 3 | ▶ | $e->{fssize} = $m->{size} if _b( $m->{size} ) != _b( $e->{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | ▶ | $e->{reserved_pct} = $m->{reserved_pct} if defined $m->{reserved_pct}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | delete $dev->{mounts}{$mp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 3 | ▶ | $dev->{dirs}{$mp} //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{"dirs"}{$mp} //= {}
MC/DC0%0/1
$$dev{"dirs"}{$mp} //= {}
$$dev{"dirs"}{$mp}
Truth table50%1/2
A
A= $$dev{"dirs"}{$mp}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 3 | ▶ | my $cov = delete( ( _st($dev)->{covered} || {} )->{$mp} ) || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
delete((_st($dev)->{'covered'} || {})->{$mp}) || {}
_st($dev)->{'covered'} || {}
MC/DC0%0/1
delete((_st($dev)->{'covered'} || {})->{$mp}) || {}
_st($dev)->{'covered'}
Truth table50%1/2
A
A= _st($dev)->{'covered'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 3 | $dev->{files}{$_} = $cov->{$_} for keys %$cov; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 3 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 5 | ▶ | sub _fstab_hint { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fstab_hint: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 5 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 5 | ▶ | my $now = _L( '_file_text', $dev, '/etc/fstab' ) // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_L("_file_text", $dev, "/etc/fstab") // ""
MC/DC0%0/1
_L("_file_text", $dev, "/etc/fstab") // ""
_L("_file_text", $dev, "/etc/fstab")
Truth table50%1/2
A
A= _L("_file_text", $dev, "/etc/fstab")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 5 | ▶ | return $now ne ( _st($dev)->{fstab_loaded} // '' ) ? "mount: (hint) your fstab has been modified, but systemd still uses\n the old version; use 'systemctl daemon-reload' to reload." : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
_st($dev)->{"fstab_loaded"} // ""
MC/DC0%0/1
_st($dev)->{"fstab_loaded"} // ""
_st($dev)->{"fstab_loaded"}
Truth table50%1/2
A
A= _st($dev)->{"fstab_loaded"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 5 | ▶ | sub mount { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mount: called CC=44 SCAR=51.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 5 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 5 | my ( @a, $type, $opts, $all ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 5 | my @w = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | ▶ | while (@w) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 7 | my $x = shift @w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ( $x eq '-t' ) { $type = shift @w } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | elsif ( $x eq '-o' ) { $opts = shift @w } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | elsif ( $x =~ /\A-o(.+)\z/ ) { $opts = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 3 | ▶ | elsif ( $x eq '-a' || $x eq '--all' ) { $all = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$x eq "-a" or $x eq "--all"
MC/DC50%1/2
$x eq "-a" or $x eq "--all"
$x eq "-a"
$x eq "--all"
Truth table66%2/3
A or B
A= $x eq "-a"B= $x eq "--all"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ▶ | elsif ( $x =~ /\A-[vfnr]+\z/ || $x eq '--verbose' ) { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$x =~ /\A-[vfnr]+\z/ or $x eq "--verbose"
MC/DC0%0/2
$x =~ /\A-[vfnr]+\z/ or $x eq "--verbose"
$x =~ /\A-[vfnr]+\z/
$x eq "--verbose"
Truth table33%1/3
A or B
A= $x =~ /\A-[vfnr]+\z/B= $x eq "--verbose"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 3 | else { push @a, $x } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 5 | ▶ | my $m = $dev->{mounts} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table50%1/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 5 | ▶ | if ( !@a && !$all ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@a or $all
MC/DC0%0/2
@a or $all
@a
$all
Truth table66%2/3
A or B
A= @aB= $all
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | return ( join( "\n", map { "$m->{$_}{dev} on $_ type " . ( $m->{$_}{fstype} // 'ext4' ) . ' (' . ( $m->{$_}{opts} // 'rw,relatime' ) . ')' } sort keys %$m ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$m{$_}{"fstype"} // "ext4"
$$m{$_}{"opts"} // "rw,relatime"
MC/DC0%0/1
$$m{$_}{"fstype"} // "ext4"
$$m{$_}{"fstype"}
MC/DC0%0/1
$$m{$_}{"opts"} // "rw,relatime"
$$m{$_}{"opts"}
Truth table0%0/2
A
A= $$m{$_}{"fstype"}
Truth table0%0/2
A
A= $$m{$_}{"opts"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 5 | my @hint = _fstab_hint($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 5 | ▶ | if ($all) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 3 | my @err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | for my $f ( _fstab($dev) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 8 | ▶ | next if $f->{type} eq 'swap' || $f->{mp} eq 'none' || $f->{opts} =~ /(?:\A|,)noauto(?:,|\z)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$$f{"type"} eq "swap" or $$f{"mp"} eq "none" or $$f{"opts"} =~ /(?:\A|,)noauto(?:,|\z)/
$$f{"type"} eq "swap" or $$f{"mp"} eq "none"
MC/DC0%0/3
$$f{"type"} eq "swap" or $$f{"mp"} eq "none" or $$f{"opts"} =~ /(?:\A|,)noauto(?:,|\z)/
$$f{"type"} eq "swap"
$$f{"mp"} eq "none"
$$f{"opts"} =~ /(?:\A|,)noauto(?:,|\z)/
Truth table25%1/4
A or B or C
A= $$f{"type"} eq "swap"B= $$f{"mp"} eq "none"C= $$f{"opts"} =~ /(?:\A|,)noauto(?:,|\z)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 8 | ( my $mp = $f->{mp} ) =~ s{(?<=.)/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 8 | ▶ | next if $m->{$mp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3 | my $e = _do_mount( $dev, $f->{src}, $mp, $f->{type}, $f->{opts} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 3 | ▶ | next unless defined $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | ▶ | $e = "mount: $mp: can't find $f->{src}." if $f->{src} =~ /\A(?:UUID|LABEL)=/i && $e =~ /special device/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$f{"src"} =~ /\A(?:UUID|LABEL)=/i and $e =~ /special device/
MC/DC0%0/2
$$f{"src"} =~ /\A(?:UUID|LABEL)=/i and $e =~ /special device/
$$f{"src"} =~ /\A(?:UUID|LABEL)=/i
$e =~ /special device/
Truth table33%1/3
A and B
A= $$f{"src"} =~ /\A(?:UUID|LABEL)=/iB= $e =~ /special device/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | ▶ | push @err, $e unless $f->{opts} =~ /(?:\A|,)nofail(?:,|\z)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 3 | ▶ | return ( join( "\n", @hint, @err ), @err ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | ▶ | if ( defined $opts && $opts =~ /(?:\A|,)remount(?:,|\z)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $opts and $opts =~ /(?:\A|,)remount(?:,|\z)/
MC/DC50%1/2
defined $opts and $opts =~ /(?:\A|,)remount(?:,|\z)/
defined $opts
$opts =~ /(?:\A|,)remount(?:,|\z)/
Truth table66%2/3
A and B
A= defined $optsB= $opts =~ /(?:\A|,)remount(?:,|\z)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1 | my $t = $a[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | $t =~ s{(?<=.)/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | my ($mp) = grep { $_ eq $t || canon( $dev, $m->{$_}{dev} ) eq ( canon( $dev, $t ) // '' ) } sort keys %$m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$_ eq $t || canon($dev, $$m{$_}{'dev'}) eq (canon($dev, $t) // '')
canon($dev, $t) // ""
MC/DC50%1/2
$_ eq $t || canon($dev, $$m{$_}{'dev'}) eq (canon($dev, $t) // '')
$_ eq $t
canon($dev, $$m{$_}{'dev'}) eq (canon($dev, $t) // '')
MC/DC0%0/1
canon($dev, $t) // ""
canon($dev, $t)
Truth table66%2/3
A || B
A= $_ eq $tB= canon($dev, $$m{$_}{'dev'}) eq (canon($dev, $t) // '')
Truth table50%1/2
A
A= canon($dev, $t)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | ▶ | return ( "mount: $t: mount point not mounted or bad option.", 0 ) unless defined $mp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | my ( $c, $e ) = _bd( $dev, $m->{$mp}{dev} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # wie util-linux: Optionen aus fstab, dann die auf der Befehlszeile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | my ($f) = grep { ( $_->{mp} =~ s{(?<=.)/+\z}{}r ) eq $mp } _fstab($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 1 | ▶ | my $new = _merge_opts( _merge_opts( $m->{$mp}{opts}, $f ? $f->{opts} : '' ), $opts ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | ▶ | $m->{$mp}{opts} = $new if $new ne ( $m->{$mp}{opts} // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$m{$mp}{"opts"} // ""
MC/DC0%0/1
$$m{$mp}{"opts"} // ""
$$m{$mp}{"opts"}
Truth table50%1/2
A
A= $$m{$mp}{"opts"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | my ( $src, $mp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | ▶ | if ( @a == 1 ) { # aus fstab | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my $t = $a[0] =~ s{(?<=.)/+\z}{}r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | my ($f) = grep { ( $_->{mp} =~ s{(?<=.)/+\z}{}r ) eq $t || $_->{src} eq $t || ( canon( $dev, $_->{src} ) // '' ) eq ( canon( $dev, $t ) // '-' ) } _fstab($dev); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/10
$$_{'mp'} =~ s[(?<=.)/+\z][]r eq $t || $$_{'src'} eq $t || (canon($dev, $$_{'src'}) // '') eq (canon($dev, $t) // '-')
$$_{"mp"} =~ s[(?<=.)/+\z][]r eq $t or $$_{"src"} eq $t
canon($dev, $$_{"src"}) // ""
canon($dev, $t) // "-"
MC/DC0%0/3
$$_{'mp'} =~ s[(?<=.)/+\z][]r eq $t || $$_{'src'} eq $t || (canon($dev, $$_{'src'}) // '') eq (canon($dev, $t) // '-')
$$_{"mp"} =~ s[(?<=.)/+\z][]r eq $t
$$_{"src"} eq $t
canon($dev, $$_{"src"})
MC/DC0%0/1
canon($dev, $t) // "-"
canon($dev, $t)
Truth table0%0/4
A or B || C
A= $$_{"mp"} =~ s[(?<=.)/+\z][]r eq $tB= $$_{"src"} eq $tC= canon($dev, $$_{"src"})
Truth table0%0/2
A
A= canon($dev, $t)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | return ( "mount: $t: can't find in /etc/fstab.", 0 ) unless $f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ( $src, $mp, $type ) = ( $f->{src}, $f->{mp}, $f->{type} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $opts = join ',', grep {defined} $f->{opts}, $opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | else { ( $src, $mp ) = @a[ 0, 1 ] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | my $e = _do_mount( $dev, $src, $mp, $type, $opts ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | ▶ | $e = "mount: $mp: can't find $src." if defined $e && $src =~ /\A(?:UUID|LABEL)=/i && $e =~ /special device/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $e and $src =~ /\A(?:UUID|LABEL)=/i and $e =~ /special device/
defined $e and $src =~ /\A(?:UUID|LABEL)=/i
MC/DC0%0/3
defined $e and $src =~ /\A(?:UUID|LABEL)=/i and $e =~ /special device/
defined $e
$src =~ /\A(?:UUID|LABEL)=/i
$e =~ /special device/
Truth table25%1/4
A and B and C
A= defined $eB= $src =~ /\A(?:UUID|LABEL)=/iC= $e =~ /special device/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | ▶ | return ( join( "\n", @hint, defined $e ? $e : () ), defined $e ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 4 | ▶ | sub umount { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
umount: called CC=11 SCAR=26.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 4 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 4 | my @a = grep { !/\A-/ } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 4 | ▶ | return ( 'umount: bad usage', 0 ) unless @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 4 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 4 | for my $t (@a) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 4 | ( my $x = $t ) =~ s{(?<=.)/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 4 | ▶ | my $m = $dev->{mounts} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table50%1/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 4 | ▶ | my ($mp) = grep { $_ eq $x || ( canon( $dev, $m->{$_}{dev} ) // '' ) eq ( canon( $dev, $x ) // '-' ) } sort keys %$m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition57%4/7
$_ eq $x || (canon($dev, $$m{$_}{'dev'}) // '') eq (canon($dev, $x) // '-')
canon($dev, $$m{$_}{"dev"}) // ""
canon($dev, $x) // "-"
MC/DC0%0/2
$_ eq $x || (canon($dev, $$m{$_}{'dev'}) // '') eq (canon($dev, $x) // '-')
$_ eq $x
canon($dev, $$m{$_}{"dev"})
MC/DC0%0/1
canon($dev, $x) // "-"
canon($dev, $x)
Truth table66%2/3
A || B
A= $_ eq $xB= canon($dev, $$m{$_}{"dev"})
Truth table50%1/2
A
A= canon($dev, $x)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | if ( !defined $mp ) { push @out, "umount: $t: not mounted."; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 4 | ▶ | return ( "umount: /: target is busy.", 0 ) if $mp eq '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 4 | my $e = _do_umount( $dev, $mp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 4 | ▶ | return ( $e, 0 ) if defined $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 3 | ▶ | return ( join( "\n", @out ), @out ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | ▶ | sub findmnt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findmnt: called CC=36 SCAR=56.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | my @a = grep { !/\A-/ } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | my %o = map { $_ => 1 } grep {/\A-/} @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | if ( $o{'--verify'} || $o{'-x'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$o{"--verify"} or $o{"-x"}
MC/DC0%0/2
$o{"--verify"} or $o{"-x"}
$o{"--verify"}
$o{"-x"}
Truth table33%1/3
A or B
A= $o{"--verify"}B= $o{"-x"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | my ( @l, $err, $warn ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | my @f = _fstab($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | for my $f (@f) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | my @m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 3 | ▶ | if ( $f->{type} eq 'swap' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | push( @m, " [E] unreachable source: $f->{src}" ), $err++ unless canon( $dev, $f->{src} ) || _L( '_file_entry', $dev, $f->{src} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
canon($dev, $$f{"src"}) or _L("_file_entry", $dev, $$f{"src"})
MC/DC0%0/2
canon($dev, $$f{"src"}) or _L("_file_entry", $dev, $$f{"src"})
canon($dev, $$f{"src"})
_L("_file_entry", $dev, $$f{"src"})
Truth table0%0/3
A or B
A= canon($dev, $$f{"src"})B= _L("_file_entry", $dev, $$f{"src"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 3 | my $c = canon( $dev, $f->{src} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 3 | ▶ | if ( !$c ) { push @m, " [E] unreachable source: $f->{src}: No such file or directory"; $err++ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ▶ | elsif ( $f->{type} ne 'auto' && ( _all($dev)->{$c}{fstype} // '' ) ne $f->{type} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$$f{"type"} ne "auto" and (_all($dev)->{$c}{"fstype"} // "") ne $$f{"type"}
_all($dev)->{$c}{"fstype"} // ""
MC/DC0%0/2
$$f{"type"} ne "auto" and (_all($dev)->{$c}{"fstype"} // "") ne $$f{"type"}
$$f{"type"} ne "auto"
_all($dev)->{$c}{"fstype"}
Truth table33%1/3
A and B
A= $$f{"type"} ne "auto"B= _all($dev)->{$c}{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | push @m, " [E] $f->{type} does not match with on-disk " . ( _all($dev)->{$c}{fstype} // 'unknown' ); $err++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_all($dev)->{$c}{"fstype"} // "unknown"
MC/DC0%0/1
_all($dev)->{$c}{"fstype"} // "unknown"
_all($dev)->{$c}{"fstype"}
Truth table0%0/2
A
A= _all($dev)->{$c}{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 3 | ▶ | if ( $f->{mp} =~ m{\A/} && !_L( '_is_dir', $dev, $f->{mp} ) ) { push @m, " [E] target does not exist"; $err++ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$$f{"mp"} =~ m[\A/] and not _L("_is_dir", $dev, $$f{"mp"})
MC/DC50%1/2
$$f{"mp"} =~ m[\A/] and not _L("_is_dir", $dev, $$f{"mp"})
$$f{"mp"} =~ m[\A/]
not _L("_is_dir", $dev, $$f{"mp"})
Truth table66%2/3
A and not(B)
A= $$f{"mp"} =~ m[\A/]B= not _L("_is_dir", $dev, $$f{"mp"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | if ( $f->{src} =~ m{\A/dev/(?:sd|vd|nvme|hd)} ) { push @m, " [W] recommended to use UUID= instead of $f->{src}"; $warn++ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | ▶ | push @l, $f->{mp}, @m if @m || $o{'--verbose'} || $o{'-v'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
@m or $o{"--verbose"} or $o{"-v"}
@m or $o{"--verbose"}
MC/DC33%1/3
@m or $o{"--verbose"} or $o{"-v"}
@m
$o{"--verbose"}
$o{"-v"}
Truth table50%2/4
A or B or C
A= @mB= $o{"--verbose"}C= $o{"-v"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 1 | ▶ | push @l, '', sprintf( '0 parse errors, %d error%s, %d warning%s', $err // 0, ( $err // 0 ) == 1 ? '' : 's', $warn // 0, ( $warn // 0 ) == 1 ? '' : 's' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%4/8
$err // 0
$err // 0
$warn // 0
$warn // 0
MC/DC0%0/1
$err // 0
$err
MC/DC0%0/1
$err // 0
$err
MC/DC0%0/1
$warn // 0
$warn
MC/DC0%0/1
$warn // 0
$warn
Truth table50%1/2
A
A= $err
Truth table50%1/2
A
A= $err
Truth table50%1/2
A
A= $warn
Truth table50%1/2
A
A= $warn
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | return ( join( "\n", grep {defined} @l ), $err ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if ( $o{'-s'} || $o{'--fstab'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$o{"-s"} or $o{"--fstab"}
MC/DC0%0/2
$o{"-s"} or $o{"--fstab"}
$o{"-s"}
$o{"--fstab"}
Truth table0%0/3
A or B
A= $o{"-s"}B= $o{"--fstab"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my @l = sprintf( '%-20s %-40s %-6s %s', qw( TARGET SOURCE FSTYPE OPTIONS ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | push @l, sprintf( '%-20s %-40s %-6s %s', $_->{mp}, $_->{src}, $_->{type}, $_->{opts} ) for _fstab($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | my $m = $dev->{mounts} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table0%0/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my @mps = sort keys %$m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $t = $a[0] =~ s{(?<=.)/+\z}{}r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | @mps = grep { $_ eq $t || ( canon( $dev, $m->{$_}{dev} ) // '' ) eq ( canon( $dev, $t ) // '-' ) } @mps; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/7
$_ eq $t || (canon($dev, $$m{$_}{'dev'}) // '') eq (canon($dev, $t) // '-')
canon($dev, $$m{$_}{"dev"}) // ""
canon($dev, $t) // "-"
MC/DC0%0/2
$_ eq $t || (canon($dev, $$m{$_}{'dev'}) // '') eq (canon($dev, $t) // '-')
$_ eq $t
canon($dev, $$m{$_}{"dev"})
MC/DC0%0/1
canon($dev, $t) // "-"
canon($dev, $t)
Truth table0%0/3
A || B
A= $_ eq $tB= canon($dev, $$m{$_}{"dev"})
Truth table0%0/2
A
A= canon($dev, $t)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | return ( '', 0 ) unless @mps; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | return ( join( "\n", sprintf( '%-20s %-28s %-6s %s', qw( TARGET SOURCE FSTYPE OPTIONS ) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | map { sprintf '%-20s %-28s %-6s %s', $_, $m->{$_}{dev}, $m->{$_}{fstype} // 'ext4', $m->{$_}{opts} // 'rw,relatime' } @mps ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$m{$_}{"fstype"} // "ext4"
$$m{$_}{"opts"} // "rw,relatime"
MC/DC0%0/1
$$m{$_}{"fstype"} // "ext4"
$$m{$_}{"fstype"}
MC/DC0%0/1
$$m{$_}{"opts"} // "rw,relatime"
$$m{$_}{"opts"}
Truth table0%0/2
A
A= $$m{$_}{"fstype"}
Truth table0%0/2
A
A= $$m{$_}{"opts"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # --- lsblk, blkid ------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | ▶ | sub lsblk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lsblk: called CC=32 SCAR=36.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | my ( $o, $err ) = _L( '_lsblk_opts', $av ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 2 | ▶ | return ( $err, 0 ) if defined $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if ( !$o ) { push @Langertha::Holmgang::Sim::Linux::GAPS, join( ' ', 'lsblk', @$av ); return ( '', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 2 | my $f = $o->{f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 2 | my $all = _all($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | my %kids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 2 | ▶ | my $d = $s->{disks} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'disks'} || {}
MC/DC0%0/1
$$s{'disks'} || {}
$$s{'disks'}
Truth table50%1/2
A
A= $$s{'disks'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | ▶ | for my $p ( keys %$d ) { push @{ $kids{ $d->{$p}{parent} } }, $p if $d->{$p}{parent} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | ▶ | for my $vg ( keys %{ $s->{vgs} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'} || {}
MC/DC0%0/1
$$s{'vgs'} || {}
$$s{'vgs'}
Truth table50%1/2
A
A= $$s{'vgs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | ▶ | for my $pvx ( @{ $s->{vgs}{$vg}{pvs} || [] } ) { push @{ $kids{$pvx} }, map {"/dev/mapper/$vg-$_"} sort keys %{ $s->{vgs}{$vg}{lvs} || {} } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$s{'vgs'}{$vg}{'pvs'} || []
$$s{'vgs'}{$vg}{'lvs'} || {}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'pvs'} || []
$$s{'vgs'}{$vg}{'pvs'}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'lvs'} || {}
$$s{'vgs'}{$vg}{'lvs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'pvs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'lvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | ▶ | for my $md ( keys %{ $s->{md} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'md'} || {}
MC/DC0%0/1
$$s{'md'} || {}
$$s{'md'}
Truth table50%1/2
A
A= $$s{'md'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 2 | ▶ | for my $mem ( keys %{ $s->{md}{$md}{members} || {} } ) { push @{ $kids{$mem} }, $md if ( $s->{md}{$md}{members}{$mem} // '' ) ne 'removed' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$s{'md'}{$md}{'members'} || {}
$$s{"md"}{$md}{"members"}{$mem} // ""
MC/DC0%0/1
$$s{'md'}{$md}{'members'} || {}
$$s{'md'}{$md}{'members'}
MC/DC0%0/1
$$s{"md"}{$md}{"members"}{$mem} // ""
$$s{"md"}{$md}{"members"}{$mem}
Truth table50%1/2
A
A= $$s{'md'}{$md}{'members'}
Truth table50%1/2
A
A= $$s{"md"}{$md}{"members"}{$mem}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | my %swap = map { $_->{name} => 1 } @{ $s->{swaps} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'swaps'} || []
MC/DC0%0/1
$$s{'swaps'} || []
$$s{'swaps'}
Truth table50%1/2
A
A= $$s{'swaps'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | my %row = map { $_->{mount} => $_ } _L( '_df_rows', $dev ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | my @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | my $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 16 | ▶ | $line = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=16 SCAR=28.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 16 | my ( $p, $pre, $last, $depth ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 16 | ▶ | my $e = $all->{$p} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$all{$p} || {}
MC/DC0%0/1
$$all{$p} || {}
$$all{$p}
Truth table50%1/2
A
A= $$all{$p}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 16 | ( my $name = $p ) =~ s{\A/dev/(?:mapper/)?}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 16 | ▶ | my @mp = ( _mounted_at( $dev, $p ), $swap{$p} ? '[SWAP]' : () ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 16 | ▶ | my $r = @mp && $row{ $mp[0] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
@mp && $row{$mp[0]}
MC/DC50%1/2
@mp && $row{$mp[0]}
@mp
$row{$mp[0]}
Truth table66%2/3
A && B
A= @mpB= $row{$mp[0]}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | push @rows, { name => $name, path => $p, tree => $depth ? $pre . ( $last ? '└─' : '├─' ) : '', majmin => '254:0', size => _b( $e->{size} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | type => $p =~ m{/mapper/} ? 'lvm' : $p =~ m{/md\d} ? ( $e->{level} // 'raid1' ) : $e->{parent} ? 'part' : 'disk', mps => \@mp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 16 | ▶ | fstype => $e->{fstype}, label => $e->{label}, uuid => $e->{uuid}, fsavail => $r ? $r->{avail} : undef, fsuse => $r ? $r->{pct} : undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
Condition50%1/2
$$e{"level"} // "raid1"
MC/DC0%0/1
$$e{"level"} // "raid1"
$$e{"level"}
Truth table50%1/2
A
A= $$e{"level"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 16 | ▶ | my @k = sort @{ $kids{$p} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$kids{$p} || []
MC/DC100%1/1
$kids{$p} || []
$kids{$p}
Truth table100%2/2
A
A= $kids{$p}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 16 | ▶ | for my $i ( 0 .. $#k ) { $line->( $k[$i], $depth ? $pre . ( $last ? ' ' : '│ ' ) : '', $i == $#k, $depth + 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | my @top = grep { !$d->{$_}{parent} } sort keys %$d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 2 | my ($want) = @{ $o->{dev} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | ▶ | @top = grep { $_ eq ( canon( $dev, $want ) // '' ) } keys %$all if defined $want; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
canon($dev, $want) // ""
MC/DC0%0/1
canon($dev, $want) // ""
canon($dev, $want)
Truth table50%1/2
A
A= canon($dev, $want)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | ▶ | return ( "lsblk: $want: not a block device", 0 ) if defined $want && !@top; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $want and not @top
MC/DC0%0/2
defined $want and not @top
defined $want
not @top
Truth table66%2/3
A and not(B)
A= defined $wantB= not @top
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | $line->( $_, '', 1, 0 ) for @top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | ▶ | return ( _L( '_lsblk_table', \@rows, $o ), 1 ) if $o->{table}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | ▶ | my @l = $f ? sprintf( '%-20s %-11s %-6s %-37s %6s %4s %s', 'NAME', 'FSTYPE', 'LABEL', 'UUID', 'FSAVAIL', 'FSUSE%', 'MOUNTPOINTS' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | : sprintf( '%-20s %7s %2s %6s %2s %-5s %s', 'NAME', 'MAJ:MIN', 'RM', 'SIZE', 'RO', 'TYPE', 'MOUNTPOINTS' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 1 | for my $r (@rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | push @l, $f | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | ? sprintf( '%-20s %-11s %-6s %-37s %6s %4s %s', $r->{tree} . $r->{name}, $r->{fstype} // '', $r->{label} // '', $r->{uuid} // '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 15 | defined $r->{fsavail} ? _h( $r->{fsavail} ) : '', defined $r->{fsuse} ? "$r->{fsuse}%" : '', join( ' ', @{ $r->{mps} } ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | : sprintf( '%-20s %7s %2d %6s %2d %-5s %s', $r->{tree} . $r->{name}, $r->{majmin}, 0, _h( $r->{size} ), 0, $r->{type}, join( ' ', @{ $r->{mps} } ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%6/6
$$r{"fstype"} // ""
$$r{"label"} // ""
$$r{"uuid"} // ""
MC/DC100%1/1
$$r{"fstype"} // ""
$$r{"fstype"}
MC/DC100%1/1
$$r{"label"} // ""
$$r{"label"}
MC/DC100%1/1
$$r{"uuid"} // ""
$$r{"uuid"}
Truth table100%2/2
A
A= $$r{"fstype"}
Truth table100%2/2
A
A= $$r{"label"}
Truth table100%2/2
A
A= $$r{"uuid"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | ▶ | sub blkid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
blkid: called CC=10 SCAR=25.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 1 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 1 | my $all = _all($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | my @want = grep { !/\A-/ } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | my @p = @want ? map { canon( $dev, $_ ) // () } @want : grep { $all->{$_}{fstype} } sort keys %$all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
canon($dev, $_) // ()
MC/DC0%0/2
canon($dev, $_) // ()
canon($dev, $_)
()
Truth table33%1/3
A // B
A= canon($dev, $_)B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 1 | ▶ | return ( '', 0 ) unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | my @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | for my $p (@p) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 1 | my $e = $all->{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | ▶ | next unless $e->{fstype}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | push @l, "$p: " . join( ' ', ( defined $e->{label} ? qq{LABEL="$e->{label}"} : () ), ( defined $e->{uuid} ? qq{UUID="$e->{uuid}"} : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | ▶ | ( $e->{fstype} =~ /ext|xfs/ ? 'BLOCK_SIZE="4096"' : () ), qq{TYPE="$e->{fstype}"} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 1 | ▶ | return ( join( "\n", @l ), @l ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # --- LVM --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 7 | ▶ | sub lvm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lvm: called CC=92 SCAR=70.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 7 | my ( $dev, $av, $ctx, $prog ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 7 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 7 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 7 | ▶ | if ( $prog eq 'pvs' || $prog eq 'pvdisplay' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$prog eq "pvs" or $prog eq "pvdisplay"
MC/DC0%0/2
$prog eq "pvs" or $prog eq "pvdisplay"
$prog eq "pvs"
$prog eq "pvdisplay"
Truth table33%1/3
A or B
A= $prog eq "pvs"B= $prog eq "pvdisplay"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | my @l = sprintf( ' %-10s %-5s %-4s %-5s %8s %8s', qw( PV VG Fmt Attr PSize PFree ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | for my $p ( sort grep { ( $s->{disks}{$_}{fstype} // '' ) eq 'LVM2_member' } keys %{ $s->{disks} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$s{"disks"}{$_}{"fstype"} // ""
$$s{'disks'} || {}
MC/DC0%0/1
$$s{"disks"}{$_}{"fstype"} // ""
$$s{"disks"}{$_}{"fstype"}
MC/DC0%0/1
$$s{'disks'} || {}
$$s{'disks'}
Truth table0%0/2
A
A= $$s{"disks"}{$_}{"fstype"}
Truth table0%0/2
A
A= $$s{'disks'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | my $vg = _vg_of_pv( $dev, $p ) // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_vg_of_pv($dev, $p) // ""
MC/DC0%0/1
_vg_of_pv($dev, $p) // ""
_vg_of_pv($dev, $p)
Truth table0%0/2
A
A= _vg_of_pv($dev, $p)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | my $free = $vg ? ( _vg_size( $dev, $vg ) )[1] : _b( $s->{disks}{$p}{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | $free = _b( $s->{disks}{$p}{size} ) if $free > _b( $s->{disks}{$p}{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | push @l, sprintf( ' %-10s %-5s %-4s %-5s %8s %8s', $p, $vg, 'lvm2', $vg ? 'a--' : '---', _g( _b( $s->{disks}{$p}{size} ) ), _g($free) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 7 | ▶ | if ( $prog eq 'vgs' || $prog eq 'vgdisplay' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$prog eq "vgs" or $prog eq "vgdisplay"
MC/DC50%1/2
$prog eq "vgs" or $prog eq "vgdisplay"
$prog eq "vgs"
$prog eq "vgdisplay"
Truth table66%2/3
A or B
A= $prog eq "vgs"B= $prog eq "vgdisplay"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | my @l = sprintf( ' %-5s %3s %3s %3s %-6s %8s %8s', 'VG', '#PV', '#LV', '#SN', 'Attr', 'VSize', 'VFree' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 1 | ▶ | for my $vg ( sort keys %{ $s->{vgs} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'} || {}
MC/DC0%0/1
$$s{'vgs'} || {}
$$s{'vgs'}
Truth table50%1/2
A
A= $$s{'vgs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | my ( $size, $free ) = _vg_size( $dev, $vg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 1 | ▶ | my $lvs = $s->{vgs}{$vg}{lvs} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'}{$vg}{'lvs'} || {}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'lvs'} || {}
$$s{'vgs'}{$vg}{'lvs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'lvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 1 | ▶ | push @l, sprintf( ' %-5s %3d %3d %3d %-6s %8s %8s', $vg, scalar @{ $s->{vgs}{$vg}{pvs} || [] }, scalar( grep { !$lvs->{$_}{origin} } keys %$lvs ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'vgs'}{$vg}{'pvs'} || []
MC/DC0%0/1
$$s{'vgs'}{$vg}{'pvs'} || []
$$s{'vgs'}{$vg}{'pvs'}
Truth table50%1/2
A
A= $$s{'vgs'}{$vg}{'pvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | scalar( grep { $lvs->{$_}{origin} } keys %$lvs ), 'wz--n-', _g($size), _g($free) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 1 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 6 | ▶ | if ( $prog eq 'lvs' || $prog eq 'lvdisplay' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$prog eq "lvs" or $prog eq "lvdisplay"
MC/DC0%0/2
$prog eq "lvs" or $prog eq "lvdisplay"
$prog eq "lvs"
$prog eq "lvdisplay"
Truth table33%1/3
A or B
A= $prog eq "lvs"B= $prog eq "lvdisplay"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my @l = sprintf( ' %-16s %-5s %-10s %8s %-8s', qw( LV VG Attr LSize Origin ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | for my $vg ( sort keys %{ $s->{vgs} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$s{'vgs'} || {}
MC/DC0%0/1
$$s{'vgs'} || {}
$$s{'vgs'}
Truth table0%0/2
A
A= $$s{'vgs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | my $lvs = $s->{vgs}{$vg}{lvs} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$s{'vgs'}{$vg}{'lvs'} || {}
MC/DC0%0/1
$$s{'vgs'}{$vg}{'lvs'} || {}
$$s{'vgs'}{$vg}{'lvs'}
Truth table0%0/2
A
A= $$s{'vgs'}{$vg}{'lvs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | push @l, sprintf( ' %-16s %-5s %-10s %8s %-8s', $_, $vg, $lvs->{$_}{origin} ? 'swi-a-s---' : '-wi-ao----', _g( _b( $lvs->{$_}{size} ) ), $lvs->{$_}{origin} // '' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | for sort keys %$lvs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$lvs{$_}{"origin"} // ""
MC/DC0%0/1
$$lvs{$_}{"origin"} // ""
$$lvs{$_}{"origin"}
Truth table0%0/2
A
A= $$lvs{$_}{"origin"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 6 | my @args = grep { !/\A-/ } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 6 | ▶ | if ( $prog eq 'pvcreate' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 2 | my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 2 | for my $p (@args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 2 | my $c = canon( $dev, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2 | ▶ | my $e = $c && $s->{disks}{$c}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$c && $$s{'disks'}{$c}
MC/DC0%0/2
$c && $$s{'disks'}{$c}
$c
$$s{'disks'}{$c}
Truth table33%1/3
A && B
A= $cB= $$s{'disks'}{$c}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 2 | ▶ | return ( " No device found for $p.", 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | return ( " Can't open $p exclusively. Mounted filesystem?", 0 ) if _mounted_at( $dev, $c ) || grep { _mounted_at( $dev, $_ ) } _parts( $dev, $c ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
_mounted_at($dev, $c) or grep {_mounted_at($dev, $_);} _parts($dev, $c)
MC/DC50%1/2
_mounted_at($dev, $c) or grep {_mounted_at($dev, $_);} _parts($dev, $c)
_mounted_at($dev, $c)
grep {_mounted_at($dev, $_);} _parts($dev, $c)
Truth table66%2/3
A or B
A= _mounted_at($dev, $c)B= grep {_mounted_at($dev, $_);} _parts($dev, $c)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | ▶ | return ( " Cannot use $p: device is partitioned", 0 ) if _parts( $dev, $c ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | if ( defined $e->{fstype} && $e->{fstype} ne 'LVM2_member' && !grep { /\A-(?:f|ff|y|\w*f)\z/ } @a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $$e{"fstype"} and $$e{"fstype"} ne "LVM2_member" and not grep({/\A-(?:f|ff|y|\w*f)\z/;} @a)
defined $$e{"fstype"} and $$e{"fstype"} ne "LVM2_member"
MC/DC0%0/3
defined $$e{"fstype"} and $$e{"fstype"} ne "LVM2_member" and not grep({/\A-(?:f|ff|y|\w*f)\z/;} @a)
defined $$e{"fstype"}
$$e{"fstype"} ne "LVM2_member"
not grep({/\A-(?:f|ff|y|\w*f)\z/;} @a)
Truth table25%1/4
A and B and not(C)
A= defined $$e{"fstype"}B= $$e{"fstype"} ne "LVM2_member"C= not grep({/\A-(?:f|ff|y|\w*f)\z/;} @a)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return ( "WARNING: $e->{fstype} signature detected on $p at offset 1080. Wipe it? [y/n]: [n]\n Aborted wiping of $e->{fstype}.\n 1 existing signature left on the device.", 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 1 | ▶ | return ( " Can't initialize physical volume \"$p\" of volume group \"" . _vg_of_pv( $dev, $c ) . "\" without -ff", 0 ) if _vg_of_pv( $dev, $c ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | $e->{fstype} = 'LVM2_member'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 1 | delete @{$e}{qw( uuid label offline fssize )}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | $e->{uuid} = _uuid( $dev, $c, 'pv' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | push @o, " Physical volume \"$p\" successfully created."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 1 | return ( join( "\n", @o ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 4 | ▶ | if ( $prog eq 'vgextend' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | my ( $vg, @pvs ) = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | ▶ | return ( " Volume group \"" . ( $vg // '' ) . "\" not found", 0 ) unless defined $vg && $s->{vgs}{$vg}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
defined $vg and $$s{"vgs"}{$vg}
$vg // ""
MC/DC0%0/2
defined $vg and $$s{"vgs"}{$vg}
defined $vg
$$s{"vgs"}{$vg}
MC/DC0%0/1
$vg // ""
$vg
Truth table33%1/3
A and B
A= defined $vgB= $$s{"vgs"}{$vg}
Truth table0%0/2
A
A= $vg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 1 | my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 1 | for my $p (@pvs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 1 | my $c = canon( $dev, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | ▶ | my $e = $c && $s->{disks}{$c}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$c && $$s{'disks'}{$c}
MC/DC0%0/2
$c && $$s{'disks'}{$c}
$c
$$s{'disks'}{$c}
Truth table33%1/3
A && B
A= $cB= $$s{'disks'}{$c}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 1 | ▶ | return ( " No device found for $p.", 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 1 | ▶ | if ( ( $e->{fstype} // '' ) ne 'LVM2_member' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$e{"fstype"} // ""
MC/DC0%0/1
$$e{"fstype"} // ""
$$e{"fstype"}
Truth table50%1/2
A
A= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 1 | my ( $o, $ok ) = lvm( $dev, [ $p, grep {/\A-/} @a ], $ctx, 'pvcreate' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 1 | ▶ | return ( $o, 0 ) unless $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 1 | push @o, $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 1 | my $other = _vg_of_pv( $dev, $c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 1 | ▶ | return ( " Physical volume '$p' is already in volume group '$other'", 0 ) if $other; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 1 | push @{ $s->{vgs}{$vg}{pvs} }, $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | push @o, " Volume group \"$vg\" successfully extended"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | return ( join( "\n", @o ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 3 | ▶ | if ( $prog =~ /\Alv(?:extend|resize|create)\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 3 | my ( $size, $ext, $name, $snap, $resize ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 3 | my @w = @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 3 | my @pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 3 | ▶ | while (@w) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 7 | my $x = shift @w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 7 | ▶ | if ( $x =~ /\A(?:-L|--size)(?:=?(.+))?\z/ ) { $size = $1 // shift @w } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition33%1/3
$1 // shift @w
MC/DC0%0/2
$1 // shift @w
$1
shift @w
Truth table33%1/3
A // B
A= $1B= shift @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 1 | ▶ | elsif ( $x =~ /\A(?:-l|--extents)(?:=?(.+))?\z/ ) { $ext = $1 // shift @w } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$1 // shift @w
MC/DC0%0/2
$1 // shift @w
$1
shift @w
Truth table33%1/3
A // B
A= $1B= shift @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | elsif ( $x =~ /\A(?:-n|--name)(?:=?(.+))?\z/ ) { $name = $1 // shift @w } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$1 // shift @w
MC/DC0%0/2
$1 // shift @w
$1
shift @w
Truth table0%0/3
A // B
A= $1B= shift @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | elsif ( $x eq '-s' || $x eq '--snapshot' ) { $snap = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$x eq "-s" or $x eq "--snapshot"
MC/DC0%0/2
$x eq "-s" or $x eq "--snapshot"
$x eq "-s"
$x eq "--snapshot"
Truth table33%1/3
A or B
A= $x eq "-s"B= $x eq "--snapshot"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 1 | ▶ | elsif ( $x eq '-r' || $x eq '--resizefs' ) { $resize = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$x eq "-r" or $x eq "--resizefs"
MC/DC50%1/2
$x eq "-r" or $x eq "--resizefs"
$x eq "-r"
$x eq "--resizefs"
Truth table66%2/3
A or B
A= $x eq "-r"B= $x eq "--resizefs"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | elsif ( $x =~ /\A-/ ) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 3 | else { push @pos, $x } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 3 | ▶ | if ( $prog eq 'lvcreate' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | my $target = shift @pos // return ( ' Please specify a volume group or logical volume', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @pos // (return " Please specify a volume group or logical volume", 0)
MC/DC0%0/1
shift @pos // (return " Please specify a volume group or logical volume", 0)
shift @pos
Truth table0%0/2
A
A= shift @pos
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | my ( $vg, $origin ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | if ($snap) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | my $c = canon( $dev, $target ) // return ( " Failed to find logical volume \"$target\"", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
canon($dev, $target) // (return qq[ Failed to find logical volume "$target"], 0)
MC/DC0%0/1
canon($dev, $target) // (return qq[ Failed to find logical volume "$target"], 0)
canon($dev, $target)
Truth table0%0/2
A
A= canon($dev, $target)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | ( $vg, $origin ) = $c =~ m{\A/dev/mapper/([\w.]+)-(.+)\z} or return ( " Failed to find logical volume \"$target\"", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | else { $vg = $target; return ( " Volume group \"$vg\" not found", 0 ) unless $s->{vgs}{$vg} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | return ( ' Please specify a name.', 0 ) if !defined $name && $snap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $name and $snap
MC/DC0%0/2
not defined $name and $snap
not defined $name
$snap
Truth table0%0/3
not(A) and B
A= not defined $nameB= $snap
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | $name //= 'lvol0'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$name //= "lvol0"
MC/DC0%0/1
$name //= "lvol0"
$name
Truth table0%0/2
A
A= $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | return ( " Logical Volume \"$name\" already exists in volume group \"$vg\"", 0 ) if $s->{vgs}{$vg}{lvs}{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my ( $vsize, $free ) = _vg_size( $dev, $vg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | my $want = defined $size ? _b( $size =~ s/i?B\z//ir ) : defined $ext && $ext =~ /\A(\d+)%FREE\z/i ? int( $free * $1 / 100 ) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $ext and $ext =~ /\A(\d+)%FREE\z/i
MC/DC0%0/2
defined $ext and $ext =~ /\A(\d+)%FREE\z/i
defined $ext
$ext =~ /\A(\d+)%FREE\z/i
Truth table0%0/3
A and B
A= defined $extB= $ext =~ /\A(\d+)%FREE\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | return ( ' Please specify either size or extents.', 0 ) unless $want; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | return ( sprintf( " Volume group \"%s\" has insufficient free space (%d extents): %d required.", $vg, $free / 4194304, $want / 4194304 ), 0 ) if $want > $free; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | $s->{vgs}{$vg}{lvs}{$name} = { size => _h($want), ( $snap ? ( origin => $origin ) : () ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | return ( " Logical volume \"$name\" created.", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 3 | ▶ | my $target = shift @pos // return ( ' Please specify a logical volume path.', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @pos // (return " Please specify a logical volume path.", 0)
MC/DC0%0/1
shift @pos // (return " Please specify a logical volume path.", 0)
shift @pos
Truth table50%1/2
A
A= shift @pos
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 3 | ▶ | my $c = canon( $dev, $target ) // return ( " Failed to find logical volume \"$target\"", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
canon($dev, $target) // (return qq[ Failed to find logical volume "$target"], 0)
MC/DC0%0/1
canon($dev, $target) // (return qq[ Failed to find logical volume "$target"], 0)
canon($dev, $target)
Truth table50%1/2
A
A= canon($dev, $target)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 3 | ▶ | my ( $vg, $lv ) = $c =~ m{\A/dev/mapper/([\w.]+)-(.+)\z} or return ( " Failed to find logical volume \"$target\"", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 3 | my $e = $s->{vgs}{$vg}{lvs}{$lv}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 3 | my $old = _b( $e->{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 3 | my ( $vsize, $free ) = _vg_size( $dev, $vg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 3 | my $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 3 | ▶ | if ( defined $size ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 2 | my ($rel) = $size =~ /\A([+-]?)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 2 | ( my $v = $size ) =~ s/\A[+-]//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 2 | $v =~ s/i?B\z//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 2 | ▶ | $new = $rel eq '+' ? $old + _b($v) : $rel eq '-' ? $old - _b($v) : _b($v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 1 | ▶ | elsif ( defined $ext && $ext =~ /\A\+?(\d+)%(FREE|VG)\z/i ) { $new = $old + int( ( uc $2 eq 'FREE' ? $free : $vsize ) * $1 / 100 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $ext and $ext =~ /\A\+?(\d+)%(FREE|VG)\z/i
MC/DC0%0/2
defined $ext and $ext =~ /\A\+?(\d+)%(FREE|VG)\z/i
defined $ext
$ext =~ /\A\+?(\d+)%(FREE|VG)\z/i
Truth table33%1/3
A and B
A= defined $extB= $ext =~ /\A\+?(\d+)%(FREE|VG)\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | else { return ( ' Please specify either size or extents but not both.', 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 3 | ▶ | return ( " New size given (" . int( $new / 4194304 ) . " extents) not larger than existing size (" . int( $old / 4194304 ) . " extents)", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$prog eq "lvextend" and $new <= $old
MC/DC0%0/2
$prog eq "lvextend" and $new <= $old
$prog eq "lvextend"
$new <= $old
Truth table33%1/3
A and B
A= $prog eq "lvextend"B= $new <= $old
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | if $prog eq 'lvextend' && $new <= $old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 3 | ▶ | return ( " Insufficient free space: " . int( ( $new - $old ) / 4194304 ) . " extents needed, but only " . int( $free / 4194304 ) . " available", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | if $new - $old > $free; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | return ( " WARNING: Reducing active and open logical volume to " . _gib($new) . ".\n THIS MAY DESTROY YOUR DATA (filesystem etc.)\nDo you really want to reduce $vg/$lv? [y/n]: [n]\n Logical volume $vg/$lv NOT reduced.", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | if $new < $old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | $e->{size} = _h($new); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 2 | my @o = ( " Size of logical volume $vg/$lv changed from " . _gib($old) . ' (' . int( $old / 4194304 ) . ' extents) to ' . _gib($new) . ' (' . int( $new / 4194304 ) . ' extents).', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | " Logical volume $vg/$lv successfully resized." ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 2 | ▶ | if ($resize) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 1 | my ($mp) = _mounted_at( $dev, $c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | ▶ | my ( $ro, $rok ) = ( $e->{fstype} // '' ) eq 'xfs' ? xfs_growfs( $dev, [ $mp // $c ] ) : resize2fs( $dev, [$c] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$$e{"fstype"} // ""
$mp // $c
MC/DC0%0/1
$$e{"fstype"} // ""
$$e{"fstype"}
MC/DC0%0/2
$mp // $c
$mp
$c
Truth table50%1/2
A
A= $$e{"fstype"}
Truth table0%0/3
A // B
A= $mpB= $c
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 1 | push @o, $ro; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | return ( join( "\n", @o ), $rok ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | return ( join( "\n", @o ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 3 | ▶ | sub _uuid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_uuid: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 3 | my ( $dev, $c, $salt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 3 | require Digest::SHA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 3 | ▶ | my $h = Digest::SHA::sha1_hex( join '|', $dev->{hostname} // '', $c, $salt, scalar keys %{ _all($dev) } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{"hostname"} // ""
MC/DC0%0/1
$$dev{"hostname"} // ""
$$dev{"hostname"}
Truth table50%1/2
A
A= $$dev{"hostname"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 3 | ▶ | return $salt eq 'pv' ? join( '-', substr( $h, 0, 6 ), substr( $h, 6, 4 ), substr( $h, 10, 4 ), substr( $h, 14, 4 ), substr( $h, 18, 4 ), substr( $h, 22, 4 ), substr( $h, 26, 6 ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | : join( '-', substr( $h, 0, 8 ), substr( $h, 8, 4 ), substr( $h, 12, 4 ), substr( $h, 16, 4 ), substr( $h, 20, 12 ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # --- Dateisysteme ------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 3 | ▶ | sub _grow { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_grow: called CC=4 SCAR=17.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 3 | my ( $dev, $c, $e, $to ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 3 | my @mp = _mounted_at( $dev, $c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 3 | ▶ | if (@mp) { $dev->{mounts}{$_}{size} = _h($to) for @mp; delete $e->{fssize} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | else { if ( $to == _b( $e->{size} ) ) { delete $e->{fssize} } else { $e->{fssize} = _h($to) } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 3 | return @mp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 3 | ▶ | sub resize2fs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resize2fs: called CC=13 SCAR=28.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 3 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 3 | my @a = grep { !/\A-/ } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 3 | my ( $p, $want ) = @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 3 | ▶ | return ( "Usage: resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [-b|-s|new_size] [-S RAID-stride] [-z undo_file]", 0 ) unless defined $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 3 | my ( $c, $e ) = _bd( $dev, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 3 | ▶ | return ( "resize2fs 1.47.0 (5-Feb-2023)\nopen: No such file or directory while opening $p", 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | return ( "resize2fs 1.47.0 (5-Feb-2023)\nresize2fs: Bad magic number in super-block while trying to open $p\nCouldn't find valid filesystem superblock.", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 3 | ▶ | unless ( $e->{fstype} // '' ) =~ /\Aext[234]\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$e{"fstype"} // ""
MC/DC0%0/1
$$e{"fstype"} // ""
$$e{"fstype"}
Truth table50%1/2
A
A= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 2 | my @mp = _mounted_at( $dev, $c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 2 | ▶ | my $cur = @mp ? _b( $dev->{mounts}{ $mp[0] }{size} ) : _fssize($e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 2 | ▶ | my $to = defined $want ? _b( $want =~ s/i?B\z//ir ) : _b( $e->{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 2 | ▶ | my $blocks = sub { int( $_[0] / 4096 ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | return ( "resize2fs 1.47.0 (5-Feb-2023)\nThe containing partition (or device) is only " . $blocks->( _b( $e->{size} ) ) . " (4k) blocks.\nYou requested a new size of " . $blocks->($to) . " blocks.\n", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 2 | ▶ | if $to > _b( $e->{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 2 | ▶ | return ( "resize2fs 1.47.0 (5-Feb-2023)\nThe filesystem is already " . $blocks->($cur) . " (4k) blocks long. Nothing to do!\n", 1 ) if $to == $cur; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 2 | ▶ | return ( "resize2fs 1.47.0 (5-Feb-2023)\nFilesystem at $c is mounted on $mp[0]; on-line resizing required\nresize2fs: On-line shrinking not supported", 0 ) if $to < $cur && @mp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$to < $cur and @mp
MC/DC0%0/2
$to < $cur and @mp
$to < $cur
@mp
Truth table33%1/3
A and B
A= $to < $curB= @mp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 2 | ▶ | return ( "resize2fs 1.47.0 (5-Feb-2023)\nPlease run 'e2fsck -f $p' first.\n", 0 ) if $to < $cur; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 2 | _grow( $dev, $c, $e, $to ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 2 | ▶ | return ( "resize2fs 1.47.0 (5-Feb-2023)\n" . ( @mp ? "Filesystem at $c is mounted on $mp[0]; on-line resizing required\nold_desc_blocks = 3, new_desc_blocks = 4\n" : "Resizing the filesystem on $c to " . $blocks->($to) . " (4k) blocks.\n" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | . "The filesystem on $c is now " . $blocks->($to) . " (4k) blocks long.\n", 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1 | ▶ | sub xfs_growfs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xfs_growfs: called CC=11 SCAR=26.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 1 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1 | my ($t) = grep { !/\A-/ } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | ▶ | return ( "Usage: xfs_growfs [options] mountpoint", 0 ) unless defined $t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 1 | $t =~ s{(?<=.)/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1 | ▶ | my $m = $dev->{mounts} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'mounts'} || {}
MC/DC0%0/1
$$dev{'mounts'} || {}
$$dev{'mounts'}
Truth table50%1/2
A
A= $$dev{'mounts'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 1 | ▶ | my ($mp) = grep { $_ eq $t || ( canon( $dev, $m->{$_}{dev} ) // '' ) eq ( canon( $dev, $t ) // '-' ) } sort keys %$m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition57%4/7
$_ eq $t || (canon($dev, $$m{$_}{'dev'}) // '') eq (canon($dev, $t) // '-')
canon($dev, $$m{$_}{"dev"}) // ""
canon($dev, $t) // "-"
MC/DC0%0/2
$_ eq $t || (canon($dev, $$m{$_}{'dev'}) // '') eq (canon($dev, $t) // '-')
$_ eq $t
canon($dev, $$m{$_}{"dev"})
MC/DC0%0/1
canon($dev, $t) // "-"
canon($dev, $t)
Truth table66%2/3
A || B
A= $_ eq $tB= canon($dev, $$m{$_}{"dev"})
Truth table50%1/2
A
A= canon($dev, $t)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 1 | ▶ | my ( $c, $e ) = defined $mp ? _bd( $dev, $m->{$mp}{dev} ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 1 | ▶ | return ( "xfs_growfs: $t is not a mounted XFS filesystem", 0 ) unless $e && ( $e->{fstype} // '' ) eq 'xfs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$e and ($$e{"fstype"} // "") eq "xfs"
$$e{"fstype"} // ""
MC/DC0%0/2
$e and ($$e{"fstype"} // "") eq "xfs"
$e
$$e{"fstype"}
Truth table33%1/3
A and B
A= $eB= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 1 | my $old = _b( $m->{$mp}{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | my $new = _b( $e->{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 1 | my $info = "meta-data=$c isize=512 agcount=4, agsize=" . int( $old / 16384 ) . " blks\ndata = bsize=4096 blocks=" . int( $old / 4096 ) . ", imaxpct=25"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 1 | ▶ | return ( "$info\n", 1 ) if $new <= $old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 1 | _grow( $dev, $c, $e, $new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 1 | return ( "$info\ndata blocks changed from " . int( $old / 4096 ) . ' to ' . int( $new / 4096 ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 3 | ▶ | sub mkfs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkfs: called CC=23 SCAR=38.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 3 | my ( $dev, $av, $ctx, $prog ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 3 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 3 | my ( $type, $force, $label, @pos ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 3 | ($type) = $prog =~ /\Amkfs\.(\w+)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 3 | ▶ | while (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 4 | my $x = shift @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | if ( $x eq '-t' ) { $type = shift @a } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 1 | elsif ( $x eq '-L' ) { $label = shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | elsif ( $x =~ /\A-[Ff]+\z/ ) { $force = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | elsif ( $x =~ /\A-/ ) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 3 | else { push @pos, $x } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 3 | ▶ | $type //= 'ext2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$type //= "ext2"
MC/DC0%0/1
$type //= "ext2"
$type
Truth table50%1/2
A
A= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 3 | my ($p) = @pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 3 | ▶ | my ( $c, $e ) = _bd( $dev, $p // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table50%1/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 3 | ▶ | return ( "mke2fs 1.47.0 (5-Feb-2023)\nThe file " . ( $p // '' ) . " does not exist and no size was specified.", 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table0%0/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | if ( _mounted_at( $dev, $c ) || grep { _mounted_at( $dev, $_ ) } _parts( $dev, $c ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
_mounted_at($dev, $c) or grep {_mounted_at($dev, $_);} _parts($dev, $c)
MC/DC50%1/2
_mounted_at($dev, $c) or grep {_mounted_at($dev, $_);} _parts($dev, $c)
_mounted_at($dev, $c)
grep {_mounted_at($dev, $_);} _parts($dev, $c)
Truth table66%2/3
A or B
A= _mounted_at($dev, $c)B= grep {_mounted_at($dev, $_);} _parts($dev, $c)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 2 | ▶ | return $type eq 'xfs' ? ( "mkfs.xfs: $p contains a mounted filesystem\nUsage: mkfs.xfs", 0 ) : ( "mke2fs 1.47.0 (5-Feb-2023)\n$p contains a $e->{fstype} file system\n\tlast mounted on " . ( _mounted_at( $dev, $c ) )[0] . "\n/dev: $p is mounted; will not make a filesystem here!", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 1 | ▶ | return ( "mkfs.$type: $p is apparently in use by the system; will not make a filesystem here!", 0 ) if _vg_of_pv( $dev, $c ) || grep { exists( ( $_->{members} || {} )->{$c} ) } values %{ _st($dev)->{md} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition42%3/7
_vg_of_pv($dev, $c) or grep {exists(($$_{"members"} || {})->{$c});} values %{_st($dev)->{"md"} or {};}
$$_{'members'} || {}
_st($dev)->{'md'} || {}
MC/DC0%0/2
_vg_of_pv($dev, $c) or grep {exists(($$_{"members"} || {})->{$c});} values %{_st($dev)->{"md"} or {};}
_vg_of_pv($dev, $c)
grep {exists(($$_{"members"} || {})->{$c});} values %{_st($dev)->{"md"} or {};}
MC/DC0%0/1
$$_{'members'} || {}
$$_{'members'}
MC/DC0%0/1
_st($dev)->{'md'} || {}
_st($dev)->{'md'}
Truth table33%1/3
A or B
A= _vg_of_pv($dev, $c)B= grep {exists(($$_{"members"} || {})->{$c});} values %{_st($dev)->{"md"} or {};}
Truth table50%1/2
A
A= $$_{'members'}
Truth table50%1/2
A
A= _st($dev)->{'md'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1 | ▶ | if ( $e->{fstype} && !$force ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$e{"fstype"} and not $force
MC/DC0%0/2
$$e{"fstype"} and not $force
$$e{"fstype"}
not $force
Truth table33%1/3
A and not(B)
A= $$e{"fstype"}B= not $force
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | return $type eq 'xfs' ? ( "mkfs.xfs: $p appears to contain an existing filesystem ($e->{fstype}).\nmkfs.xfs: Use the -f option to force overwrite.", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | : ( "mke2fs 1.47.0 (5-Feb-2023)\n$p contains a $e->{fstype} file system\nProceed anyway? (y,N) ", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1 | delete @{$e}{qw( offline fssize errors reserved_pct )}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 1 | $e->{fstype} = $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 1 | $e->{uuid} = _uuid( $dev, $c, "fs-$type" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | if ( defined $label ) { $e->{label} = $label } else { delete $e->{label} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 1 | ▶ | $e->{reserved_pct} = 5 if $type =~ /\Aext/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 1 | ▶ | return ( $type eq 'xfs' ? "meta-data=$p isize=512 agcount=4\ndata = bsize=4096 blocks=" . int( _b( $e->{size} ) / 4096 ) : "mke2fs 1.47.0 (5-Feb-2023)\nCreating filesystem with " . int( _b( $e->{size} ) / 4096 ) . " 4k blocks and 6553600 inodes\nFilesystem UUID: $e->{uuid}\nWriting superblocks and filesystem accounting information: done\n", 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 1 | ▶ | sub tune2fs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tune2fs: called CC=24 SCAR=42.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 1 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 1 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | my ( $list, $pct, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | ▶ | while (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 2 | my $x = shift @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | if ( $x eq '-l' ) { $list = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | elsif ( $x eq '-m' ) { $pct = shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | elsif ( $x =~ /\A-m(\d+(?:\.\d+)?)\z/ ) { $pct = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 1 | elsif ( $x !~ /\A-/ ) { $p = $x } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 1 | ▶ | my ( $c, $e ) = _bd( $dev, $p // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table50%1/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 1 | ▶ | return ( "tune2fs 1.47.0 (5-Feb-2023)\ntune2fs: No such file or directory while trying to open " . ( $p // '' ) . "\nCouldn't find valid filesystem superblock.", 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table0%0/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 1 | ▶ | return ( "tune2fs 1.47.0 (5-Feb-2023)\ntune2fs: Bad magic number in super-block while trying to open $p", 0 ) unless ( $e->{fstype} // '' ) =~ /\Aext/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$e{"fstype"} // ""
MC/DC0%0/1
$$e{"fstype"} // ""
$$e{"fstype"}
Truth table50%1/2
A
A= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 1 | my @mp = _mounted_at( $dev, $c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 1 | ▶ | my $size = @mp ? _b( $dev->{mounts}{ $mp[0] }{size} ) : _fssize($e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 1 | ▶ | my $cur = @mp ? $dev->{mounts}{ $mp[0] }{reserved_pct} // $e->{reserved_pct} // 5 : $e->{reserved_pct} // 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition28%2/7
($$dev{"mounts"}{$mp[0]}{"reserved_pct"} // $$e{"reserved_pct"}) // 5
$$dev{"mounts"}{$mp[0]}{"reserved_pct"} // $$e{"reserved_pct"}
$$e{"reserved_pct"} // 5
MC/DC0%0/2
($$dev{"mounts"}{$mp[0]}{"reserved_pct"} // $$e{"reserved_pct"}) // 5
$$dev{"mounts"}{$mp[0]}{"reserved_pct"}
$$e{"reserved_pct"}
MC/DC0%0/1
$$e{"reserved_pct"} // 5
$$e{"reserved_pct"}
Truth table33%1/3
A // B
A= $$dev{"mounts"}{$mp[0]}{"reserved_pct"}B= $$e{"reserved_pct"}
Truth table0%0/2
A
A= $$e{"reserved_pct"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 1 | ▶ | if ( defined $pct ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 1 | ▶ | return ( "tune2fs 1.47.0 (5-Feb-2023)\nbad reserved block ratio - $pct", 0 ) unless $pct =~ /\A\d+(?:\.\d+)?\z/ && $pct <= 50; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$pct =~ /\A\d+(?:\.\d+)?\z/ and $pct <= 50
MC/DC0%0/2
$pct =~ /\A\d+(?:\.\d+)?\z/ and $pct <= 50
$pct =~ /\A\d+(?:\.\d+)?\z/
$pct <= 50
Truth table33%1/3
A and B
A= $pct =~ /\A\d+(?:\.\d+)?\z/B= $pct <= 50
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 1 | $pct = 0 + $pct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 1 | ▶ | if (@mp) { $dev->{mounts}{$_}{reserved_pct} = $pct for @mp } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 1 | $e->{reserved_pct} = $pct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 1 | return ( "tune2fs 1.47.0 (5-Feb-2023)\nSetting reserved blocks percentage to $pct% (" . int( $size / 4096 * $pct / 100 ) . " blocks)", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | return ( join( "\n", 'tune2fs 1.47.0 (5-Feb-2023)', "Filesystem volume name: " . ( $e->{label} // '<none>' ), "Filesystem UUID: " . ( $e->{uuid} // '' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | ▶ | 'Filesystem state: ' . ( $e->{errors} ? 'not clean with errors' : 'clean' ), 'Errors behavior: Continue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$$e{"label"} // "<none>"
$$e{"uuid"} // ""
MC/DC0%0/1
$$e{"label"} // "<none>"
$$e{"label"}
MC/DC0%0/1
$$e{"uuid"} // ""
$$e{"uuid"}
Truth table0%0/2
A
A= $$e{"label"}
Truth table0%0/2
A
A= $$e{"uuid"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 'Block count: ' . int( $size / 4096 ), 'Reserved block count: ' . int( $size / 4096 * $cur / 100 ), 'Block size: 4096' ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 2 | ▶ | sub fsck { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fsck: called CC=11 SCAR=29.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 2 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 2 | my ($p) = grep { !/\A-/ } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 2 | my $dry = grep { $_ eq '-n' } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 2 | ▶ | my ( $c, $e ) = _bd( $dev, $p // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table50%1/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 2 | ▶ | return ( "e2fsck 1.47.0 (5-Feb-2023)\ne2fsck: No such file or directory while trying to open " . ( $p // '' ), 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table0%0/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 2 | ▶ | return ( "e2fsck 1.47.0 (5-Feb-2023)\n$p is mounted.\ne2fsck: Cannot continue, aborting.\n", 0 ) if _mounted_at( $dev, $c ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1 | ▶ | return ( "fsck.$e->{fstype}: not supported here", 0 ) unless ( $e->{fstype} // '' ) =~ /\Aext/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$e{"fstype"} // ""
MC/DC0%0/1
$$e{"fstype"} // ""
$$e{"fstype"}
Truth table50%1/2
A
A= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | ▶ | if ( $e->{errors} && !$dry && grep { /\A-\w*[yp]/ } @$av ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$$e{"errors"} and not $dry and grep {/\A-\w*[yp]/;} @$av
$$e{"errors"} and not $dry
MC/DC0%0/3
$$e{"errors"} and not $dry and grep {/\A-\w*[yp]/;} @$av
$$e{"errors"}
not $dry
grep {/\A-\w*[yp]/;} @$av
Truth table25%1/4
A and not(B) and C
A= $$e{"errors"}B= not $dryC= grep {/\A-\w*[yp]/;} @$av
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | delete $e->{errors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 1 | return ( "e2fsck 1.47.0 (5-Feb-2023)\nPass 1: Checking inodes, blocks, and sizes\nInode 1311 has illegal block(s). Clear? yes\nPass 2: Checking directory structure\nPass 3: Checking directory connectivity\nPass 4: Checking reference counts\nPass 5: Checking group summary information\n\n$p: ***** FILE SYSTEM WAS MODIFIED *****\n$p: 41022/6553600 files (0.4% non-contiguous), 3820112/26214400 blocks", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | ▶ | return ( "e2fsck 1.47.0 (5-Feb-2023)\nPass 1: Checking inodes, blocks, and sizes\nInode 1311 has illegal block(s). Clear? no\n\n$p: ********** WARNING: Filesystem still has errors **********", 0 ) if $e->{errors}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | return ( "e2fsck 1.47.0 (5-Feb-2023)\n$p: clean, 41022/6553600 files, 3820112/26214400 blocks", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | # --- Swap -------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # frei fuer root (darf die reservierten Bloecke nutzen) auf dem Dateisystem eines Pfads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 1 | ▶ | sub _root_free { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_root_free: called CC=5 SCAR=17.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 1 | my ( $dev, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | ▶ | my $mp = _L( '_mount_of', $dev, $path ) // return 0 + 'inf'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_L("_mount_of", $dev, $path) // (return "Inf")
MC/DC0%0/1
_L("_mount_of", $dev, $path) // (return "Inf")
_L("_mount_of", $dev, $path)
Truth table50%1/2
A
A= _L("_mount_of", $dev, $path)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | my ($r) = grep { $_->{mount} eq $mp } _L( '_df_rows', $dev ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 1 | ▶ | my $old = ( $dev->{files} || {} )->{$path}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'files'} || {}
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table50%1/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 1 | ▶ | return $r ? $r->{size} - $r->{used} + ( ref $old eq 'HASH' ? _L( '_file_size', $old ) : 0 ) : 0 + 'inf'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 5 | ▶ | sub swap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
swap: called CC=59 SCAR=64.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 5 | my ( $dev, $av, $ctx, $prog ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 5 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 5 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 5 | my @pos = grep { !/\A-/ } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 5 | ▶ | my $abs = sub { _L( '_absp', $_[0] ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 5 | ▶ | if ( $prog eq 'fallocate' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 1 | my ($len) = join( ' ', @a ) =~ /(?:-l\s*|--length[= ])(\S+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 1 | ▶ | my ($f) = grep { $_ ne ( $len // '' ) } @pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$len // ""
MC/DC0%0/1
$len // ""
$len
Truth table50%1/2
A
A= $len
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 1 | ▶ | return ( "fallocate: no length argument specified", 0 ) unless defined $len && defined $f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $len and defined $f
MC/DC0%0/2
defined $len and defined $f
defined $len
defined $f
Truth table33%1/3
A and B
A= defined $lenB= defined $f
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 1 | $f = $abs->($f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 1 | ▶ | return ( "fallocate: fallocate failed: No space left on device", 0 ) if _b($len) > _root_free( $dev, $f ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 1 | ▶ | my $old = ( $dev->{files} || {} )->{$f}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'files'} || {}
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table50%1/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 1 | ▶ | $dev->{files}{$f} = { size => _b($len), owner => 'root', group => 'root', mode => ref $old eq 'HASH' ? $old->{mode} // '0644' : '0644', mtime => 'Oct 20 12:00', content => '' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$old{"mode"} // "0644"
MC/DC0%0/1
$$old{"mode"} // "0644"
$$old{"mode"}
Truth table0%0/2
A
A= $$old{"mode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 1 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 4 | ▶ | if ( $prog eq 'dd' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | ▶ | my %o = map { /\A(\w+)=(.*)\z/ ? ( $1 => $2 ) : () } @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | return ( '', 0 ) unless defined $o{of}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | my $bs = _b( $o{bs} // '512' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$o{"bs"} // 512
MC/DC0%0/1
$o{"bs"} // 512
$o{"bs"}
Truth table0%0/2
A
A= $o{"bs"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | my $n = $o{count} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$o{"count"} // 0
MC/DC0%0/1
$o{"count"} // 0
$o{"count"}
Truth table0%0/2
A
A= $o{"count"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $f = $abs->( $o{of} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my $room = _root_free( $dev, $f ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | if ( $bs * $n > $room ) { # schreibt bis die Platte voll ist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | my $k = int( $room / ( $bs || 1 ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$bs || 1
MC/DC0%0/1
$bs || 1
$bs
Truth table0%0/2
A
A= $bs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | $dev->{files}{$f} = { size => $k * $bs, owner => 'root', group => 'root', mode => '0644', mtime => 'Oct 20 12:00', content => '' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | return ( "dd: error writing '$o{of}': No space left on device\n$k+0 records in\n$k+0 records out\n" . ( $k * $bs ) . " bytes copied, 2.0 s, 1.4 GB/s", 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | $dev->{files}{$f} = { size => $bs * $n, owner => 'root', group => 'root', mode => '0644', mtime => 'Oct 20 12:00', content => '' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | return ( "$n+0 records in\n$n+0 records out\n" . ( $bs * $n ) . " bytes copied, 3.1 s, 1.4 GB/s", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 4 | ▶ | if ( $prog eq 'free' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | my $h = grep {/\A-\w*h/} @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my $sw = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | $sw += _b( $_->{size} ) for @{ $s->{swaps} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$s{'swaps'} || []
MC/DC0%0/1
$$s{'swaps'} || []
$$s{'swaps'}
Truth table0%0/2
A
A= $$s{'swaps'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | my $f = $h ? sub { _h( $_[0] ) . 'i' } : sub { int( $_[0] / 1024 ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | return ( join( "\n", sprintf( '%15s %11s %11s %11s %11s %11s', qw( total used free shared buff/cache available ) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | sprintf( 'Mem: %10s %11s %11s %11s %11s %11s', map { $f->( _b($_) ) } qw( 8G 6G 400M 120M 1.6G 1.5G ) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | sprintf( 'Swap:%10s %11s %11s', $f->($sw), $f->( $sw ? int( $sw / 4 ) : 0 ), $f->( $sw - ( $sw ? int( $sw / 4 ) : 0 ) ) ) ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 4 | ▶ | if ( $prog eq 'mkswap' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 1 | ▶ | my $p = $pos[-1] // return ( 'mkswap: no device specified', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pos[-1] // (return "mkswap: no device specified", 0)
MC/DC0%0/1
$pos[-1] // (return "mkswap: no device specified", 0)
$pos[-1]
Truth table50%1/2
A
A= $pos[-1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 1 | my ( $c, $e ) = _bd( $dev, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 1 | ▶ | if ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | return ( "mkswap: error: $p is mounted; will not make swapspace", 0 ) if _mounted_at( $dev, $c ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $e->{fstype} = 'swap'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | $e->{uuid} = _uuid( $dev, $c, 'swap' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | return ( "Setting up swapspace version 1, size = " . _gib( _b( $e->{size} ) ) . "\nno label, UUID=$e->{uuid}", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 1 | my $f = $abs->($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 1 | ▶ | my $fe = ( $dev->{files} || {} )->{$f}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'files'} || {}
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table50%1/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 1 | ▶ | return ( "mkswap: cannot open $p: No such file or directory", 0 ) unless ref $fe eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 1 | $fe->{swap} = _uuid( $dev, $f, 'swap' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 1 | ▶ | my $w = ( $fe->{mode} // '0644' ) ne '0600' ? "mkswap: $f: insecure permissions " . ( $fe->{mode} // '0644' ) . ", fix with: chmod 0600 $f\n" : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%1/4
$$fe{"mode"} // "0644"
$$fe{"mode"} // "0644"
MC/DC0%0/1
$$fe{"mode"} // "0644"
$$fe{"mode"}
MC/DC0%0/1
$$fe{"mode"} // "0644"
$$fe{"mode"}
Truth table50%1/2
A
A= $$fe{"mode"}
Truth table0%0/2
A
A= $$fe{"mode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 1 | return ( $w . "Setting up swapspace version 1, size = " . _gib( _b( $fe->{size} ) ) . "\nno label, UUID=$fe->{swap}", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 3 | ▶ | if ( $prog eq 'swapon' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 3 | ▶ | if ( !@pos || grep { $_ eq '--show' || $_ eq '-s' } @a and !grep { $_ eq '-a' } @a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
!@pos || grep({$_ eq "--show" or $_ eq "-s";} @a) and not grep({$_ eq "-a";} @a)
not @pos or grep {$_ eq "--show" or $_ eq "-s";} @a
$_ eq '--show' || $_ eq '-s'
MC/DC33%1/3
!@pos || grep({$_ eq "--show" or $_ eq "-s";} @a) and not grep({$_ eq "-a";} @a)
not @pos
grep {$_ eq "--show" or $_ eq "-s";} @a
not grep({$_ eq "-a";} @a)
MC/DC0%0/2
$_ eq '--show' || $_ eq '-s'
$_ eq '--show'
$_ eq '-s'
Truth table40%2/5
not(A) or B and not(C)
A= not @posB= grep {$_ eq "--show" or $_ eq "-s";} @aC= not grep({$_ eq "-a";} @a)
Truth table33%1/3
A || B
A= $_ eq '--show'B= $_ eq '-s'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1 | ▶ | return ( '', 1 ) unless @{ $s->{swaps} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$s{'swaps'} || []
MC/DC0%0/1
$$s{'swaps'} || []
$$s{'swaps'}
Truth table50%1/2
A
A= $$s{'swaps'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | return ( join( "\n", sprintf( '%-15s %-9s %5s %4s %4s', qw( NAME TYPE SIZE USED PRIO ) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 1 | ▶ | map { sprintf '%-15s %-9s %5s %4s %4s', $_->{name}, $_->{name} =~ m{\A/dev/} ? 'partition' : 'file', $_->{size}, '0B', -2 } @{ $s->{swaps} } ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 2 | my @targets = @pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | if ( grep { $_ eq '-a' } @a ) { push @targets, map { $_->{src} } grep { $_->{type} eq 'swap' && $_->{opts} !~ /noauto/ } _fstab($dev) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$$_{'type'} eq 'swap' && !($$_{'opts'} =~ /noauto/)
MC/DC0%0/2
$$_{'type'} eq 'swap' && !($$_{'opts'} =~ /noauto/)
$$_{'type'} eq 'swap'
!($$_{'opts'} =~ /noauto/)
Truth table0%0/3
A && not(B)
A= $$_{'type'} eq 'swap'B= !($$_{'opts'} =~ /noauto/)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 2 | my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 2 | my $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 2 | for my $t (@targets) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 2 | my ( $c, $e ) = _bd( $dev, $t ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 2 | my ( $name, $size, $sig ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | if ($e) { ( $name, $size, $sig ) = ( $c, $e->{size}, ( $e->{fstype} // '' ) eq 'swap' ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$e{"fstype"} // ""
MC/DC0%0/1
$$e{"fstype"} // ""
$$e{"fstype"}
Truth table0%0/2
A
A= $$e{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 2 | my $f = $abs->($t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 2 | ▶ | my $fe = ( $dev->{files} || {} )->{$f}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'files'} || {}
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table50%1/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | ▶ | if ( ref $fe ne 'HASH' ) { push @o, "swapon: cannot open $t: No such file or directory"; $ok = 0; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 2 | ▶ | push @o, "swapon: $f: insecure permissions " . ( $fe->{mode} // '0644' ) . ", 0600 suggested." if ( $fe->{mode} // '0644' ) ne '0600'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$fe{"mode"} // "0644"
$$fe{"mode"} // "0644"
MC/DC0%0/1
$$fe{"mode"} // "0644"
$$fe{"mode"}
MC/DC0%0/1
$$fe{"mode"} // "0644"
$$fe{"mode"}
Truth table50%1/2
A
A= $$fe{"mode"}
Truth table50%1/2
A
A= $$fe{"mode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 2 | ( $name, $size, $sig ) = ( $f, $fe->{size}, $fe->{swap} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | next if grep { $_->{name} eq $name } @{ $s->{swaps} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$s{'swaps'} || []
MC/DC0%0/1
$$s{'swaps'} || []
$$s{'swaps'}
Truth table50%1/2
A
A= $$s{'swaps'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 2 | ▶ | if ( !$sig ) { push @o, "swapon: $name: read swap header failed"; $ok = 0; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 1 | push @{ $s->{swaps} }, { name => $name, size => _h( _b($size) ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 2 | return ( join( "\n", @o ), $ok ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | if ( $prog eq 'swapoff' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | my @t = grep { $_ ne '-a' } @pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | ▶ | if ( grep { $_ eq '-a' } @a ) { delete $s->{swaps}; return ( '', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | for my $t (@t) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | my $n = canon( $dev, $t ) // $abs->($t); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
canon($dev, $t) // &$abs($t)
MC/DC0%0/2
canon($dev, $t) // &$abs($t)
canon($dev, $t)
&$abs($t)
Truth table0%0/3
A // B
A= canon($dev, $t)B= &$abs($t)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | ▶ | my @k = grep { $_->{name} ne $n } @{ $s->{swaps} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$s{'swaps'} || []
MC/DC0%0/1
$$s{'swaps'} || []
$$s{'swaps'}
Truth table0%0/2
A
A= $$s{'swaps'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | return ( "swapoff: $t: swapoff failed: Invalid argument", 0 ) if @k == @{ $s->{swaps} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$s{'swaps'} || []
MC/DC0%0/1
$$s{'swaps'} || []
$$s{'swaps'}
Truth table0%0/2
A
A= $$s{'swaps'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $s->{swaps} = \@k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | # --- Partitionen ------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 4 | ▶ | sub part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part: called CC=41 SCAR=56.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 4 | my ( $dev, $av, $ctx, $prog ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 4 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 4 | ▶ | my $d = $s->{disks} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{"disks"} ||= {}
MC/DC0%0/1
$$s{"disks"} ||= {}
$$s{"disks"}
Truth table50%1/2
A
A= $$s{"disks"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 4 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 4 | my @pos = grep { !/\A-/ } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 4 | ▶ | return ( '', 1 ) if $prog eq 'partprobe'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 4 | ▶ | if ( $prog eq 'fdisk' ) { # nur fdisk -l; interaktiv ist eine Luecke der Simulation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | unless ( grep { $_ eq '-l' || $_ eq '--list' } @a ) { push @Langertha::Holmgang::Sim::Linux::GAPS, join( ' ', 'fdisk', @a ); return ( '', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ eq '-l' || $_ eq '--list'
MC/DC0%0/2
$_ eq '-l' || $_ eq '--list'
$_ eq '-l'
$_ eq '--list'
Truth table0%0/3
A || B
A= $_ eq '-l'B= $_ eq '--list'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | ▶ | my @disks = @pos ? map { canon( $dev, $_ ) // () } @pos : grep { !$d->{$_}{parent} } sort keys %$d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
canon($dev, $_) // ()
MC/DC0%0/2
canon($dev, $_) // ()
canon($dev, $_)
()
Truth table0%0/3
A // B
A= canon($dev, $_)B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | my @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | for my $k (@disks) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | my $bytes = _b( $d->{$k}{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | push @l, sprintf( 'Disk %s: %s, %d bytes, %d sectors', $k, _gib($bytes), $bytes, $bytes / 512 ), 'Units: sectors of 1 * 512 = 512 bytes', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 'Sector size (logical/physical): 512 bytes / 512 bytes', 'Disklabel type: gpt', ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | my @p = _parts( $dev, $k ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | next unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | push @l, sprintf( '%-12s %10s %10s %10s %5s %s', qw( Device Start End Sectors Size Type ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | ▶ | my $pos = sub { $d->{ $_[0] }{start} // ( $_[0] =~ /(\d+)\z/ )[0] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
$$d{$_[0]}{"start"} // ($_[0] =~ /(\d+)\z/)[0]
MC/DC0%0/2
$$d{$_[0]}{"start"} // ($_[0] =~ /(\d+)\z/)[0]
$$d{$_[0]}{"start"}
($_[0] =~ /(\d+)\z/)[0]
Truth table0%0/3
A // B
A= $$d{$_[0]}{"start"}B= ($_[0] =~ /(\d+)\z/)[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | my $start = 2048; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | for my $p ( sort { $pos->($a) <=> $pos->($b) } @p ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | my $sec = int( _b( $d->{$p}{size} ) / 512 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | push @l, sprintf( '%-12s %10d %10d %10d %5s %s', $p, $start, $start + $sec - 1, $sec, _h( _b( $d->{$p}{size} ) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | ▶ | ( $d->{$p}{fstype} // '' ) eq 'vfat' ? 'EFI System' : ( $d->{$p}{fstype} // '' ) eq 'LVM2_member' ? 'Linux LVM' : 'Linux filesystem' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/4
$$d{$p}{"fstype"} // ""
$$d{$p}{"fstype"} // ""
MC/DC0%0/1
$$d{$p}{"fstype"} // ""
$$d{$p}{"fstype"}
MC/DC0%0/1
$$d{$p}{"fstype"} // ""
$$d{$p}{"fstype"}
Truth table0%0/2
A
A= $$d{$p}{"fstype"}
Truth table0%0/2
A
A= $$d{$p}{"fstype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $start += $sec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | push @l, ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | return ( join( "\n", @l ) =~ s/\n+\z//r, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 4 | ▶ | my $pname = sub { my ( $disk, $n ) = @_; return $disk =~ /\d\z/ ? "${disk}p$n" : "$disk$n" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 1 | ▶ | my $copy = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=29.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | my ( $from, $to ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 1 | ▶ | return ( "sfdisk: cannot open $to: No such file or directory", 0 ) unless $d->{$to} && !$d->{$to}{parent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$d{$to} and not $$d{$to}{"parent"}
MC/DC0%0/2
$$d{$to} and not $$d{$to}{"parent"}
$$d{$to}
not $$d{$to}{"parent"}
Truth table33%1/3
A and not(B)
A= $$d{$to}B= not $$d{$to}{"parent"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | return ( "This disk is currently in use - repartitioning is probably a bad idea.\nUmount all file systems, and swapoff all swap partitions on this disk.\nUse the --no-reread flag to suppress this check.\nsfdisk: Use the --force flag to overrule all checks.", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 1 | ▶ | if grep { _mounted_at( $dev, $_ ) || _vg_of_pv( $dev, $_ ) || grep { ( $_->{members}{$_} // '' ) eq 'active' } values %{ $s->{md} || {} } } $to, _parts( $dev, $to ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%4/10
_mounted_at($dev, $_) || _vg_of_pv($dev, $_) || grep({($$_{'members'}{$_} // '') eq 'active';} values %{$$s{'md'} or {};})
_mounted_at($dev, $_) or _vg_of_pv($dev, $_)
$$_{"members"}{$_} // ""
$$s{'md'} || {}
MC/DC0%0/3
_mounted_at($dev, $_) || _vg_of_pv($dev, $_) || grep({($$_{'members'}{$_} // '') eq 'active';} values %{$$s{'md'} or {};})
_mounted_at($dev, $_)
_vg_of_pv($dev, $_)
grep({($$_{'members'}{$_} // '') eq 'active';} values %{$$s{'md'} or {};})
MC/DC0%0/1
$$_{"members"}{$_} // ""
$$_{"members"}{$_}
MC/DC0%0/1
$$s{'md'} || {}
$$s{'md'}
Truth table25%1/4
A or B || C
A= _mounted_at($dev, $_)B= _vg_of_pv($dev, $_)C= grep({($$_{'members'}{$_} // '') eq 'active';} values %{$$s{'md'} or {};})
Truth table50%1/2
A
A= $$_{"members"}{$_}
Truth table50%1/2
A
A= $$s{'md'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 1 | my @src = _parts( $dev, $from ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 1 | my $need = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 1 | $need += _b( $d->{$_}{size} ) for @src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 1 | ▶ | return ( "sfdisk: failed to add #1 partition: Numerical result out of range", 0 ) if $need > _b( $d->{$to}{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 1 | delete $d->{$_} for _parts( $dev, $to ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 1 | for my $p (@src) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 1 | my ($n) = $p =~ /(\d+)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 1 | ▶ | $d->{ $pname->( $to, $n ) } = { size => $d->{$p}{size}, parent => $to, ( defined $d->{$p}{ptype} ? ( ptype => $d->{$p}{ptype} ) : () ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 1 | delete $d->{$to}{fstype}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 1 | return ( "Checking that no-one is using this disk right now ... OK\n\n>>> Script header accepted.\nNew situation:\n" . join( "\n", map { $pname->( $to, ( $_ =~ /(\d+)\z/ )[0] ) . " " . $d->{$_}{size} } @src ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | . "\n\nThe partition table has been altered.\nSyncing disks.", 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 4 | ▶ | if ( $prog eq 'sfdisk' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 2 | ▶ | if ( grep { $_ eq '-d' || $_ eq '--dump' } @a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_ eq '-d' || $_ eq '--dump'
MC/DC50%1/2
$_ eq '-d' || $_ eq '--dump'
$_ eq '-d'
$_ eq '--dump'
Truth table66%2/3
A || B
A= $_ eq '-d'B= $_ eq '--dump'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 1 | ▶ | my $disk = $pos[0] // return ( 'sfdisk: no disk device specified', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pos[0] // (return "sfdisk: no disk device specified", 0)
MC/DC0%0/1
$pos[0] // (return "sfdisk: no disk device specified", 0)
$pos[0]
Truth table50%1/2
A
A= $pos[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 1 | ▶ | return ( "sfdisk: cannot open $disk: No such file or directory", 0 ) unless $d->{$disk}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | my @p = _parts( $dev, $disk ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | my $start = 2048; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 1 | my @l = ( 'label: dos', 'label-id: 0x5d1e2c3f', "device: $disk", 'unit: sectors', 'sector-size: 512', '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | for my $p (@p) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 1 | my $sec = int( _b( $d->{$p}{size} ) / 512 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 1 | ▶ | push @l, "$p : start=$start, size=$sec, type=" . ( $d->{$p}{ptype} // '83' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$d{$p}{"ptype"} // 83
MC/DC0%0/1
$$d{$p}{"ptype"} // 83
$$d{$p}{"ptype"}
Truth table50%1/2
A
A= $$d{$p}{"ptype"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 1 | $start += $sec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 1 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 1 | ▶ | my $stdin = $ctx->{stdin} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$ctx{"stdin"} // ""
MC/DC0%0/1
$$ctx{"stdin"} // ""
$$ctx{"stdin"}
Truth table50%1/2
A
A= $$ctx{"stdin"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 1 | my ($from) = $stdin =~ /^device:\s*(\S+)/m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 1 | my $to = $pos[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 1 | ▶ | return ( 'sfdisk: no disk device specified', 0 ) unless defined $to; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 1 | ▶ | return ( "sfdisk: failed to read script", 0 ) unless defined $from && $d->{$from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $from and $$d{$from}
MC/DC0%0/2
defined $from and $$d{$from}
defined $from
$$d{$from}
Truth table33%1/3
A and B
A= defined $fromB= $$d{$from}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 1 | return $copy->( $from, $to ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 2 | ▶ | if ( $prog eq 'sgdisk' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | my $j = join ' ', @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | return ( 'The operation has completed successfully.', 1 ) if $j =~ /(?:\A|\s)(?:-G|--randomize-guids)\b/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | ▶ | if ( my ($to) = $j =~ /(?:-R|--replicate)[= ]?(\S+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | ▶ | my ($from) = grep { $_ ne $to && $d->{$_} } @pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_ ne $to && $$d{$_}
MC/DC0%0/2
$_ ne $to && $$d{$_}
$_ ne $to
$$d{$_}
Truth table0%0/3
A && B
A= $_ ne $toB= $$d{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | return ( 'Problem opening for reading!', 0 ) unless defined $from; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | my ( $o, $ok ) = $copy->( $from, $to ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | ▶ | return ( $ok ? 'The operation has completed successfully.' : $o, $ok ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | if ( grep { $_ eq '-p' || $_ eq '--print' } @a ) { return lsblk( $dev, [ $pos[0] ] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ eq '-p' || $_ eq '--print'
MC/DC0%0/2
$_ eq '-p' || $_ eq '--print'
$_ eq '-p'
$_ eq '--print'
Truth table0%0/3
A || B
A= $_ eq '-p'B= $_ eq '--print'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 2 | ▶ | if ( $prog eq 'growpart' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 2 | my ( $disk, $n ) = @pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 2 | ▶ | return ( 'usage: growpart disk partition', 0 ) unless defined $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 2 | my $p = $pname->( $disk, $n ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 2 | ▶ | return ( "FAILED: $disk: does not exist", 0 ) unless $d->{$disk}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 2 | ▶ | return ( "FAILED: partition $n does not exist", 0 ) unless $d->{$p}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 2 | my @p = _parts( $dev, $disk ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 2 | my $used = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 2 | $used += _b( $d->{$_}{size} ) for @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 2 | my $free = _b( $d->{$disk}{size} ) - $used - 1024**2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | # die physisch letzte Partition (start, sonst die Nummer; Cloud-Abbilder haben z. B. 15 vorn) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 2 | ▶ | my $pos = sub { $d->{ $_[0] }{start} // ( $_[0] =~ /(\d+)\z/ )[0] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=8.1
Condition33%1/3
$$d{$_[0]}{"start"} // ($_[0] =~ /(\d+)\z/)[0]
MC/DC0%0/2
$$d{$_[0]}{"start"} // ($_[0] =~ /(\d+)\z/)[0]
$$d{$_[0]}{"start"}
($_[0] =~ /(\d+)\z/)[0]
Truth table33%1/3
A // B
A= $$d{$_[0]}{"start"}B= ($_[0] =~ /(\d+)\z/)[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 2 | my ($last) = sort { $pos->($b) <=> $pos->($a) } @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 2 | ▶ | return ( "NOCHANGE: partition $n is size " . int( _b( $d->{$p}{size} ) / 512 ) . ". it cannot be grown", 0 ) if $free <= 0 || $last ne $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$free <= 0 or $last ne $p
MC/DC50%1/2
$free <= 0 or $last ne $p
$free <= 0
$last ne $p
Truth table66%2/3
A or B
A= $free <= 0B= $last ne $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 1 | my $old = _b( $d->{$p}{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 1 | $d->{$p}{size} = _h( $old + $free + 1024**2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 1 | return ( "CHANGED: partition=$n start=2048 old: size=" . int( $old / 512 ) . " end=" . int( $old / 512 + 2048 ) . " new: size=" . int( _b( $d->{$p}{size} ) / 512 ) . " end=" . int( _b( $d->{$p}{size} ) / 512 + 2048 ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # --- mdadm ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 1 | ▶ | sub _mdstat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mdstat: called CC=7 SCAR=19.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 1 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 1 | ▶ | my $md = _st($dev)->{md} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_st($dev)->{'md'} || {}
MC/DC0%0/1
_st($dev)->{'md'} || {}
_st($dev)->{'md'}
Truth table50%1/2
A
A= _st($dev)->{'md'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 1 | my @l = ('Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 1 | for my $n ( sort keys %$md ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 1 | my $m = $md->{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 1 | ▶ | my $mem = $m->{members} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$m{'members'} || {}
MC/DC0%0/1
$$m{'members'} || {}
$$m{'members'}
Truth table50%1/2
A
A= $$m{'members'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 1 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 1 | ▶ | my @parts = map { ( my $x = $_ ) =~ s{\A/dev/}{}; $x . '[' . $i++ . ']' . ( $mem->{$_} eq 'faulty' ? '(F)' : $mem->{$_} eq 'spare' ? '(S)' : '' ) } sort keys %$mem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 1 | my $act = grep { $mem->{$_} eq 'active' } keys %$mem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 1 | my $reb = grep { $mem->{$_} eq 'rebuilding' } keys %$mem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 1 | ( my $short = $n ) =~ s{\A/dev/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | push @l, "$short : active $m->{level} @parts", sprintf( ' %d blocks super 1.2 [%d/%d] [%s]', int( _b( $m->{size} ) / 1024 ), $m->{raid_disks}, $act, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 1 | join( '', ('U') x $act, ('_') x ( $m->{raid_disks} - $act ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 1 | ▶ | push @l, ' [=>...................] recovery = 8.4% (3290112/39062464) finish=12.3min speed=48412K/sec' if $reb; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 1 | push @l, ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 1 | push @l, 'unused devices: <none>'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 1 | return join "\n", @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 1 | ▶ | sub mdstat { return _mdstat( $_[0] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mdstat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 4 | ▶ | sub mdadm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mdadm: called CC=40 SCAR=55.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 4 | my ( $dev, $av ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 4 | my $s = _st($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 4 | my @a = grep { $_ ne '--manage' } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 4 | ▶ | if ( grep { $_ eq '--detail' || $_ eq '-D' } @a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_ eq '--detail' || $_ eq '-D'
MC/DC0%0/2
$_ eq '--detail' || $_ eq '-D'
$_ eq '--detail'
$_ eq '-D'
Truth table33%1/3
A || B
A= $_ eq '--detail'B= $_ eq '-D'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my ($n) = grep { !/\A-/ } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | ▶ | my $m = ( $s->{md} || {} )->{ $n // '' } or return ( "mdadm: cannot open " . ( $n // '' ) . ": No such file or directory", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$$s{'md'} || {}
$n // ""
$n // ""
MC/DC0%0/1
$$s{'md'} || {}
$$s{'md'}
MC/DC0%0/1
$n // ""
$n
MC/DC0%0/1
$n // ""
$n
Truth table0%0/2
A
A= $$s{'md'}
Truth table0%0/2
A
A= $n
Truth table0%0/2
A
A= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | my $mem = $m->{members} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$m{'members'} || {}
MC/DC0%0/1
$$m{'members'} || {}
$$m{'members'}
Truth table0%0/2
A
A= $$m{'members'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | my $act = grep { $mem->{$_} eq 'active' } keys %$mem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | my $state = $act == $m->{raid_disks} ? 'clean' : ( grep { $mem->{$_} eq 'rebuilding' } keys %$mem ) ? 'clean, degraded, recovering' : 'clean, degraded'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | return ( join( "\n", "$n:", ' Version : 1.2', " Raid Level : $m->{level}", ' Array Size : ' . int( _b( $m->{size} ) / 1024 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | " Raid Devices : $m->{raid_disks}", ' Total Devices : ' . scalar( keys %$mem ), " State : $state", " Active Devices : $act", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | '', ' Number Major Minor RaidDevice State', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | map { sprintf( ' %d 8 %2d %s %s %s', $i, $i * 16 + 1, $mem->{$_} eq 'active' ? $i++ : '-', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | ▶ | { active => 'active sync', faulty => 'faulty', spare => 'spare', rebuilding => 'spare rebuilding' }->{ $mem->{$_} } // $mem->{$_}, $_ ) } sort keys %$mem ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
{"active", "active sync", "faulty", "faulty", "spare", "spare", "rebuilding", "spare rebuilding"}->{$$mem{$_}} // $$mem{$_}
MC/DC0%0/2
{"active", "active sync", "faulty", "faulty", "spare", "spare", "rebuilding", "spare rebuilding"}->{$$mem{$_}} // $$mem{$_}
{"active", "active sync", "faulty", "faulty", "spare", "spare", "rebuilding", "spare rebuilding"}->{$$mem{$_}}
$$mem{$_}
Truth table0%0/3
A // B
A= {"active", "active sync", "faulty", "faulty", "spare", "spare", "rebuilding", "spare rebuilding"}->{$$mem{$_}}B= $$mem{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 4 | my ($n) = grep { m{\A/dev/md} } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 4 | ▶ | my $m = ( $s->{md} || {} )->{ $n // '' } or return ( "mdadm: error opening " . ( $n // '' ) . ": No such file or directory", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$$s{'md'} || {}
$n // ""
$n // ""
MC/DC0%0/1
$$s{'md'} || {}
$$s{'md'}
MC/DC0%0/1
$n // ""
$n
MC/DC0%0/1
$n // ""
$n
Truth table50%1/2
A
A= $$s{'md'}
Truth table50%1/2
A
A= $n
Truth table0%0/2
A
A= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 4 | my @w = grep { $_ ne $n } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 4 | my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 4 | ▶ | while (@w) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 4 | my $op = shift @w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 4 | ▶ | my $d = shift @w // return ( "mdadm: No devices given.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @w // (return "mdadm: No devices given.", 0)
MC/DC0%0/1
shift @w // (return "mdadm: No devices given.", 0)
shift @w
Truth table50%1/2
A
A= shift @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 4 | ▶ | my $mem = $m->{members} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$m{"members"} ||= {}
MC/DC0%0/1
$$m{"members"} ||= {}
$$m{"members"}
Truth table50%1/2
A
A= $$m{"members"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 4 | ▶ | if ( $op eq '--fail' || $op eq '-f' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$op eq "--fail" or $op eq "-f"
MC/DC0%0/2
$op eq "--fail" or $op eq "-f"
$op eq "--fail"
$op eq "-f"
Truth table33%1/3
A or B
A= $op eq "--fail"B= $op eq "-f"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | return ( "mdadm: set device faulty failed for $d: No such device", 0 ) unless exists $mem->{$d}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | $mem->{$d} = 'faulty'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | push @o, "mdadm: set $d faulty in $n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | ▶ | elsif ( $op eq '--remove' || $op eq '-r' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$op eq "--remove" or $op eq "-r"
MC/DC50%1/2
$op eq "--remove" or $op eq "-r"
$op eq "--remove"
$op eq "-r"
Truth table66%2/3
A or B
A= $op eq "--remove"B= $op eq "-r"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 2 | ▶ | return ( "mdadm: hot remove failed for $d: No such device or address", 0 ) unless exists $mem->{$d}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 2 | ▶ | return ( "mdadm: hot remove failed for $d: Device or resource busy", 0 ) if $mem->{$d} eq 'active' || $mem->{$d} eq 'rebuilding'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$$mem{$d} eq "active" or $$mem{$d} eq "rebuilding"
MC/DC50%1/2
$$mem{$d} eq "active" or $$mem{$d} eq "rebuilding"
$$mem{$d} eq "active"
$$mem{$d} eq "rebuilding"
Truth table66%2/3
A or B
A= $$mem{$d} eq "active"B= $$mem{$d} eq "rebuilding"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 1 | delete $mem->{$d}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 1 | push @o, "mdadm: hot removed $d from $n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | ▶ | elsif ( $op eq '--add' || $op eq '-a' || $op eq '--re-add' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$op eq "--add" or $op eq "-a" or $op eq "--re-add"
$op eq "--add" or $op eq "-a"
MC/DC0%0/3
$op eq "--add" or $op eq "-a" or $op eq "--re-add"
$op eq "--add"
$op eq "-a"
$op eq "--re-add"
Truth table25%1/4
A or B or C
A= $op eq "--add"B= $op eq "-a"C= $op eq "--re-add"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 2 | my ( $c, $e ) = _bd( $dev, $d ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 2 | ▶ | return ( "mdadm: cannot find $d: No such file or directory", 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 1 | ▶ | return ( "mdadm: $d is already a member of $n", 0 ) if exists $mem->{$d}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | ▶ | return ( "mdadm: Cannot open $d: Device or resource busy", 0 ) if _mounted_at( $dev, $c ) || _vg_of_pv( $dev, $c ) || _parts( $dev, $c ) && grep { _mounted_at( $dev, $_ ) } _parts( $dev, $c ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
_mounted_at($dev, $c) or _vg_of_pv($dev, $c) or _parts($dev, $c) and grep {_mounted_at($dev, $_);} _parts($dev, $c)
_mounted_at($dev, $c) or _vg_of_pv($dev, $c)
_parts($dev, $c) and grep {_mounted_at($dev, $_);} _parts($dev, $c)
MC/DC0%0/4
_mounted_at($dev, $c) or _vg_of_pv($dev, $c) or _parts($dev, $c) and grep {_mounted_at($dev, $_);} _parts($dev, $c)
_mounted_at($dev, $c)
_vg_of_pv($dev, $c)
_parts($dev, $c)
grep {_mounted_at($dev, $_);} _parts($dev, $c)
Truth table20%1/5
A or B or C and D
A= _mounted_at($dev, $c)B= _vg_of_pv($dev, $c)C= _parts($dev, $c)D= grep {_mounted_at($dev, $_);} _parts($dev, $c)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 1 | ▶ | return ( "mdadm: $d not large enough to join array", 0 ) if _b( $e->{size} ) < _b( $m->{member_size} // $m->{size} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$m{"member_size"} // $$m{"size"}
MC/DC0%0/2
$$m{"member_size"} // $$m{"size"}
$$m{"member_size"}
$$m{"size"}
Truth table33%1/3
A // B
A= $$m{"member_size"}B= $$m{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 1 | ▶ | my $act = grep { $mem->{$_} eq 'active' || $mem->{$_} eq 'rebuilding' } keys %$mem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$$mem{$_} eq 'active' || $$mem{$_} eq 'rebuilding'
MC/DC0%0/2
$$mem{$_} eq 'active' || $$mem{$_} eq 'rebuilding'
$$mem{$_} eq 'active'
$$mem{$_} eq 'rebuilding'
Truth table33%1/3
A || B
A= $$mem{$_} eq 'active'B= $$mem{$_} eq 'rebuilding'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 1 | ▶ | $mem->{$c} = $act < $m->{raid_disks} ? 'rebuilding' : 'spare'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 1 | $e->{fstype} = 'linux_raid_member'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 1 | push @o, "mdadm: added $c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | else { return ( "mdadm: unknown option $op", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 2 | return ( join( "\n", @o ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||