#else
#define DEBUGf(a...)
#endif
-static int
-not_here(char *s)
-{
- croak("%s not implemented on this architecture", s);
- return -1;
-}
-
-static double
-constant(char *name, int len, int arg)
-{
- errno = ENOENT;
- return 0;
-}
SV *_PLfuse_callbacks[18];
int _PLfuse_getattr(const char *file, struct stat *result) {
dSP;
int rv, statcount;
- DEBUGf("getattr begin: %i\n",sp-PL_stack_base);
ENTER;
SAVETMPS;
PUSHMARK(SP);
FREETMPS;
LEAVE;
PUTBACK;
- DEBUGf("getattr end: %i\n",sp-PL_stack_base);
return rv;
}
char *rvstr;
dSP;
I32 ax;
- DEBUGf("readlink begin: %i\n",sp-PL_stack_base);
if(buflen < 1)
return EINVAL;
ENTER;
rv = -ENOENT;
else {
SV *mysv = POPs;
- DEBUGf("type = %i\n",SvTYPE(mysv));
if(SvTYPE(mysv) == SVt_IV || SvTYPE(mysv) == SVt_NV)
rv = SvIV(mysv);
else {
}
FREETMPS;
LEAVE;
- DEBUGf("ribbit3: %i (%s)\n",rv,buf);
buf[buflen-1] = 0;
PUTBACK;
- DEBUGf("readlink end: %i\n",sp-PL_stack_base);
return rv;
}
int _PLfuse_getdir(const char *file, fuse_dirh_t dirh, fuse_dirfil_t dirfil) {
int prv, rv;
dSP;
- DEBUGf("getdir begin: %i\n",sp-PL_stack_base);
ENTER;
SAVETMPS;
PUSHMARK(SP);
FREETMPS;
LEAVE;
PUTBACK;
- DEBUGf("getdir end: %i\n",sp-PL_stack_base);
return rv;
}
SV *rvsv;
char *rvstr;
dSP;
- DEBUGf("mknod begin: %i\n",sp-PL_stack_base);
ENTER;
SAVETMPS;
PUSHMARK(SP);
FREETMPS;
LEAVE;
PUTBACK;
- DEBUGf("mknod end: %i\n",sp-PL_stack_base);
return rv;
}
FREETMPS;
LEAVE;
PUTBACK;
- DEBUGf("mkdir end: %i\n",sp-PL_stack_base);
+ DEBUGf("mkdir end: %i %i\n",sp-PL_stack_base,rv);
return rv;
}
FREETMPS;
LEAVE;
PUTBACK;
- DEBUGf("rmdir end: %i\n",sp-PL_stack_base);
+ DEBUGf("rmdir end: %i %i\n",sp-PL_stack_base,rv);
return rv;
}
MODULE = Fuse PACKAGE = Fuse
PROTOTYPES: DISABLE
-
-double
-constant(sv,arg)
- PREINIT:
- STRLEN len;
- INPUT:
- SV * sv
- char * s = SvPV(sv, len);
- int arg
- CODE:
- RETVAL = constant(s,len,arg);
- OUTPUT:
- RETVAL
-
void
perl_fuse_main(...)
PREINIT:
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'Fuse.pm', # retrieve abstract from module
AUTHOR => 'Mark Glines <mark@glines.org>') : ()),
- 'LIBS' => [''], # e.g., '-lm'
+ 'LIBS' => ['-lefence'], # e.g., '-lm'
'DEFINE' => '-g -ggdb', # e.g., '-DHAVE_SOMETHING'
# Insert -I. if you add *.h files later:
'INC' => '-I../include', # e.g., '-I/usr/include/other'
and is therefore subject to the same license and copyright as FUSE itself.
Please see the AUTHORS and COPYING files from the FUSE distribution for
more information.
+
+BUGS
+
+Currently theres a huge problem with atomicity - putting an md5sum or something
+in a while loop, and cd'ing into the mountpoint from a different directory
+causes some interesting failures. For normal perl, every call should grab a
+global lock. For thread-perl, I'm gonna have to do some research to figure out
+the best solution.
+
+Quite a few things aren't tested.
+
+The tested (and seemingly working) stuff includes:
+getattr
+readlink
+getdir
+mknod
+mkdir
+unlink
+rmdir
+open
+read
+statfs
+
+which leaves:
+symlink
+rename
+link
+chmod
+chown
+truncate
+utime
+write
+
sub x_getattr {
my ($file) = fixup(shift);
- debug("getattr $file");
return -ENOENT() unless -e $file;
- debug(lstat($file));
return (lstat($file));
}
sub x_getdir {
my ($dirname) = fixup(shift);
- debug("getdir >$dirname<");
unless(opendir(DIRHANDLE,$dirname)) {
- debug("ENOENT");
return -ENOENT();
}
- debug("ok");
my (@files) = readdir(DIRHANDLE);
closedir(DIRHANDLE);
- debug(@files);
return (@files, 0);
}
sub x_open {
my ($file) = fixup(shift);
- debug("open flags = $_[0]");
my ($fd) = POSIX::open($file,@_);
- if(!defined($fd)) {
- debug("POSIX::open(".join(",",$file,@_).") returned undef");
- return -ENOSYS();
- }
- debug("open $file = $fd");
+ return -ENOSYS() if(!defined($fd));
return $fd if $fd < 0;
POSIX::close($fd);
return 0;
sub x_symlink { return err(symlink(fixup(shift),fixup(shift))); }
sub x_rename { return err(rename(fixup(shift),fixup(shift)) ); }
sub x_link { return err(link(fixup(shift),fixup(shift)) ); }
-sub x_mkdir { return err(mkdir(fixup(shift),shift) ); }
sub x_chmod { return err(chmod(fixup(shift),shift) ); }
sub x_chown { return err(chown(fixup(shift),shift,shift) ); }
sub x_chmod { return err(chmod(fixup(shift),shift) ); }
sub x_truncate { return truncate(fixup(shift),shift) ? 0 : -$! ; }
sub x_utime { return utime($_[1],$_[2],fixup($_[0])) ? 0:-$!; }
+sub x_mkdir { my ($name, $perm) = @_; return 0 if mkdir(fixup($name),$perm); return -$!; }
+sub x_rmdir { return 0 if rmdir fixup(shift); return -$!; }
+
sub x_mknod {
# since this is called for ALL files, not just devices, I'll do some checks
# and possibly run the real mknod command.