Skip to content

Commit

Permalink
pmirror: style: fix whitespace issues
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Jun 20, 2016
1 parent edd465c commit f234f42
Showing 1 changed file with 7 additions and 37 deletions.
44 changes: 7 additions & 37 deletions pmirror/pmirror
Original file line number Diff line number Diff line change
@@ -57,7 +57,6 @@ use Fcntl ':mode';
# P path perm uid gid - mtime hardlink
# S path perm uid gid - mtime hardlink


sub name_escaped
{
my ($self)=shift;
@@ -221,11 +220,10 @@ sub cache_local_fs
my ($fs,$path,$type)=($1,$2,$3);
next unless $type && $type =~ /^advfs|ufs|ext\d+|reiserfs|xfs|fuseblk|vfat|efs|tmpfs|btrfs$/;
my @F = lstat($path) or die "$path: $!\n";
$LOCAL_DEV{$F[0]}=$path;
$LOCAL_DEV{$F[0]}=$path;
}
}


#---------------------------- lchown / mknod

our ($machine,$SYS_lchown,$SYS_mknod,$lmtime_sub);
@@ -374,7 +372,6 @@ sub fileop_mv
rename($from,$to) or die "$from: $!\n";
}


sub fileop_rm
{
my ($path)=@_;
@@ -391,7 +388,6 @@ sub fileop_rmdir_recurse
system 'rm','-rf',$path and exit 1;
}


sub fileop_symlink
{
my ($from,$to)=@_;
@@ -450,8 +446,6 @@ sub size

#--------------------------------------------



sub receive_bytes
{
my ($io,$bufref,$len)=@_;
@@ -466,7 +460,6 @@ sub receive_bytes
return $_[2]; # orig $len
}


sub receive_record
{
my ($io,$bufref)=@_;
@@ -480,8 +473,6 @@ sub receive_record
return receive_bytes($io,$bufref,$len)
}



sub writebuf {
my ($fh,$buf,$len)=@_;
my $pos=0;
@@ -495,16 +486,12 @@ sub writebuf {
}
}




sub send_file
{
my ($filename)=@_;
my $data_buf;
my $len;


my $fh=IO::File->new($filename,O_RDONLY);
unless (defined $fh)
{
@@ -535,7 +522,7 @@ sub send_file
$bw_column = $oc + 1.0;
}
$bw_column -= 0.02;
printf STDERR " %*s ",int($bw_column-$oc)+7,size($size,1);
printf STDERR " %*s ",int($bw_column-$oc)+7,size($size,1);
}
while(1)
{
@@ -547,12 +534,11 @@ sub send_file
}
if ($bandwidth && !$quiet)
{
$duration = Time::HiRes::time() - $duration + 0.00001; # prevent div by zero
printf STDERR " in %5.2fs %7s/s",$duration,size($size/$duration,1);
$duration = Time::HiRes::time() - $duration + 0.00001; # prevent div by zero
printf STDERR " in %5.2fs %7s/s",$duration,size($size/$duration,1);
}
}


sub receive_file
{
my ($filename,$expected_size,$perm)=@_;
@@ -582,7 +568,6 @@ sub receive_file
}
}


#--------------------------------------------

sub cksum {
@@ -625,7 +610,6 @@ sub master_wanted_func
return;
}


if ($st->type eq 'D' && $filename =~ /\/(package|project|confidential|home|scratch|src)\/[^\/]+\.DELETEME$/ ) {
$File::Find::prune=1;
return;
@@ -646,7 +630,6 @@ sub master_wanted_func
}
}


my $sum= $cksum && $st->type eq 'F' ? cksum($filename) : '-';

$out->print($st->export_index,$hardlink,$sum);
@@ -680,7 +663,6 @@ sub master_wanted_func
}
}


# File::Find might walk errornously into symlinks
#
# this is what happens:
@@ -726,7 +708,6 @@ sub master
flock($lock_handle,LOCK_EX|LOCK_NB) or die (($!==11 || $!==35) ? "mirror $lockident already running\n" : "$lockfilename: $!\n");
}


unless ($allowremotefs)
{
my $st=My::FileInfo->lstat('.');
@@ -768,7 +749,7 @@ sub master
my @l;
if ($slave)
{
@l=
@l=
(
'ssh',
$identity_file ? ('-i',$identity_file) : (),
@@ -817,7 +798,6 @@ sub master
$out->print('!',fn_escape($_));
}


local $SIG{__WARN__}=sub { die $_[0] };
find
(
@@ -875,7 +855,6 @@ sub make_dir
fileop_chmod($mode,$path);
}


sub out_of_the_way
{
my ($st)=@_;
@@ -897,17 +876,13 @@ sub out_of_the_way

#--------------------------------------------


sub tmpfilename # './bla/lall/troeoet/lalala.txt' -> './bla/lall/troeoet/pmirror.1234.tmp'
{
my ($path)=@_;
my ($name)=$path=~m"([^/]+)$" or die "$path: bad pathname\n";
return substr($path,0,-length($name)).'pmirror.'.$$.'.tmp';
}




sub slave
{
$in=\*STDIN;
@@ -950,7 +925,6 @@ sub slave

my $crc_missmatch=0;


INDEX_RECORD:
while (defined ($_=$in->getline))
{
@@ -1003,7 +977,7 @@ INDEX_RECORD:
$fileop_noop or warn "hardlink source $hardlink: $!\n";
$st_want->type eq 'F' and $out->print('CONTINUE');
next;
}
}

if ( !$st_is || $st_is->dev!=$st_src->dev || $st_is->ino != $st_src->ino)
{
@@ -1167,7 +1141,6 @@ INDEX_RECORD:
}
$reduce and exit;


for (my $i=0;$i<@DIR_MTIME_QUEUE;$i+=2)
{
my ($fn,$mtime)=($DIR_MTIME_QUEUE[$i],$DIR_MTIME_QUEUE[$i+1]);
@@ -1228,7 +1201,6 @@ usage: $0 [options] path [node:]path
--unprivileged do not attempt to set file ownership, even if root
--nice EXPERIMENTAL nice
__EOF__

use constant OPTIONS =>
@@ -1257,7 +1229,6 @@ use constant OPTIONS =>
'nice' => \$nice,
);


if ($ENV{SSH_ORIGINAL_COMMAND})
{

@@ -1281,7 +1252,6 @@ else
@ARGV==2 or die USAGE;
my ($master_path,$target)=@ARGV;


# excludes only work with a full path

push @EXCEPTS,'./quota.group';
@@ -1299,7 +1269,7 @@ else
($slave,$slave_path)=($1,$2);
if ($slave=~/^([^\@]+)\@(.+)$/) # user@system:/path
{
($slave_user, $slave) = ($1, $2);
($slave_user, $slave) = ($1, $2);
}
}
else # /path

0 comments on commit f234f42

Please sign in to comment.