MooseFS/Mounts.pm

filter: Statementstmt 21.4% 15 / 70 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 1 totaltotal 16.9% 19 / 112 CC 14 SCAR 50.4
CC
14
Cov
15%
BUILD
210.0
__ANON__
2.0
BEGIN
1.0
CRAP 155.1
« MooseFS/Disk.pm ↑ Summary MooseFS/Info.pm »
1 package MooseFS::Mounts;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use IO::Socket::INET;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 extends 'MooseFS';
8  
9 has list => (
10 is => 'rw',
11 0 ▶ default => sub { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 1 );
13  
14 0 ▶sub BUILD {
Subroutine BUILD: not called CC=14 SCAR=53.5
Pod undocumented
15 0 my $self = shift;
16 0 my $ver = $self->masterversion;
17 0 my $s = $self->sock;
18  
19 0 ▶ if ($ver > 1626) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ver > 1626) { } 0 0 0
20 0 print $s pack('(LLC)>', 508, 1, 1);
21 } else {
22 0 print $s pack('(LL)>', 508, 0);
23 }
24  
25 0 my $header = $self->myrecv($s, 8);
26 0 my ($cmd, $length) = unpack('(LL)>', $header);
27 0 ▶ if ( $cmd == 509 and $ver > 1514 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd == 509 and $ver > 1514) 0 0 0
Condition0%0/3
$cmd == 509 and $ver > 1514
!ll&&!rl&&r
000
MC/DC0%0/2
$cmd == 509 and $ver > 1514
$cmd == 509 $ver > 1514
Truth table0%0/3
A and B
A= $cmd == 509B= $ver > 1514
ABresult
0X0
100
111
28 0 my $data = $self->myrecv($s, $length);
29 0 my ($startcnt, $pos);
30  
31 0 ▶ if ($ver < 1621 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ver < 1621) { } 0 0 0
elsif ($ver == 1621) { } 0 0 0
32 0 $startcnt = 16;
33 0 $pos = 0;
34 } elsif ($ver == 1621) {
35 0 $startcnt = 21;
36 0 $pos = 0;
37 } else {
38 0 $startcnt = (unpack("S>", substr($data, 0, 2)))[0];
39 0 $pos = 2;
40 };
41  
42 0 ▶ while ( $pos < $length ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < $length) 0 0 0
43 0 my ($sessionid, $ip1, $ip2, $ip3, $ip4, $v1, $v2, $v3, $ileng) = unpack("(LCCCCSCCL)>", substr($data, $pos, 16));
44 0 $pos += 16;
45 0 my $info = substr($data, $pos, $ileng);
46 0 $pos += $ileng;
47 0 my $pleng = (unpack("L>", substr($data, $pos, 4)))[0];
48 0 $pos += 4;
49 0 my $path = substr($data, $pos, $pleng);
50 0 $pos += $pleng;
51  
52 0 my ($sesflags, $rootuid, $rootgid, $mapalluid, $mapallgid, $mingoal, $maxgoal, $mintrashtime, $maxtrashtime);
53 0 ▶ if ($ver >= 1626) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ver >= 1626) { } 0 0 0
elsif ($ver > 1600) { } 0 0 0
54 0 ($sesflags, $rootuid, $rootgid, $mapalluid, $mapallgid, $mingoal, $maxgoal, $mintrashtime, $maxtrashtime) = unpack("(CLLLLCCLL)>", substr($data, $pos, 27));
55 0 $pos += 27;
56 0 ▶ if ($mingoal <= 1 and $maxgoal >= 9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mingoal <= 1 and $maxgoal >= 9) 0 0 0
Condition0%0/3
$mingoal <= 1 and $maxgoal >= 9
!ll&&!rl&&r
000
MC/DC0%0/2
$mingoal <= 1 and $maxgoal >= 9
$mingoal <= 1 $maxgoal >= 9
Truth table0%0/3
A and B
A= $mingoal <= 1B= $maxgoal >= 9
ABresult
0X0
100
111
57 0 $mingoal = undef;
58 0 $maxgoal = undef;
59 };
60 0 ▶ if ($mintrashtime == 0 and $maxtrashtime == 0xFFFFFFFF) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mintrashtime == 0 and $maxtrashtime == 4294967295) 0 0 0
Condition0%0/3
$mintrashtime == 0 and $maxtrashtime == 4294967295
!ll&&!rl&&r
000
MC/DC0%0/2
$mintrashtime == 0 and $maxtrashtime == 4294967295
$mintrashtime == 0 $maxtrashtime == 4294967295
Truth table0%0/3
A and B
A= $mintrashtime == 0B= $maxtrashtime == 4294967295
ABresult
0X0
100
111
61 0 $mintrashtime = undef;
62 0 $maxtrashtime = undef;
63 };
64 } elsif ($ver > 1600) {
65 0 ($sesflags, $rootuid, $rootgid, $mapalluid, $mapallgid) = unpack("(CLLLL)>", substr($data, $pos, 17));
66 0 $mingoal = undef;
67 0 $maxgoal = undef;
68 0 $mintrashtime = undef;
69 0 $maxtrashtime = undef;
70 0 $pos += 17;
71 } else {
72 0 ($sesflags, $rootuid, $rootgid) = unpack("(CLL)>", substr($data, $pos, 9));
73 0 $mapalluid = 0;
74 0 $mapallgid = 0;
75 0 $mingoal = undef;
76 0 $maxgoal = undef;
77 0 $mintrashtime = undef;
78 0 $maxtrashtime = undef;
79 0 $pos += 9;
80 };
81 0 $pos += 8 * $startcnt;
82  
83 0 ▶ push @{$self->list}, {
Branch: 1 branch
BranchTrueFalseTotal
$path eq '.' ? : 0 0 0
84 sessionid => $sessionid,
85 ip => "$ip1.$ip2.$ip3.$ip4",
86 mount => $info,
87 version => "$v1.$v2.$v3",
88 meta => $path eq '.' ? 1 : 0,
89 moose_path => $path,
90 ses_flags => $sesflags,
91 root_uid => $rootuid,
92 root_gid => $rootgid,
93 all_users_uid => $mapalluid,
94 all_users_gid => $mapallgid,
95 mingoal => $mingoal,
96 maxgoal => $maxgoal,
97 mintrashtime => $mintrashtime,
98 maxtrashtime => $maxtrashtime,
99 };
100 }
101 }
102 }
103  
104 1 1;
« MooseFS/Disk.pm ↑ Summary MooseFS/Info.pm »