added changes from Mark Wilkinson to support mount options, list all
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 22 Jun 2005 16:15:17 +0000 (16:15 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 22 Jun 2005 16:15:17 +0000 (16:15 +0000)
contributors in AUTHORS, added pod tests

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/fuse/perl/trunk@16 6e4b0b00-1209-0410-87b2-b275959b5705

AUTHORS
Fuse.pm
Fuse.xs
test/pod.t [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 4ffb10a..2ea4ebf 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1,7 @@
 Perl bindings
 -------------
 
-Mark Glines        <mark@glines.org>
-Dobrica Pavlinusic <dpavlin@rot13.org>
+Mark Glines <mark@glines.org> - original author of perl bindings
+Dobrica Pavlinusic <dpavlin@rot13.org> - current maintainer
+Richard Dawe <rich@phekda.gotadsl.co.uk> - lot of improvements
+Mark Wilkinson <mark.wilkinson@2pmtech.com> - added mount options      
diff --git a/Fuse.pm b/Fuse.pm
index 0173468..f651b31 100644 (file)
--- a/Fuse.pm
+++ b/Fuse.pm
@@ -81,9 +81,11 @@ sub main {
        my (@names) = qw(getattr readlink getdir mknod mkdir unlink rmdir symlink
                         rename link chmod chown truncate utime open read write statfs
                         flush release fsync setxattr getxattr listxattr removexattr);
+       my (@validOpts) = qw(allow_other);
        my ($tmp) = 0;
        my (%mapping) = map { $_ => $tmp++ } (@names);
-       my (%otherargs) = (debug=>0, mountpoint=>"");
+       my (%optmap) = map { $_ => 1 } (@validOpts);
+       my (%otherargs) = (debug=>0, mountpoint=>"", mountopts=>"");
        while(my $name = shift) {
                my ($subref) = shift;
                if(exists($otherargs{$name})) {
@@ -96,7 +98,12 @@ sub main {
                        $subs[$mapping{$name}] = $subref;
                }
        }
-       perl_fuse_main($otherargs{debug},$otherargs{mountpoint},@subs);
+        foreach my $opt ( split(/,/,$otherargs{mountopts}) ) {
+          if ( ! exists($optmap{$opt}) ) {
+            croak "Use of an invalid mountopt argument";
+          }
+        }
+       perl_fuse_main($otherargs{debug},$otherargs{mountpoint},$otherargs{mountopts},@subs);
 }
 
 # Autoload methods go after =cut, and are processed by the autosplit program.
@@ -174,6 +181,22 @@ specify this.  An example would be '/mnt'.
 
 =back
 
+mountopts => string
+
+=over 1
+
+This is a comma seperated list of mount options to pass to the FUSE kernel
+module.
+
+At present, it allows the specification of the allow_other
+argument when mounting the new FUSE filesystem. To use this, you will also
+need 'user_allow_other' in /etc/fuse.conf as per the FUSE documention
+
+  mountopts => "allow_other" or
+  mountopts => ""
+
+=back
+
 unthreaded => boolean
 
 =over 1
diff --git a/Fuse.xs b/Fuse.xs
index 9ead042..318d355 100644 (file)
--- a/Fuse.xs
+++ b/Fuse.xs
@@ -777,19 +777,21 @@ perl_fuse_main(...)
        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, varnum = 0, debug, have_mnt;
        char *mountpoint;
+       char *mountopts;
        STRLEN n_a;
        STRLEN l;
        INIT:
-       if(items != 27) {
+       if(items != 28) {
                fprintf(stderr,"Perl<->C inconsistency or internal error\n");
                XSRETURN_UNDEF;
        }
        CODE:
        debug = SvIV(ST(0));
        mountpoint = SvPV_nolen(ST(1));
+       mountopts = SvPV_nolen(ST(2));
        /* FIXME: reevaluate multithreading support when perl6 arrives */
        for(i=0;i<N_CALLBACKS;i++) {
-               SV *var = ST(i+2);
+               SV *var = ST(i+3);
                if((var != &PL_sv_undef) && SvROK(var)) {
                        if(SvTYPE(SvRV(var)) == SVt_PVCV) {
                                void **tmp1 = (void**)&_available_ops, **tmp2 = (void**)&fops;
@@ -800,7 +802,7 @@ perl_fuse_main(...)
                }
        }
        /* FIXME: need to pass fusermount arguments */
-       fd = fuse_mount(mountpoint,NULL);
+       fd = fuse_mount(mountpoint,mountopts);
        if(fd < 0)
                croak("could not mount fuse filesystem!");
        fuse_loop(fuse_new(fd,debug ? "debug" : NULL,&fops));
diff --git a/test/pod.t b/test/pod.t
new file mode 100644 (file)
index 0000000..da5da6f
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();