-#if 0
-/*
- * This doesn't yet work... we alwas get ENOSYS when trying to use readdir().
- * Well, of course, getdir() is fine as well.
- */
- int _PLfuse_readdir(const char *file, void *dirh, fuse_fill_dir_t dirfil, off_t off, struct fuse_file_info *fi) {
-#endif
+int _PLfuse_opendir(const char *file, struct fuse_file_info *info) {
+ croak("opendir NOT IMPLEMENTED");
+}
+int _PLfuse_releasedir(const char *file, struct fuse_file_info *info) {
+ croak("releasedir NOT IMPLEMENTED");
+}
+int _PLfuse_fsyncdir(const char *file, struct fuse_file_info *info) {
+ croak("fsyncdir NOT IMPLEMENTED");
+}
+
+int _PLfuse_readdir(const char *file, void *dirh, fuse_fill_dir_t dirfil, off_t off, struct fuse_file_info *fi) {
+ int prv, rv, offset;
+ SV *entry;
+ FUSE_CONTEXT_PRE;
+ DEBUGf("readdir begin\n");
+ ENTER;
+ SAVETMPS;
+ PUSHMARK(SP);
+ XPUSHs(sv_2mortal(newSVpv(file,0)));
+ XPUSHs(sv_2mortal(newSViv(off)));
+ PUTBACK;
+ prv = call_sv(MY_CXT.callback[26],G_ARRAY);
+ SPAGAIN;
+ if(3 == prv) {
+ rv = POPi;
+ offset = POPi;
+ entry = POPs;
+ if(SvOK(entry))
+ dirfil(dirh,SvPV_nolen(entry),NULL,offset);
+ } else {
+ fprintf(stderr,"readdir() handler didn't return 2 values!\n");
+ rv = -ENOSYS;
+ }
+ FREETMPS;
+ LEAVE;
+ PUTBACK;
+ DEBUGf("readdir end: %i\n",rv);
+ FUSE_CONTEXT_POST;
+ return rv;
+}
+