/[fuse-comp]/fuse-comp.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /fuse-comp.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 30 by dpavlin, Tue Jul 10 10:48:21 2007 UTC revision 33 by dpavlin, Mon Jul 16 07:41:55 2007 UTC
# Line 146  sub tmp_path { Line 146  sub tmp_path {
146                          if ( -s $path ) {                          if ( -s $path ) {
147                                  file_copy( '<:gzip', $path, '>', $tmp )                                  file_copy( '<:gzip', $path, '>', $tmp )
148                          } else {                          } else {
149                                  confess "ASSERT: filesystem corruption, $path is zero size\n";                                  confess "ASSERT: filesystem corruption, $path is zero size in ",dump( $pending );
150                          }                          }
151                          $path = $tmp;                          $path = $tmp;
152                          $op = 'created';                          $op = 'created';
# Line 155  sub tmp_path { Line 155  sub tmp_path {
155                  confess "ASSERT: open shouldn't exist for $file in ", dump( $pending ) if defined( $pending->{$file}->{open} );                  confess "ASSERT: open shouldn't exist for $file in ", dump( $pending ) if defined( $pending->{$file}->{open} );
156                  $pending->{$file}->{path} = $path;                  $pending->{$file}->{path} = $path;
157                  $pending->{$file}->{open} = 0;  # not really opened, just uncompressed                  $pending->{$file}->{open} = 0;  # not really opened, just uncompressed
158                  warn "## tmp_file( $file ) $op $path [", -s $path, "]\n";                  warn "## tmp_file( $file ) $op $path [", -s $path, "]\n" if $debug;
159          }          }
160          return $path;          return $path;
161  }  }
# Line 174  sub compress_file2path { Line 174  sub compress_file2path {
174                  } elsif ( ! $path ) {                  } elsif ( ! $path ) {
175                          $path = $pending_path;                          $path = $pending_path;
176                  } elsif ( $pending_path ne $path ) {                  } elsif ( $pending_path ne $path ) {
177                          confess "ASSERT: compressing into $path instead of $pending_path\n";                          confess "ASSERT: compressing into $path instead of $pending_path";
178                  }                  }
179          }          }
180    
# Line 203  sub compress_file2path { Line 203  sub compress_file2path {
203                  my ( $size_path, $size_comp ) = ( -s $path, -s $comp );                  my ( $size_path, $size_comp ) = ( -s $path, -s $comp );
204    
205                  if ( $size_path <= $size_comp ) {                  if ( $size_path <= $size_comp ) {
206                          warn ">>> $size_path <= $size_comp leaving uncompressed\n";                          warn ">>> $size_path <= $size_comp leaving uncompressed $dest\n";
207                          unlink $comp || confess "can't remove: $comp: $!";                          unlink $comp || confess "can't remove: $comp: $!";
208                            file_copy( '<', $path, '>', $dest ) if ( $path ne $dest );
209                  } else {                  } else {
210                          warn ">>> compressed $size_path -> $size_comp ",int(($size_comp * 100) / $size_path),"% $comp\n";                          warn ">>> compressed $size_path -> $size_comp ",int(($size_comp * 100) / $size_path),"% $comp\n";
211    
# Line 373  sub x_rename { Line 374  sub x_rename {
374          my $tmp = $mount->{tmp} . '/' . $old;          my $tmp = $mount->{tmp} . '/' . $old;
375          if ( -e $tmp ) {          if ( -e $tmp ) {
376                  if ( $new =~ m#\Q/.fuse_hidden\E# ) {                  if ( $new =~ m#\Q/.fuse_hidden\E# ) {
377                          unlink $tmp || confess "can't unlink $tmp for $new\n";                          unlink $tmp || confess "can't unlink $tmp for $new";
378                  } else {                  } else {
379                          my $new_tmp = $mount->{tmp} . '/' . $new;                          my $new_tmp = $mount->{tmp} . '/' . $new;
380                          rename $tmp, $new_tmp || confess "can't rename $tmp -> $new_tmp : $!";                          rename $tmp, $new_tmp || confess "can't rename $tmp -> $new_tmp : $!";

Legend:
Removed from v.30  
changed lines
  Added in v.33

  ViewVC Help
Powered by ViewVC 1.1.26