diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-11-11 09:20:50 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-11-11 09:20:50 +0000 |
commit | 836429fe79b49bb3ee914e31f9630cc437c59682 (patch) | |
tree | b906f79e1c62255af235eafcb72c0f6f2ff63d98 | |
parent | def69883671db8f3b13a11d8b92252f52f81904e (diff) | |
download | fuse-836429fe79b49bb3ee914e31f9630cc437c59682.tar.gz |
fix
-rw-r--r-- | fuse.spec | 120 | ||||
-rw-r--r-- | kernel/util.c | 3 | ||||
-rw-r--r-- | util/fusermount.c | 37 |
3 files changed, 33 insertions, 127 deletions
diff --git a/fuse.spec b/fuse.spec deleted file mode 100644 index 375b13d..0000000 --- a/fuse.spec +++ /dev/null @@ -1,120 +0,0 @@ -%define kernelversion %(uname -r) -%define fusemoduledir /lib/modules/%{kernelversion}/kernel/fs/fuse - -%define kernelrel %(uname -r | sed -e s/-/_/g) -%define real_release 6 - -Name: fuse -Version: 1.0 -Release: kernel_%{kernelrel}_%{real_release} -Summary: Filesystem in Userspace -Source: %{name}-%{version}.tar.gz -Copyright: GPL -Group: Utilities/System -URL: http://sourceforge.net/projects/avf -Buildroot: %{_tmppath}/%{name}-root -Prefix: /usr -Packager: Achim Settelmeier <fuse-rpm@sirlab.de> -# some parts of this specfile are taken from Ian Pilcher's specfile - -# don't restrict to RedHat kernels but also allow compilation with -# vanilla kernels, too. -#Requires: kernel = %{kernelrel}, redhat-release >= 7 -#BuildRequires: kernel-source = %{kernelrel} - - -%description -FUSE (Filesystem in Userspace) is a simple interface for userspace -programs to export a virtual filesystem to the linux kernel. FUSE -also aims to provide a secure method for non privileged users to -create and mount their own filesystem implementations. - - -%clean -case "$RPM_BUILD_ROOT" in *-root) rm -rf $RPM_BUILD_ROOT ;; esac - -%prep -%setup - -%build -# invoke configure with the --with-kernel option in case we attempt to -# compile for a different kernel and hope the path is right :-) -if [ "%{kernelversion}" != $(uname -r) ]; then - for dir in /lib/modules/%{kernelversion}/build \ - /usr/src/linux-%{kernelversion} \ - /usr/local/src/linux-%{kernelversion} ; do - if [ -d "$dir" ]; then - WITH_KERNEL="--with-kernel=$dir" - break - fi - done -fi - -./configure \ - --prefix=%{prefix} \ - $WITH_KERNEL -make -make check - -## Now build the library as a shared object -#cd lib -#gcc -fPIC -DHAVE_CONFIG_H -I../include -Wall -W -g -O2 -c *.c -#gcc -shared -Wl,-soname,libfuse.so.%{major_ver} -o libfuse.so.%{version} *.o -#cd .. - - -%install -case "$RPM_BUILD_ROOT" in *-root) rm -rf $RPM_BUILD_ROOT ;; esac -make install \ - prefix=$RPM_BUILD_ROOT%{prefix} \ - fusemoduledir=$RPM_BUILD_ROOT%{fusemoduledir} - -install -d $RPM_BUILD_ROOT%{prefix}/lib/fuse/example -install -s -m 755 example/{fusexmp,hello,null} $RPM_BUILD_ROOT%{prefix}/lib/fuse/example/ - -# remove binaries form example folder so we can include it -# as a form of documentation into the package -make -C example clean -rm -rf example/.deps/ - -%post -/sbin/depmod -aq - -%preun -/sbin/modprobe -r fuse - -%postun -/sbin/depmod -aq - - - -%files -%defattr(-,root,root) -%doc README TODO NEWS INSTALL ChangeLog AUTHORS COPYING COPYING.LIB -%doc example/ -%doc patch/ - -%{fusemoduledir} -%{prefix}/lib/libfuse.a -%{prefix}/include/fuse.h -%{prefix}/lib/fuse/ - -# you want to install fusermount SUID root? -# Then uncomment the "%attr()"-line in favour of the line after it. -#%attr(4500,root,root) %{prefix}/bin/fusermount -%{prefix}/bin/fusermount - - - -%changelog - -* Sun May 25 2003 Achim Settelmeier <fuse-rpm@sirlab.de> -- don't add --with-kernel in case we compile for the standard kernel - -* Tue Mar 04 2003 Achim Settelmeier <fuse-rpm@sirlab.de> -- "Merged" the specfile by Ian Pilcher (Ian Pilcher <pilchman@attbi.com>) - and this specfile into one. Both are provided by fuse-1.0.tar.gz. - -* Mon Mar 03 2003 Achim Settelmeier <fuse-rpm@sirlab.de> -- Updated specfile for RedHat 8.0 systems - diff --git a/kernel/util.c b/kernel/util.c index 13f3fe5..ac6455d 100644 --- a/kernel/util.c +++ b/kernel/util.c @@ -17,7 +17,7 @@ MODULE_DESCRIPTION("Filesystem in Userspace"); MODULE_LICENSE("GPL"); #endif -spinlock_t fuse_lock = SPIN_LOCK_UNLOCKED; +spinlock_t fuse_lock; int __init fuse_init(void) { @@ -27,6 +27,7 @@ int __init fuse_init(void) FUSE_VERSION, FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION); + spin_lock_init(&fuse_lock); res = fuse_fs_init(); if (res) goto err; diff --git a/util/fusermount.c b/util/fusermount.c index 1e218cd..e9e195d 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -35,8 +35,6 @@ #include <sys/un.h> #include <linux/fuse.h> -#define FUSE_DEV "/proc/fs/fuse/dev" - #define FUSE_COMMFD_ENV "_FUSE_COMMFD" const char *progname; @@ -375,6 +373,29 @@ static int do_mount(const char *mnt, const char *type, mode_t rootmode, return res; } +static int check_version(void) +{ + int res; + int majorver; + int minorver; + FILE *vf = fopen(FUSE_VERSION_FILE, "r"); + if (vf == NULL) { + fprintf(stderr, "%s: kernel interface too old\n", progname); + return -1; + } + res = fscanf(vf, "%i.%i", &majorver, &minorver); + fclose(vf); + if (res != 2) { + fprintf(stderr, "%s: error reading %s\n", progname, FUSE_VERSION_FILE); + return -1; + } + if (majorver < 3) { + fprintf(stderr, "%s: kernel interface too old\n", progname); + return -1; + } + return 0; +} + static int check_perm(const char **mntp, struct stat *stbuf, int *currdir_fd) { int res; @@ -475,10 +496,14 @@ static int mount_fuse(const char *mnt, const char *opts) return -1; } - res = check_perm(&real_mnt, &stbuf, &currdir_fd); - if (res != -1) - res = do_mount(real_mnt, type, stbuf.st_mode & S_IFMT, fd, opts, - &fsname); + res = check_version(); + if (res != -1) { + res = check_perm(&real_mnt, &stbuf, &currdir_fd); + if (res != -1) + res = do_mount(real_mnt, type, stbuf.st_mode & S_IFMT, fd, opts, + &fsname); + } + if (getuid() != 0) restore_privs(); |