/[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 21 by dpavlin, Mon Jul 9 17:35:26 2007 UTC revision 24 by dpavlin, Mon Jul 9 21:57:11 2007 UTC
# Line 12  use File::Path; Line 12  use File::Path;
12  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
13  use Carp qw/confess/;  use Carp qw/confess/;
14  use IO::File;  use IO::File;
15    use Getopt::Long;
16    
17    my $debug = 0;
18    my $fuse_debug = 0;
19    
20    GetOptions(
21            'debug+' => \$debug,
22            'fuse-debug+' => \$fuse_debug,
23    );
24    
25  my $mount = {  my $mount = {
26          from    => '/tmp/comp',          from    => '/tmp/comp',
# Line 19  my $mount = { Line 28  my $mount = {
28          tmp             => '/dev/shm/comp',          tmp             => '/dev/shm/comp',
29  };  };
30    
 my $debug = shift @ARGV;  
   
31  my $skip_extensions_regex = qr/\.(?:sw[a-z]|gif|png|jpeg|jpg|avi|rar|zip|bz2|gz|tgz|avi|mpeg|mpg|tmp|temp)$/i;  my $skip_extensions_regex = qr/\.(?:sw[a-z]|gif|png|jpeg|jpg|avi|rar|zip|bz2|gz|tgz|avi|mpeg|mpg|tmp|temp)$/i;
32    
33  # don't compress files smaller than this  # don't compress files smaller than this
# Line 159  sub x_open { Line 166  sub x_open {
166                  my $dest_path = $tmp;                  my $dest_path = $tmp;
167                  $dest_path =~ s!/[^/]+$!!;      #!vim-fix                  $dest_path =~ s!/[^/]+$!!;      #!vim-fix
168                  mkpath $dest_path unless -e $dest_path;                  mkpath $dest_path unless -e $dest_path;
169                  file_copy( '<:gzip', $path, '>', $tmp );                  if ( -s $path ) {
170                            file_copy( '<:gzip', $path, '>', $tmp )
171                    } else {
172                            warn "ERROR: filesystem corruption, $path is zero size\n";
173                    }
174                  $path = $tmp;                  $path = $tmp;
175          }          }
176    
# Line 243  sub x_rename { Line 254  sub x_rename {
254                  my $path = $pending->{$old}->{path};                  my $path = $pending->{$old}->{path};
255                  $path =~ s/\Q$old\E/$new/;                  $path =~ s/\Q$old\E/$new/;
256                  $pending->{$new}->{path} = $path;                  $pending->{$new}->{path} = $path;
257                    $pending->{$old}->{path} = $path;
258    
259                  delete( $pending->{$old} );                  #delete( $pending->{$old} );
260          }          }
261    
262          return $err;          return $err;
# Line 374  Fuse::main( Line 386  Fuse::main(
386          statfs  =>"main::x_statfs",          statfs  =>"main::x_statfs",
387          release =>"main::x_release",          release =>"main::x_release",
388  #       threaded=>1,  #       threaded=>1,
389  #       debug   => 1,          debug   => $fuse_debug,
390  );  );

Legend:
Removed from v.21  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26