164 |
} |
} |
165 |
warn ">>> open abs path: $path [", -e $path ? -s $path : 'new' , "]\n"; |
warn ">>> open abs path: $path [", -e $path ? -s $path : 'new' , "]\n"; |
166 |
return -$! unless sysopen($fh , $path, $mode); |
return -$! unless sysopen($fh , $path, $mode); |
|
warn ">>> after open [",-s $path, "]\n"; |
|
167 |
close($fh); |
close($fh); |
168 |
|
|
169 |
$pending->{$file}->{path} = $path; |
$pending->{$file}->{path} = $path; |
203 |
return -ENOSYS() unless open($fh,'+<',$pending->{$file}->{path}); |
return -ENOSYS() unless open($fh,'+<',$pending->{$file}->{path}); |
204 |
if($rv = seek( $fh ,$off,SEEK_SET)) { |
if($rv = seek( $fh ,$off,SEEK_SET)) { |
205 |
$rv = print( $fh $buf ); |
$rv = print( $fh $buf ); |
206 |
warn "## ", $pending->{$file}->{path}, " $off ",length( $buf ), "\n" if $debug; |
warn "## write ", $pending->{$file}->{path}, " $off ",length( $buf ), "\n" if $debug; |
207 |
} |
} |
208 |
$rv = -ENOSYS() unless $rv; |
$rv = -ENOSYS() unless $rv; |
209 |
close($fh); |
close($fh); |
218 |
sub x_symlink { return symlink(shift,fixup(shift)) ? 0 : -$!; } |
sub x_symlink { return symlink(shift,fixup(shift)) ? 0 : -$!; } |
219 |
|
|
220 |
sub x_rename { |
sub x_rename { |
221 |
my ($old) = fixup(shift); |
my ($old,$new) = @_; |
222 |
my ($new) = fixup(shift); |
my $old_path = fixup($old); |
223 |
my ($err) = rename($old,$new) ? 0 : -ENOENT(); |
my $new_path = fixup($new); |
224 |
|
$new_path .= '.gz' if ( $old_path =~ m/\.gz$/ && $new_path !~ m/\.gz$/ ); |
225 |
|
|
226 |
|
my $err = rename($old_path,$new_path) ? 0 : -ENOENT(); |
227 |
|
warn "## rename( $old_path => $new_path ) = $err\n"; |
228 |
|
|
229 |
|
my $tmp = $mount->{tmp} . '/' . $old; |
230 |
|
if ( -e $tmp ) { |
231 |
|
my $new_tmp = $mount->{tmp} . '/' . $new; |
232 |
|
rename $tmp, $new_tmp || confess "can't rename $tmp -> $new_tmp : $!"; |
233 |
|
} |
234 |
|
|
235 |
return $err; |
return $err; |
236 |
} |
} |
237 |
sub x_link { return link(fixup(shift),fixup(shift)) ? 0 : -$! } |
sub x_link { return link(fixup(shift),fixup(shift)) ? 0 : -$! } |