/[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 12 by dpavlin, Mon Jul 9 10:35:02 2007 UTC revision 13 by dpavlin, Mon Jul 9 11:12:48 2007 UTC
# Line 103  sub x_getdir { Line 103  sub x_getdir {
103    
104  sub file_copy {  sub file_copy {
105          my ( $s_opt, $s_path, $d_opt, $d_path ) = @_;          my ( $s_opt, $s_path, $d_opt, $d_path ) = @_;
106          warn "## file_copy( $s_opt $s_path $d_opt $d_path )\n";          warn "## file_copy( $s_opt $s_path [",-s $s_path,"] $d_opt $d_path [",-e $d_path ? -s $d_path : 'new',"])\n";
107          open(my $s, $s_opt, $s_path ) || confess "can't open $s_path: $!\npending = ", dump( $pending );          open(my $s, $s_opt, $s_path ) || confess "can't open $s_path: $!\npending = ", dump( $pending );
108          open(my $d, $d_opt, $d_path ) || confess "can't open $d_path: $!";          open(my $d, $d_opt, $d_path ) || confess "can't open $d_path: $!";
109          my $buff;          my $buff;
110          while( read( $s, $buff, 65535 ) ) {          while( read( $s, $buff, 65535 ) ) {
111                  print $d $buff || confess "can't write into $d_path: $!";                  print $d $buff || confess "can't write into $d_path: $!";
112                  warn ">> ", length($buff), " bytes, offset ", tell($s), " -> ", tell($d), "\n" if $debug;                  warn ">> [", length($buff), "] offset ", tell($s), " -> ", tell($d), "\n" if $debug;
113          }          }
114          close($d) || warn "can't close $d_path: $!";          close($d) || warn "can't close $d_path: $!";
115          close($s) || warn "can't close $s_path: $!";          close($s) || warn "can't close $s_path: $!";
# Line 161  sub x_open { Line 161  sub x_open {
161                  file_copy( '<:gzip', $path, '>', $tmp );                  file_copy( '<:gzip', $path, '>', $tmp );
162                  $path = $tmp;                  $path = $tmp;
163          }          }
164          warn ">>> open abs path: $path ", -s $path, " bytes\n";          warn ">>> open abs path: $path [", -s $path, "]\n";
165          return -$! unless sysopen($fh , $path, $mode);          return -$! unless sysopen($fh , $path, $mode);
166          close($fh);          close($fh);
167    
# Line 281  sub x_release { Line 281  sub x_release {
281                          warn "release $file $mode -- uncompressed\n";                          warn "release $file $mode -- uncompressed\n";
282                          file_copy( '<', $path, '>', $dest ) if ( $path ne $dest );                          file_copy( '<', $path, '>', $dest ) if ( $path ne $dest );
283                  } elsif ( -s $path < $min_compress_size ) {                  } elsif ( -s $path < $min_compress_size ) {
284                          warn "release $file -- uncompressed, too small ", -s $path, " bytes\n";                          warn "release $file -- uncompressed, too small [", -s $path, "]\n";
285                          file_copy( '<', $path, '>', $dest ) if ( $path ne $dest );                          file_copy( '<', $path, '>', $dest ) if ( $path ne $dest );
286                  } else {                  } else {
287                          warn "release $file $mode -- compressing\n";                          warn "release $file $mode -- compressing\n";
# Line 294  sub x_release { Line 294  sub x_release {
294                  }                  }
295          } else {          } else {
296                  warn "release $file, but still used ", $pending->{$file}->{open} , " times, delaying compression\n";                  warn "release $file, but still used ", $pending->{$file}->{open} , " times, delaying compression\n";
                 $pending->{$file}->{open}--;  
                 return 0;  
297          }          }
298          delete( $pending->{$file} );          $pending->{$file}->{open}--;
299            if ( $pending->{$file}->{open} == 0 ) {
300                    warn "## cleanup pending $file [", -s fixup($file), "]\n" if $debug;
301                    delete( $pending->{$file} );
302            }
303          return 0;          return 0;
304  }  }
305    

Legend:
Removed from v.12  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26