int _PLfuse_truncate (const char *file, off_t off) {
int rv;
+#ifndef PERL_HAS_64BITINT
+ char *temp;
+#endif
FUSE_CONTEXT_PRE;
DEBUGf("truncate begin\n");
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(file,0)));
+#ifdef PERL_HAS_64BITINT
XPUSHs(sv_2mortal(newSViv(off)));
+#else
+ asprintf(&temp, "%llu", off);
+ XPUSHs(sv_2mortal(newSVpv(temp, 0)));
+ free(temp);
+#endif
PUTBACK;
rv = call_sv(_PLfuse_callbacks[12],G_SCALAR);
SPAGAIN;
int _PLfuse_read (const char *file, char *buf, size_t buflen, off_t off, struct fuse_file_info *fi) {
int rv;
+#ifndef PERL_HAS_64BITINT
+ char *temp;
+#endif
FUSE_CONTEXT_PRE;
DEBUGf("read begin\n");
ENTER;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(file,0)));
XPUSHs(sv_2mortal(newSViv(buflen)));
+#ifdef PERL_HAS_64BITINT
XPUSHs(sv_2mortal(newSViv(off)));
+#else
+ asprintf(&temp, "%llu", off);
+ XPUSHs(sv_2mortal(newSVpv(temp, 0)));
+ free(temp);
+#endif
XPUSHs(fi->fh==0 ? &PL_sv_undef : (SV *)fi->fh);
PUTBACK;
rv = call_sv(_PLfuse_callbacks[15],G_SCALAR);
int _PLfuse_write (const char *file, const char *buf, size_t buflen, off_t off, struct fuse_file_info *fi) {
int rv;
+#ifndef PERL_HAS_64BITINT
+ char *temp;
+#endif
FUSE_CONTEXT_PRE;
DEBUGf("write begin\n");
ENTER;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(file,0)));
XPUSHs(sv_2mortal(newSVpvn(buf,buflen)));
+#ifdef PERL_HAS_64BITINT
XPUSHs(sv_2mortal(newSViv(off)));
+#else
+ asprintf(&temp, "%llu", off);
+ XPUSHs(sv_2mortal(newSVpv(temp, 0)));
+ free(temp);
+#endif
XPUSHs(fi->fh==0 ? &PL_sv_undef : (SV *)fi->fh);
PUTBACK;
rv = call_sv(_PLfuse_callbacks[16],G_SCALAR);
struct fuse_operations fops =
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
- int i, fd, debug, threaded;
+ int i, debug, threaded;
char *mountpoint;
char *mountopts;
struct fuse_args margs = FUSE_ARGS_INIT(0, NULL);
struct fuse_args fargs = FUSE_ARGS_INIT(0, NULL);
+ struct fuse_chan *fc;
INIT:
if(items != 29) {
fprintf(stderr,"Perl<->C inconsistency or internal error\n");
fuse_opt_free_args(&margs);
croak("out of memory\n");
}
- fd = fuse_mount(mountpoint,&margs);
+ fc = fuse_mount(mountpoint,&margs);
fuse_opt_free_args(&margs);
- if(fd < 0)
+ if (fc == NULL)
croak("could not mount fuse filesystem!\n");
if (debug) {
if ( fuse_opt_add_arg(&fargs, "") == -1 ||
if (fuse_opt_add_arg(&fargs, "") == -1)
croak("out of memory\n");
}
-
+#ifndef __NetBSD__
if(threaded) {
- fuse_loop_mt(fuse_new(fd,&fargs,&fops,sizeof(fops)));
+ fuse_loop_mt(fuse_new(fc,&fargs,&fops,sizeof(fops),NULL));
} else
- fuse_loop(fuse_new(fd,&fargs,&fops,sizeof(fops)));
+#endif
+ fuse_loop(fuse_new(fc,&fargs,&fops,sizeof(fops),NULL));
+ fuse_unmount(mountpoint,fc);
fuse_opt_free_args(&fargs);