lib/Linux/Ethtool/WOL.xs

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 34 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/Linux/Ethtool/Settings.xs ↑ Summary
1 #include <stdlib.h>
2 #include <net/if.h>
3 #include <linux/ethtool.h>
4 #include <linux/sockios.h>
5 #include <string.h>
6  
7 #include "EXTERN.h"
8 #include "perl.h"
9 #include "XSUB.h"
10  
11 #include "ppport.h"
12 #include "ethtool.h"
13  
14 MODULE = Linux::Ethtool::WOL PACKAGE = Linux::Ethtool::WOL
15  
16 int
17 _ethtool_gwol(href, dev)
18 SV *href
19 const char *dev
20
21 CODE:
22 0 ▶ if(!(SvROK(href) && SvTYPE(SvRV(href)) == SVt_PVHV))
Branch: 2 branches
BranchTrueFalseTotal
if(!(SvROK(href) && SvTYPE(SvRV(href)) == SVt_PVHV)) 0 0 0
if(!(SvROK(href) && SvTYPE(SvRV(href)) == SVt_PVHV)) 0 0 0
23 {
24 0 croak("First argument must be a hashref");
25 }
26 0 ▶ else if(strlen(dev) >= IFNAMSIZ)
Branch: 1 branch
BranchTrueFalseTotal
else if(strlen(dev) >= IFNAMSIZ) 0 0 0
27 {
28 0 errno = ENAMETOOLONG;
29 0 RETVAL = 0;
30 }
31 else{
32 0 HV *hash = (HV*)(SvRV(href));
33
34 struct ethtool_wolinfo wol;
35 0 wol.cmd = ETHTOOL_GWOL;
36
37 0 ▶ if(_do_ioctl(dev, &wol))
Branch: 1 branch
BranchTrueFalseTotal
if(_do_ioctl(dev, &wol)) 0 0 0
38 {
39 0 hv_store(hash, "supported", 9, newSVuv(wol.supported), 0);
40 0 hv_store(hash, "wolopts", 7, newSVuv(wol.wolopts), 0);
41 0 hv_store(hash, "sopass", 6, newSVpvn(wol.sopass, 6), 0);
42
43 0 RETVAL = 1;
44 }
45 else{
46 0 RETVAL = 0;
47 }
48 }
49 OUTPUT:
50 RETVAL
51  
52 int
53 _ethtool_swol(dev, wolopts, sopass)
54 const char *dev
55 unsigned int wolopts
56 const char *sopass
57
58 CODE:
59 0 ▶ if(strlen(dev) >= IFNAMSIZ)
Branch: 1 branch
BranchTrueFalseTotal
if(strlen(dev) >= IFNAMSIZ) 0 0 0
60 {
61 0 errno = ENAMETOOLONG;
62 0 RETVAL = 0;
63 }
64 else{
65 struct ethtool_wolinfo wol;
66 0 wol.cmd = ETHTOOL_SWOL;
67
68 0 wol.wolopts = wolopts;
69 0 memcpy(wol.sopass, sopass, 6);
70
71 0 ▶ if(_do_ioctl(dev, &wol))
Branch: 1 branch
BranchTrueFalseTotal
if(_do_ioctl(dev, &wol)) 0 0 0
72 {
73 0 RETVAL = 1;
74 }
75 else{
76 0 RETVAL = 0;
77 }
78 }
79 OUTPUT:
80 RETVAL
« lib/Linux/Ethtool/Settings.xs ↑ Summary