$cp->{$k} = $v;
}
$ccache->{$filename} = $cp;
- }
+ }
return ($ccache->{$filename}, $filename);
}
}
-
+
$filename = $ccachemap->{$filename} if defined ($ccachemap->{$filename});
die "file '$filename' not added :ERROR" if !defined ($ccache->{$filename});
-
+
return ($ccache->{$filename}, $filename);
}
if (!rename($tmpname, $realname)) {
my $msg = "close (rename) atomic file '$filename' failed: $!\n";
unlink $tmpname;
- die $msg;
+ die $msg;
}
my $diff;
my $code = sub {
$fd = IO::File->new ($filename, "r");
-
+
my $new = &$update($filename, $fd, $data, @args);
if (defined($new)) {
my $parser;
my ($ccinfo, $filename) = ccache_info($fileid);
-
+
$parser = $ccinfo->{parser};
-
+
my $fd;
my $shadow;
if (!$fd) {
$ccinfo->{version} = undef;
- $ccinfo->{data} = undef;
+ $ccinfo->{data} = undef;
$ccinfo->{diff} = undef;
return undef if !$acp;
}
$ret->{data} = $ccinfo->{data};
}
$ret->{changes} = $ccinfo->{diff};
-
+
return $full ? $ret : $ret->{data};
}
$ret->{changes} = $ccinfo->{diff};
return $full ? $ret : $ret->{data};
-}
+}
sub parse_ccache_options {
my ($ccinfo, %options) = @_;
$ccinfo->{update} = $update;
parse_ccache_options($ccinfo, %options);
-
+
if ($options{shadow}) {
$shadowfiles->{$filename} = $options{shadow};
}
my $uid = "$dir/$regex";
die "regular expression '$uid' already added :ERROR" if defined ($ccacheregex->{$uid});
-
+
my $ccinfo = {};
$ccinfo->{dir} = $dir;
foreach my $uid (keys %$ccacheregex) {
my $ccinfo = $ccacheregex->{$uid};
- $dirhash->{$ccinfo->{dir}}->{_regex} = 1;
+ $dirhash->{$ccinfo->{dir}}->{_regex} = 1;
}
$inotify_pid = $$;
syslog ('err', "got 'unmount' event on '$name' - disabling inotify");
$inotify = undef;
}
- if ($e->IN_IGNORED) {
+ if ($e->IN_IGNORED) {
syslog ('err', "got 'ignored' event on '$name' - disabling inotify");
$inotify = undef;
}
next if $dir ne $ccinfo->{dir};
my $re = $ccinfo->{regex};
if (my $fd = IO::Dir->new ($dir)) {
- while (defined(my $de = $fd->read)) {
+ while (defined(my $de = $fd->read)) {
if ($de =~ m/^$re$/) {
my $fn = "$dir/$de";
$versions->{$fn}++; # init with version
return $hostname;
}
-register_file('hostname', "/etc/hostname",
- \&read_etc_hostname,
+register_file('hostname', "/etc/hostname",
+ \&read_etc_hostname,
\&write_etc_hostname);
sub read_etc_hosts {
next if $line =~ m/^(search|domain|nameserver)\s+/;
$data .= $line
}
-
+
return $data;
}
-register_file('resolvconf', "/etc/resolv.conf",
- \&read_etc_resolv_conf, undef,
+register_file('resolvconf', "/etc/resolv.conf",
+ \&read_etc_resolv_conf, undef,
\&update_etc_resolv_conf);
sub read_etc_timezone {
}
-register_file('timezone', "/etc/timezone",
- \&read_etc_timezone,
+register_file('timezone', "/etc/timezone",
+ \&read_etc_timezone,
\&write_etc_timezone);
sub read_active_workers {
return [] if !$fh;
- my $res = [];
+ my $res = [];
while (defined (my $line = <$fh>)) {
if ($line =~ m/^(\S+)\s(0|1)(\s([0-9A-Za-z]{8})(\s(\s*\S.*))?)?$/) {
my $upid = $1;
PVE::Tools::safe_print($filename, $fh, $raw) if $raw;
}
-register_file('active', "/var/log/pve/tasks/active",
+register_file('active', "/var/log/pve/tasks/active",
\&read_active_workers,
\&write_active_workers);
'active-backup' => 1,
'balance-slb' => 1,
'lacp-balance-slb' => 1,
- 'lacp-balance-tcp' => 1,
+ 'lacp-balance-tcp' => 1,
};
#sub get_bond_modes {
}
# we try to keep order inside the file
- my $priority = 2; # 1 is reserved for lo
+ my $priority = 2; # 1 is reserved for lo
SECTION: while (defined ($line = <$fh>)) {
chomp ($line);
next if $line =~ m/^\s*#/;
-
+
if ($line =~ m/^\s*auto\s+(.*)$/) {
my @aa = split (/\s+/, $1);
}
$done->{bridge_vlan_aware} = 1;
$done->{bridge_vids} = 1;
-
+
} elsif ($d->{type} eq 'bond') {
$d->{slaves} =~ s/[;,\s]+/ /g;
}
$done->{'bond_xmit_hash_policy'} = 1;
} elsif ($d->{type} eq 'vlan') {
- die "$iface: wrong vlan-protocol $d->{'vlan-protocol'}\n"
+ die "$iface: wrong vlan-protocol $d->{'vlan-protocol'}\n"
if $d->{'vlan-protocol'} && $d->{'vlan-protocol'} ne '802.1ad' && $d->{'vlan-protocol'} ne '802.1q';
-
+
} elsif ($d->{type} eq 'vxlan') {
foreach my $k (qw(vxlan-id vxlan-svcnodeip vxlan-physdev vxlan-local-tunnelip)) {
my $d = $ifaces->{$iface};
if (my $uplinkid = $d->{'uplink-id'}) {
die "iface '$iface' - uplink-id $uplinkid is only allowed on physical and linux bond interfaces\n"
- if $d->{type} ne 'eth' && $d->{type} ne 'bond';
+ if $d->{type} ne 'eth' && $d->{type} ne 'bond';
die "iface '$iface' - uplink-id $uplinkid is already assigned on '$uplinks->{$uplinkid}'\n"
if $uplinks->{$uplinkid};
return 'undefined';
}
-register_file('initiatorname', "/etc/iscsi/initiatorname.iscsi",
+register_file('initiatorname', "/etc/iscsi/initiatorname.iscsi",
\&read_iscsi_initiatorname);
sub read_apt_auth {
$raw =~ s/^\s+//;
-
+
my @tokens = split(/\s+/, $raw);
my $data = {};
my $raw = &$format_apt_auth_data($data);
die "write failed: $!" unless print $fh "$raw\n";
-
+
return $data;
}
return &$format_apt_auth_data($orig);
}
-register_file('apt-auth', "/etc/apt/auth.conf",
+register_file('apt-auth', "/etc/apt/auth.conf",
\&read_apt_auth, \&write_apt_auth,
\&update_apt_auth, perm => 0640);