--- fuse-comp.pl 2007/07/08 21:03:26 10 +++ fuse-comp.pl 2007/07/09 10:35:02 12 @@ -127,6 +127,18 @@ sub x_open { my ($file) = shift; my ($mode) = shift; + + if ( $file eq '/.debug' ) { + my $path = $mount->{from} . '/.debug'; + open( my $debug, '>', $path ) || die "can't open $path: $!"; + my $dump = dump( $pending ); + print $debug "pending = $dump\n"; + close($debug); + $pending->{'/.debug'}->{path} = $path; + warn "## created dump $path $dump\n"; + return 0; + } + $pending->{$file}->{open}++; my $mode_desc = { @@ -151,6 +163,7 @@ } warn ">>> open abs path: $path ", -s $path, " bytes\n"; return -$! unless sysopen($fh , $path, $mode); + close($fh); $pending->{$file}->{path} = $path; return 0; @@ -161,6 +174,8 @@ my ($rv) = -ENOSYS(); my $path = fixup( $file ); + confess "no pending file $file ", dump( $pending ) unless defined( $pending->{$file} ); + return -ENOENT() unless -e $path; my $fh = new IO::File; @@ -179,6 +194,8 @@ my $rv; my $path = fixup($file); + confess "no pending file $file ", dump( $pending ) unless defined( $pending->{$file} ); + return -ENOENT() unless -e $path; my $fh = new IO::File; @@ -188,6 +205,7 @@ warn "## ", $pending->{$file}->{path}, " $off ",length( $buf ), "\n" if $debug; } $rv = -ENOSYS() unless $rv; + close($fh); return length($buf); }