12 |
use Carp; |
use Carp; |
13 |
use Data::Dumper; |
use Data::Dumper; |
14 |
|
|
15 |
our $VERSION = '0.07'; |
our $VERSION = '0.08'; |
16 |
|
|
17 |
# block size for this filesystem |
# block size for this filesystem |
18 |
use constant BLOCK => 1024; |
use constant BLOCK => 1024; |
329 |
|
|
330 |
# read them in with sesible defaults |
# read them in with sesible defaults |
331 |
while (my $row = $sth->{'filenames'}->fetchrow_hashref() ) { |
while (my $row = $sth->{'filenames'}->fetchrow_hashref() ) { |
332 |
|
$row->{'filename'} ||= 'NULL-'.$row->{'id'}; |
333 |
$files{$row->{'filename'}} = { |
$files{$row->{'filename'}} = { |
334 |
size => $row->{'size'}, |
size => $row->{'size'}, |
335 |
mode => $row->{'writable'} ? 0644 : 0444, |
mode => $row->{'writable'} ? 0644 : 0444, |
336 |
id => $row->{'id'} || 99, |
id => $row->{'id'} || 99, |
337 |
}; |
}; |
338 |
|
|
339 |
|
|
340 |
my $d; |
my $d; |
341 |
foreach (split(m!/!, $row->{'filename'})) { |
foreach (split(m!/!, $row->{'filename'})) { |
342 |
# first, entry is assumed to be file |
# first, entry is assumed to be file |
375 |
$file =~ s,^/,,; |
$file =~ s,^/,,; |
376 |
$file = '.' unless length($file); |
$file = '.' unless length($file); |
377 |
return -ENOENT() unless exists($files{$file}); |
return -ENOENT() unless exists($files{$file}); |
378 |
my ($size) = $files{$file}{size} || BLOCK; |
my ($size) = $files{$file}{size} || 0; |
379 |
my ($dev, $ino, $rdev, $blocks, $gid, $uid, $nlink, $blksize) = (0,0,0,int(($size+BLOCK-1)/BLOCK),0,0,1,BLOCK); |
my ($dev, $ino, $rdev, $blocks, $gid, $uid, $nlink, $blksize) = (0,0,0,int(($size+BLOCK-1)/BLOCK),0,0,1,BLOCK); |
380 |
my ($atime, $ctime, $mtime); |
my ($atime, $ctime, $mtime); |
381 |
$atime = $ctime = $mtime = $files{$file}{ctime} || $ctime_start; |
$atime = $ctime = $mtime = $files{$file}{ctime} || $ctime_start; |
434 |
|
|
435 |
read_content($file,$files{$file}{id}) unless exists($files{$file}{cont}); |
read_content($file,$files{$file}{id}) unless exists($files{$file}{cont}); |
436 |
|
|
437 |
|
$files{$file}{cont} ||= ''; |
438 |
print "open '$file' ",length($files{$file}{cont})," bytes\n"; |
print "open '$file' ",length($files{$file}{cont})," bytes\n"; |
439 |
return 0; |
return 0; |
440 |
} |
} |