Subject: | Feature request: fuseopts |
Please add "fuseopts" as acceptable parameter for Fuse::main.
This gives ability to use fuse more finely.
Example of usage:
Fuse::main(
mountpoint => XXX->config('MountPoint'),
debug => XXX->config{'Debug'},
threaded => 0,
mountopts => "allow_other,fsname=XXX",
fuseopts => "direct_io,entry_timeout=0.1",
@hooks
);
Subject: | fuse_opts.patch |
Index: Fuse.pm
===================================================================
RCS file: /cvsroot/fuse/perl/Fuse.pm,v
retrieving revision 1.22
diff -u -r1.22 Fuse.pm
--- Fuse-0.09_3/Fuse.pm 19 Mar 2008 19:40:36 -0000 1.22
+++ Fuse-0.09_3/Fuse.pm 13 Apr 2009 18:48:18 -0000
@@ -83,8 +83,8 @@
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})) {
Index: Fuse.xs
===================================================================
RCS file: /cvsroot/fuse/perl/Fuse.xs,v
retrieving revision 1.24
diff -u -r1.24 Fuse.xs
--- Fuse-0.09_3/Fuse.xs 19 Mar 2008 19:40:36 -0000 1.24
+++ Fuse-0.09_3/Fuse.xs 13 Apr 2009 18:48:18 -0000
@@ -1,3 +1,7 @@
+/*
+ * vim:ts=8:noet
+ */
+
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
@@ -840,10 +844,11 @@
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;
}
@@ -862,8 +867,9 @@
}
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;
@@ -893,20 +899,25 @@
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)));