my $tmp = 0;
my %mapping = map { $_ => $tmp++ } @names;
my %optmap = map { $_ => 1 } @validOpts;
- my @otherargs = qw(debug threaded mountpoint mountopts);
- my %otherargs = (debug=>0, threaded=>0, mountpoint=>"", mountopts=>"");
+ my @otherargs = qw(debug threaded mountpoint mountopts fuseopts);
+ my %otherargs = (debug=>0, threaded=>0, mountpoint=>"", mountopts=>"", fuseopts=>"");
while(my $name = shift) {
my ($subref) = shift;
if(exists($otherargs{$name})) {
+/*
+ * vim:ts=8:noet
+ */
+
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
int i, fd, debug, threaded;
char *mountpoint;
char *mountopts;
+ char *fuseopts = NULL;
struct fuse_args margs = FUSE_ARGS_INIT(0, NULL);
struct fuse_args fargs = FUSE_ARGS_INIT(0, NULL);
INIT:
- if(items != 29) {
+ if(items != 30) {
fprintf(stderr,"Perl<->C inconsistency or internal error\n");
XSRETURN_UNDEF;
}
}
mountpoint = SvPV_nolen(ST(2));
mountopts = SvPV_nolen(ST(3));
+ if (SvCUR(ST(4))) fuseopts = SvPV_nolen(ST(4));
for(i=0;i<N_CALLBACKS;i++) {
- SV *var = ST(i+4);
+ SV *var = ST(i+5);
/* allow symbolic references, or real code references. */
if(SvOK(var) && (SvPOK(var) || (SvROK(var) && SvTYPE(SvRV(var)) == SVt_PVCV))) {
void **tmp1 = (void**)&_available_ops, **tmp2 = (void**)&fops;
fuse_opt_free_args(&margs);
croak("out of memory\n");
}
+ if (fuse_opt_add_arg(&fargs, "") == -1) {
+ fuse_opt_free_args(&fargs);
+ croak("out of memory\n");
+ }
+ if (fuseopts &&
+ (fuse_opt_add_arg(&fargs, "-o") == -1 ||
+ fuse_opt_add_arg(&fargs, fuseopts) == -1)) {
+ fuse_opt_free_args(&fargs);
+ croak("out of memory\n");
+ }
+ if (debug && (fuse_opt_add_arg(&fargs, "-d") == -1)) {
+ fuse_opt_free_args(&fargs);
+ croak("out of memory\n");
+ }
+
fd = fuse_mount(mountpoint,&margs);
fuse_opt_free_args(&margs);
if(fd < 0)
croak("could not mount fuse filesystem!\n");
- if (debug) {
- if ( fuse_opt_add_arg(&fargs, "") == -1 ||
- fuse_opt_add_arg(&fargs, "-d") == -1) {
- fuse_opt_free_args(&fargs);
- croak("out of memory\n");
- }
- } else {
- if (fuse_opt_add_arg(&fargs, "") == -1)
- croak("out of memory\n");
- }
if(threaded) {
fuse_loop_mt(fuse_new(fd,&fargs,&fops,sizeof(fops)));