use strict;
use warnings;
+use ID3FS::Path;
use Fuse;
use POSIX qw(EINVAL EROFS EOPNOTSUPP S_IRUSR S_IRGRP S_IROTH S_IXUSR S_IXGRP S_IXOTH);
use vars qw($TYPE_DIR $TYPE_SYMLINK);
my($rdev,$size)=(0,1);
my($atime,$mtime,$ctime)=(0,0,0);
my($blksize,$blocks)=(512,1);
- my $mode;
- if($filename eq "/")
- {
- $mode=$self->mode($TYPE_DIR);
- }
- else
- {
- $mode=$self->mode($TYPE_SYMLINK);
- }
+
+ my $path=ID3FS::Path->new($self->{db}, $filename);
+ my $mode=$self->mode( $path->isdir() ? $TYPE_DIR : $TYPE_SYMLINK );
return($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks);
}
{
my($self,$filename)=@_;
print "READLINK: $filename\n";
- return "FIXME";
+ my $path=ID3FS::Path->new($self->{db}, $filename);
+ return(-EINVAL()) if($path->isdir());
+ return $path->dest();
}
sub getdir
{
my($self, $filename)=@_;
- print "GETDIR(", ref($self), ": $filename\n";
- if($filename eq "/")
+ print "GETDIR: $filename\n";
+ my $path=ID3FS::Path->new($self->{db}, $filename);
+ if($path->isdir())
{
- return(".", "..", $self->{db}->tags(), 0);
+ return(".", "..", $path->dirents(), 0);
}
- return('.',0);
+ return -ENOTDIR();
}
# unused stubs