merge from 2_0_merge1 to 2_0_merge2
authorMiklos Szeredi <miklos@szeredi.hu>
Thu, 11 Nov 2004 10:33:58 +0000 (10:33 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Thu, 11 Nov 2004 10:33:58 +0000 (10:33 +0000)
15 files changed:
AUTHORS
BUGS [deleted file]
ChangeLog
Makefile.am
NEWS
README-2.6 [deleted file]
fuse.spec [deleted file]
kernel/Makefile.in
kernel/configure.ac
kernel/file.c
kernel/linux/fuse.h
kernel/makeconf.sh [deleted file]
kernel/util.c
makeconf.sh
util/fusermount.c

diff --git a/AUTHORS b/AUTHORS
index 978027ea170cd1c86dc26aad507cbe9e5cc09540..cfdba8e76c0c7f6c253eb6cd2d5134c8953a3162 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -2,15 +2,3 @@ FUSE core
 ---------
 
 Miklos Szeredi     <miklos@szeredi.hu>
-
-
-Python bindings
----------------
-
-Jeff Epler         <jepler@unpythonic.dhs.org>
-
-
-Perl bindings
--------------
-
-Mark Glines        <mark@glines.org>
diff --git a/BUGS b/BUGS
deleted file mode 100644 (file)
index 5fdce02..0000000
--- a/BUGS
+++ /dev/null
@@ -1,10 +0,0 @@
-- It is allowed to mount a directory on a non-directory.
-
-- I want really low priority for my cached pages.  Can they start out
-  'old' so they will be thrown out on the first oportunity?
-
-- File size change could cause some strange behavior WRT the page
-  cache.
-
-- User can cause nasty DoS by not replying to WRITE requests and thus
-  blocking writepage() indefinitely.
index da6bcdfcf22c5c447442a5cb6fbbf9d22318a61d..8134ae7d5f999a202144fda3680c8936f50201f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,16 @@
-2004-11-10  Miklos Szeredi <miklos@szeredi.hu>
+2004-11-11  Miklos Szeredi <miklos@szeredi.hu>
 
-       * Merge from fuse_2_0_bugfix to fuse_2_0_merge1
+       * Check kernel interface version in fusermount to prevent
+       strangeness in case of mismatch.
 
 2004-11-10  Miklos Szeredi <miklos@szeredi.hu>
 
        * Separate configure for the kernel directory
 
+       * Don't allow write to return more than 'count'
+
+       * Extend kernel interface for future use
+
 2004-11-09  Miklos Szeredi <miklos@szeredi.hu>
 
        * Fix 'makeconf.sh' to use autoreconf if available
index aaf50981a9fa66526d5e0c48b4c8e51ba699640e..28f5b323b3e6ec3aebeaa1f13eda0ce2b7b90e1f 100644 (file)
@@ -6,7 +6,7 @@ EXTRA_DIST =                    \
        fuse.pc.in              \
        README*                 \
        Filesystems             \
-       BUGS                    \
+       FAQ                     \
        doc/how-fuse-works
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/NEWS b/NEWS
index 13a84e125fcead003870173f09da06028bb6bbbe..512ccbcb2b198fae1835937235c9a441ce8389c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+What is new in 2.1
+
+* Bug fixes
+
+* Improved support for filesystems implementing a custom event-loop
+
+* Add 'pkg-config' support
+
+* Kernel module can be compiled separately
+
+============================================================================
+
 What is new in 1.9
 
 * Lots of bugs fixed
@@ -20,6 +32,8 @@ What is new in 1.9
 
 * Extended attributes support
 
+============================================================================
+
 What is new in 1.3
 
 * Thanks to user bugreports and stress testing with LTP and sfx-linux
@@ -35,6 +49,8 @@ What is new in 1.2
 
 * Other bugfixes
 
+============================================================================
+
 What is new in 1.1
 
 * Support for the 2.6 kernels
@@ -50,6 +66,7 @@ What is new in 1.1
 
 * Bugfixes
 
+============================================================================
 
 What is new in 1.0
 
diff --git a/README-2.6 b/README-2.6
deleted file mode 100644 (file)
index 8cc4fa1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-To use kbuild, you need write access to .tmp_versions/ and
-.__modpost.cmd in KERNELDIR.
-
-HINT: chmod them 1777
diff --git a/fuse.spec b/fuse.spec
deleted file mode 100644 (file)
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
-
index 2f7b74b7061c54f1ab25615ba245e1cf6e75bfe0..42d1807f58f21fbbeeb99afb56ae9938f2bd1721 100644 (file)
@@ -6,7 +6,7 @@ mkdir_p = mkdir -p
 majver = @majver@
 VERSION = @PACKAGE_VERSION@
 
-DISTFILES = Makefile.in configure.ac configure config.h.in makeconf.sh \
+DISTFILES = Makefile.in configure.ac configure config.h.in ../install-sh \
        dev.c dir.c file.c inode.c util.c fuse_i.h
 COMPATDISTFILES = compat/parser.c compat/parser.h
 LINUXDISTFILES = linux/fuse.h
index 8dce5bd1b4a7bac3c07326097df45c6e07a7eff8..0dad9cbe6f4d5e06f82c0bb1c12ffcdaa128d8fa 100644 (file)
@@ -1,6 +1,8 @@
 AC_INIT(fuse-kernel, 2.1-pre0)
 AC_CONFIG_HEADERS([config.h])
 
+AC_PROG_INSTALL
+
 AC_MSG_CHECKING([kernel source directory])
 kernelsrc=
 AC_ARG_WITH(kernel,
index aa9dba369458ecb36c81f4a6d41b9227ab1988f2..a08d236e856e3033aa19756570b8a721c26bc8fe 100644 (file)
@@ -618,8 +618,12 @@ static ssize_t fuse_send_write(struct fuse_req *req, int writepage,
        req->out.args[0].value = &outarg;
        request_send(fc, req);
        res = req->out.h.error;
-       if (!res)
-               return outarg.size;
+       if (!res) {
+               if (outarg.size > count)
+                       return -EPROTO;
+               else
+                       return outarg.size;
+       }
        else
                return res;
 }
index e5f9a6cc1917e4e9cbbab4a41348fa20e0937ab6..55af4d9da646a315818d8bec289153fd95adfd12 100644 (file)
@@ -146,6 +146,7 @@ struct fuse_open_in {
 
 struct fuse_open_out {
        unsigned long fh;
+       unsigned int _open_flags;
 };
 
 struct fuse_release_in {
@@ -155,6 +156,7 @@ struct fuse_release_in {
 
 struct fuse_flush_in {
        unsigned long fh;
+       unsigned int _nref;
 };
 
 struct fuse_read_in {
diff --git a/kernel/makeconf.sh b/kernel/makeconf.sh
deleted file mode 100755 (executable)
index d9d6fe1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-echo Running autoheader...
-autoheader
-echo Running autoconf...
-autoconf
-
-rm -f config.cache config.status
-echo "To compile run './configure', and then 'make'."
index 13f3fe5256cf27195037ac43072ee91bcd1cabc2..ac6455d775c78668d12f239833e11147d69ad8e4 100644 (file)
@@ -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;
index 67357e3b96a33000272bcc60cba4f2bf73a7e1d5..34090e965a798a93fb9bf92090b3b7eccacc5f11 100755 (executable)
@@ -15,6 +15,14 @@ else
     autoconf
     echo Running automake...
     automake -a -c
+    (
+       echo Entering directory: kernel
+       cd kernel
+       echo Running autoheader...
+       autoheader
+       echo Running autoconf...
+       autoconf
+    )
 fi
 
 rm -f config.cache config.status
index 1e218cd92768adfb92ca239b5fe4131b18cba41f..e9e195d9b93a7699db75fa82e45703934447d62f 100644 (file)
@@ -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();