From cdcd92cd5d2e6d9f9215086f0413f6b87de35584 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 23 May 2006 14:45:53 +0000 Subject: [PATCH] Vladimir V. Kolpakov contributed cleanup patch git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/fuse/perl-llin@89 6e4b0b00-1209-0410-87b2-b275959b5705 --- AUTHORS | 1 + Fuse.pm | 30 ++++++++++++++---------------- Fuse.xs | 45 +++------------------------------------------ test/s/mount.t | 2 +- 4 files changed, 19 insertions(+), 59 deletions(-) diff --git a/AUTHORS b/AUTHORS index d331679..19e62a7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Dobrica Pavlinusic - current maintainer Richard Dawe - lot of improvements Mark Wilkinson - added mount options Csaba Henk - update to API 25 +Vladimir V. Kolpakov - contributed cleanup for warnings diff --git a/Fuse.pm b/Fuse.pm index d4e09d9..d9f7f9b 100644 --- a/Fuse.pm +++ b/Fuse.pm @@ -75,17 +75,16 @@ sub XATTR_REPLACE { bootstrap Fuse $VERSION; sub main { - my (@subs) = (undef,undef,undef,undef,undef,undef,undef,undef,undef,undef, - undef,undef,undef,undef,undef,undef,undef,undef,undef,undef, - undef,undef,undef,undef,undef); - 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 (%optmap) = map { $_ => 1 } (@validOpts); - my (%otherargs) = (debug=>0, threaded=>0, mountpoint=>"", mountopts=>""); + 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 @subs = map {undef} @names; + my @validOpts = qw(ro allow_other default_permissions fsname use_ino); + 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=>""); while(my $name = shift) { my ($subref) = shift; if(exists($otherargs{$name})) { @@ -96,10 +95,9 @@ sub main { $subs[$mapping{$name}] = $subref; } } - foreach my $opt ( split(/,/,$otherargs{mountopts}) ) { - if ( ! exists($optmap{$opt}) ) { - croak "Use of an invalid mountopt argument"; - } + foreach my $opt ( map {m/^([^=]*)/; $1} split(/,/,$otherargs{mountopts}) ) { + next if exists($optmap{$opt}); + croak "Fuse::main: invalid '$opt' argument in mountopts"; } if($otherargs{threaded}) { # make sure threads are both available, and loaded. @@ -120,7 +118,7 @@ sub main { $otherargs{threaded} = 0; } } - perl_fuse_main($otherargs{debug},$otherargs{threaded},$otherargs{mountpoint},$otherargs{mountopts},@subs); + perl_fuse_main(@otherargs{@otherargs},@subs); } # Autoload methods go after =cut, and are processed by the autosplit program. diff --git a/Fuse.xs b/Fuse.xs index c5d0653..8cfa88b 100644 --- a/Fuse.xs +++ b/Fuse.xs @@ -40,7 +40,7 @@ static inline void create_perl_context() { SV *_PLfuse_callbacks[N_CALLBACKS]; int _PLfuse_getattr(const char *file, struct stat *result) { - int rv, statcount; + int rv; FUSE_CONTEXT_PRE; dSP; DEBUGf("getattr begin: %s\n",file); @@ -71,7 +71,7 @@ int _PLfuse_getattr(const char *file, struct stat *result) { result->st_uid = POPi; result->st_nlink = POPi; result->st_mode = POPi; - /*result->st_ino =*/ POPi; + result->st_ino = POPi; result->st_dev = POPi; rv = 0; } @@ -85,8 +85,6 @@ int _PLfuse_getattr(const char *file, struct stat *result) { int _PLfuse_readlink(const char *file,char *buf,size_t buflen) { int rv; - char *rvstr; - I32 ax; FUSE_CONTEXT_PRE; dSP; if(buflen < 1) @@ -156,8 +154,6 @@ int _PLfuse_getdir(const char *file, fuse_dirh_t dirh, fuse_dirfil_t dirfil) { int _PLfuse_mknod (const char *file, mode_t mode, dev_t dev) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("mknod begin\n"); @@ -184,8 +180,6 @@ int _PLfuse_mknod (const char *file, mode_t mode, dev_t dev) { int _PLfuse_mkdir (const char *file, mode_t mode) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("mkdir begin\n"); @@ -212,8 +206,6 @@ int _PLfuse_mkdir (const char *file, mode_t mode) { int _PLfuse_unlink (const char *file) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("unlink begin\n"); @@ -238,8 +230,6 @@ int _PLfuse_unlink (const char *file) { int _PLfuse_rmdir (const char *file) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("rmdir begin\n"); @@ -264,8 +254,6 @@ int _PLfuse_rmdir (const char *file) { int _PLfuse_symlink (const char *file, const char *new) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("symlink begin\n"); @@ -291,8 +279,6 @@ int _PLfuse_symlink (const char *file, const char *new) { int _PLfuse_rename (const char *file, const char *new) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("rename begin\n"); @@ -318,8 +304,6 @@ int _PLfuse_rename (const char *file, const char *new) { int _PLfuse_link (const char *file, const char *new) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("link begin\n"); @@ -345,8 +329,6 @@ int _PLfuse_link (const char *file, const char *new) { int _PLfuse_chmod (const char *file, mode_t mode) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("chmod begin\n"); @@ -372,8 +354,6 @@ int _PLfuse_chmod (const char *file, mode_t mode) { int _PLfuse_chown (const char *file, uid_t uid, gid_t gid) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("chown begin\n"); @@ -400,8 +380,6 @@ int _PLfuse_chown (const char *file, uid_t uid, gid_t gid) { int _PLfuse_truncate (const char *file, off_t off) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("truncate begin\n"); @@ -427,8 +405,6 @@ int _PLfuse_truncate (const char *file, off_t off) { int _PLfuse_utime (const char *file, struct utimbuf *uti) { int rv; - SV *rvsv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("utime begin\n"); @@ -455,8 +431,6 @@ int _PLfuse_utime (const char *file, struct utimbuf *uti) { int _PLfuse_open (const char *file, struct fuse_file_info *fi) { int rv; - SV *rvsv; - char *rvstr; int flags = fi->flags; FUSE_CONTEXT_PRE; dSP; @@ -483,7 +457,6 @@ int _PLfuse_open (const char *file, struct fuse_file_info *fi) { int _PLfuse_read (const char *file, char *buf, size_t buflen, off_t off, struct fuse_file_info *fi) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("read begin\n"); @@ -524,7 +497,6 @@ int _PLfuse_read (const char *file, char *buf, size_t buflen, off_t off, struct int _PLfuse_write (const char *file, const char *buf, size_t buflen, off_t off, struct fuse_file_info *fi) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("write begin\n"); @@ -551,7 +523,6 @@ int _PLfuse_write (const char *file, const char *buf, size_t buflen, off_t off, int _PLfuse_statfs (const char *file, struct statvfs *st) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("statfs begin\n"); @@ -598,7 +569,6 @@ int _PLfuse_statfs (const char *file, struct statvfs *st) { int _PLfuse_flush (const char *file, struct fuse_file_info *fi) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("flush begin\n"); @@ -623,7 +593,6 @@ int _PLfuse_flush (const char *file, struct fuse_file_info *fi) { int _PLfuse_release (const char *file, struct fuse_file_info *fi) { int rv; - char *rvstr; int flags = fi->flags; FUSE_CONTEXT_PRE; dSP; @@ -650,7 +619,6 @@ int _PLfuse_release (const char *file, struct fuse_file_info *fi) { int _PLfuse_fsync (const char *file, int datasync, struct fuse_file_info *fi) { int rv; - char *rvstr; int flags = fi->flags; FUSE_CONTEXT_PRE; dSP; @@ -677,7 +645,6 @@ int _PLfuse_fsync (const char *file, int datasync, struct fuse_file_info *fi) { int _PLfuse_setxattr (const char *file, const char *name, const char *buf, size_t buflen, int flags) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("setxattr begin\n"); @@ -705,7 +672,6 @@ int _PLfuse_setxattr (const char *file, const char *name, const char *buf, size_ int _PLfuse_getxattr (const char *file, const char *name, char *buf, size_t buflen) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("getxattr begin\n"); @@ -750,7 +716,6 @@ int _PLfuse_getxattr (const char *file, const char *name, char *buf, size_t bufl int _PLfuse_listxattr (const char *file, char *list, size_t size) { int prv, rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("listxattr begin\n"); @@ -768,7 +733,6 @@ int _PLfuse_listxattr (const char *file, char *list, size_t size) { char *p = list; int spc = size; int total_len = 0; - int i; rv = POPi; prv--; @@ -817,7 +781,6 @@ int _PLfuse_listxattr (const char *file, char *list, size_t size) { int _PLfuse_removexattr (const char *file, const char *name) { int rv; - char *rvstr; FUSE_CONTEXT_PRE; dSP; DEBUGf("removexattr begin\n"); @@ -881,13 +844,11 @@ 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, threaded, have_mnt; + int i, fd, debug, threaded; char *mountpoint; char *mountopts; struct fuse_args margs = FUSE_ARGS_INIT(0, NULL); struct fuse_args fargs = FUSE_ARGS_INIT(0, NULL); - STRLEN n_a; - STRLEN l; INIT: if(items != 29) { fprintf(stderr,"Perl<->C inconsistency or internal error\n"); diff --git a/test/s/mount.t b/test/s/mount.t index 3f1052e..da93d1d 100644 --- a/test/s/mount.t +++ b/test/s/mount.t @@ -12,7 +12,7 @@ if(!fork()) { mkdir $_point; mkdir $_real; `echo $$ >test/s/mounted.pid`; - diag "mouting $_loop to $_point"; + diag "mounting $_loop to $_point"; exec("perl -Iblib/lib -Iblib/arch $_loop $_point"); exit(1); } -- 2.20.1