lib/Sys/Ebpf/Constants/BpfMapCreateFlags.pm

filter: Statementstmt 73.3% 22 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 64.2% 27 / 42 CC 4 SCAR 21.5
CC
4
Cov
65%
combine_flags
20.0
__ANON__
1.0
BEGIN
1.0
CRAP 8.6
« blib/lib/Sys/Ebpf/Link/Netlink/Xdp.pm ↑ Summary blib/lib/Sys/Ebpf/Link/Netlink/Socket.pm »
1 package Sys::Ebpf::Constants::BpfMapCreateFlags;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 my %constants = (
10 'BPF_F_NO_PREALLOC' => 1 << 0,
11 'BPF_F_NO_COMMON_LRU' => 1 << 1,
12 'BPF_F_NUMA_NODE' => 1 << 2,
13 'BPF_F_RDONLY' => 1 << 3,
14 'BPF_F_WRONLY' => 1 << 4,
15 'BPF_F_STACK_BUILD_ID' => 1 << 5,
16 'BPF_F_ZERO_SEED' => 1 << 6,
17 'BPF_F_RDONLY_PROG' => 1 << 7,
18 'BPF_F_WRONLY_PROG' => 1 << 8,
19 'BPF_F_CLONE' => 1 << 9,
20 'BPF_F_MMAPABLE' => 1 << 10,
21 'BPF_F_PRESERVE_ELEMS' => 1 << 11,
22 'BPF_F_INNER_MAP' => 1 << 12,
23 'BPF_F_LINK' => 1 << 13,
24 'BPF_F_PATH_FD' => 1 << 14,
25 'BPF_F_VTYPE_BTF_OBJ_FD' => 1 << 15,
26 'BPF_F_TOKEN_FD' => 1 << 16,
27 'BPF_F_SEGV_ON_FAULT' => 1 << 17,
28 'BPF_F_NO_USER_CONV' => 1 << 18,
29 );
30  
31 3 our @EXPORT_OK = ( keys %constants, 'combine_flags' );
32 3 our %EXPORT_TAGS = ( all => \@EXPORT_OK );
33  
34 3 for my $name ( keys %constants ) {
35 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 0 ▶ *{$name} = sub () { $constants{$name} };
Subroutine __ANON__: not called CC=1 SCAR=0.4
37 }
38  
39 0 ▶sub combine_flags {
Subroutine combine_flags: not called CC=4 SCAR=30.0
Pod undocumented
40 0 my $combined = 0;
41 0 for my $flag (@_) {
42 0 ▶ if ( ref $flag eq 'ARRAY' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $flag eq 'ARRAY') { } 0 0 0
elsif (ref $flag eq 'HASH') { } 0 0 0
43 0 $combined |= combine_flags(@$flag);
44 }
45 elsif ( ref $flag eq 'HASH' ) {
46 0 $combined |= combine_flags( values %$flag );
47 }
48 else {
49 0 $combined |= $flag;
50 }
51 }
52 0 return $combined;
53 }
54  
55 3 1;
« blib/lib/Sys/Ebpf/Link/Netlink/Xdp.pm ↑ Summary blib/lib/Sys/Ebpf/Link/Netlink/Socket.pm »