hurdextras-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libfuse ./configure.ac example-23/Makefile.am e...


From: Stefan Siegl
Subject: libfuse ./configure.ac example-23/Makefile.am e...
Date: Thu, 13 Apr 2006 22:52:47 +0000

CVSROOT:        /sources/hurdextras
Module name:    libfuse
Branch:         
Changes by:     Stefan Siegl <address@hidden>   06/04/13 22:52:47

Modified files:
        .              : configure.ac 
        example-23     : Makefile.am 
        example-24     : Makefile.am 
        include        : fuse.h fuse_compat.h 
        src            : fuse_i.h main.c netfs.c netnode.c 
Added files:
        example-25     : .cvsignore Makefile.am fusexmp.c fusexmp_fh.c 
                         hello.c hello_ll.c null.c 
        include        : fuse_common.h fuse_opt.h 

Log message:
        pulled in headers from fuse 2.5.3 and added examples. fuse_ops variable 
renamed to fuse_ops_compat22 (to make room for 2.5 api functions).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/configure.ac.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-23/Makefile.am.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-24/Makefile.am.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/.cvsignore?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/Makefile.am?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/fusexmp.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/fusexmp_fh.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/hello.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/hello_ll.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/example-25/null.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/include/fuse.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/include/fuse_common.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/include/fuse_compat.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/include/fuse_opt.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/src/fuse_i.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/src/main.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/src/netfs.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/hurdextras/libfuse/src/netnode.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libfuse/configure.ac
diff -u libfuse/configure.ac:1.8 libfuse/configure.ac:1.9
--- libfuse/configure.ac:1.8    Thu Apr 13 19:14:02 2006
+++ libfuse/configure.ac        Thu Apr 13 22:52:47 2006
@@ -5,7 +5,7 @@
 
 AC_PREREQ(2.59)
 AC_INIT(libfuse, 0.1, address@hidden)
-AC_REVISION($Revision: 1.8 $)
+AC_REVISION($Revision: 1.9 $)
 AC_CONFIG_SRCDIR(src/main.c)
 AM_CONFIG_HEADER(config.h)
 
@@ -44,5 +44,6 @@
                [example/Makefile 
                 example-22/Makefile 
                 example-23/Makefile
-                example-24/Makefile])
+                example-24/Makefile
+                example-25/Makefile])
 AC_OUTPUT
Index: libfuse/example-23/Makefile.am
diff -u libfuse/example-23/Makefile.am:1.2 libfuse/example-23/Makefile.am:1.3
--- libfuse/example-23/Makefile.am:1.2  Mon Jan 30 23:12:03 2006
+++ libfuse/example-23/Makefile.am      Thu Apr 13 22:52:47 2006
@@ -8,4 +8,4 @@
 hello_SOURCES = hello.c
 
 LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=23 -I$(top_srcdir) -I$(top_srcdir)/include
+AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
Index: libfuse/example-24/Makefile.am
diff -u libfuse/example-24/Makefile.am:1.2 libfuse/example-24/Makefile.am:1.3
--- libfuse/example-24/Makefile.am:1.2  Mon Jan 30 23:12:03 2006
+++ libfuse/example-24/Makefile.am      Thu Apr 13 22:52:47 2006
@@ -9,4 +9,4 @@
 hello_SOURCES = hello.c
 
 LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=23 -I$(top_srcdir) -I$(top_srcdir)/include
+AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
Index: libfuse/include/fuse.h
diff -u libfuse/include/fuse.h:1.1 libfuse/include/fuse.h:1.2
--- libfuse/include/fuse.h:1.1  Mon Jan 30 22:37:59 2006
+++ libfuse/include/fuse.h      Thu Apr 13 22:52:47 2006
@@ -1,6 +1,6 @@
 /*
     FUSE: Filesystem in Userspace
-    Copyright (C) 2001-2005  Miklos Szeredi <address@hidden>
+    Copyright (C) 2001-2006  Miklos Szeredi <address@hidden>
 
     This program can be distributed under the terms of the GNU LGPL.
     See the file COPYING.LIB.
@@ -12,28 +12,19 @@
 /* This file defines the library interface of FUSE */
 
 /* IMPORTANT: you should define FUSE_USE_VERSION before including this
-   header.  To use the new API define it to 22 (recommended for any
-   new application), to use the old API define it to 21 (this is the
-   default), to use the even older 1.X API define it to 11. */
+   header.  To use the newest API define it to 25 (recommended for any
+   new application), to use the old API define it to 21 (default) or
+   22, to use the even older 1.X API define it to 11. */
 
 #ifndef FUSE_USE_VERSION
 #define FUSE_USE_VERSION 21
 #endif
 
-/** Major version of FUSE library interface */
-#define FUSE_MAJOR_VERSION 2
-
-/** Minor version of FUSE library interface */
-#define FUSE_MINOR_VERSION 3
-
-/* This interface uses 64 bit off_t */
-#if _FILE_OFFSET_BITS != 64
-#error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
-#endif
+#include "fuse_common.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/statfs.h>
+#include <sys/statvfs.h>
 #include <utime.h>
 
 #ifdef __cplusplus
@@ -47,6 +38,9 @@
 /** Handle for a FUSE filesystem */
 struct fuse;
 
+/** Structure containing a raw command */
+struct fuse_cmd;
+
 /** Function to add an entry in a readdir() operation
  *
  * @param buf the buffer passed to the readdir() operation
@@ -56,27 +50,13 @@
  * @return 1 if buffer is full, zero otherwise
  */
 typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
-                                const struct stat *stat, off_t off);
+                                const struct stat *stbuf, off_t off);
 
 /* Used by deprecated getdir() method */
 typedef struct fuse_dirhandle *fuse_dirh_t;
 typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
                               ino_t ino);
 
-/** Information about open files */
-struct fuse_file_info {
-    /** Open flags.  Available in open() and release() */
-    int flags;
-
-    /** File handle.  May be filled in by filesystem in open().
-        Available in all other file operations */
-    unsigned long fh;
-
-    /** In case of a write operation indicates if this was caused by a
-        writepage */
-    int writepage;
-};
-
 /**
  * The file system operations:
  *
@@ -86,10 +66,10 @@
  * negated error value (-errno) directly.
  *
  * All methods are optional, but some are essential for a useful
- * filesystem (e.g. getattr).  Flush, release, fsync, opendir,
- * releasedir, fsyncdir, init and destroy are special purpose
- * methods, without which a full featured filesystem can still be
- * implemented.
+ * filesystem (e.g. getattr).  Open, flush, release, fsync, opendir,
+ * releasedir, fsyncdir, access, create, ftruncate, fgetattr, init and
+ * destroy are special purpose methods, without which a full featured
+ * filesystem can still be implemented.
  */
 struct fuse_operations {
     /** Get file attributes.
@@ -152,11 +132,13 @@
 
     /** File open operation
      *
-     * No creation, or trunctation flags (O_CREAT, O_EXCL, O_TRUNC)
+     * No creation, or truncation flags (O_CREAT, O_EXCL, O_TRUNC)
      * will be passed to open().  Open should check if the operation
      * is permitted for the given flags.  Optionally open may also
-     * return an arbitary filehandle in the fuse_file_info structure,
+     * return an arbitrary filehandle in the fuse_file_info structure,
      * which will be passed to all file operations.
+     *
+     * Changed in version 2.2
      */
     int (*open) (const char *, struct fuse_file_info *);
 
@@ -168,6 +150,8 @@
      * 'direct_io' mount option is specified, in which case the return
      * value of the read system call will reflect the return value of
      * this operation.
+     *
+     * Changed in version 2.2
      */
     int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *);
 
@@ -176,15 +160,21 @@
      * Write should return exactly the number of bytes requested
      * except on error.  An exception to this is when the 'direct_io'
      * mount option is specified (see read operation).
+     *
+     * Changed in version 2.2
      */
     int (*write) (const char *, const char *, size_t, off_t,
                   struct fuse_file_info *);
 
+    /** Just a placeholder, don't set */
     /** Get file system statistics
      *
-     * The 'f_type' and 'f_fsid' fields are ignored
+     * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
+     *
+     * Replaced 'struct statfs' parameter with 'struct statvfs' in
+     * version 2.5
      */
-    int (*statfs) (const char *, struct statfs *);
+    int (*statfs) (const char *, struct statvfs *);
 
     /** Possibly flush cached data
      *
@@ -203,6 +193,11 @@
      * not possible to determine if a flush is final, so each flush
      * should be treated equally.  Multiple write-flush sequences are
      * relatively rare, so this shouldn't be a problem.
+     *
+     * Filesystems shouldn't assume that flush will always be called
+     * after some writes, or that if will be called at all.
+     *
+     * Changed in version 2.2
      */
     int (*flush) (const char *, struct fuse_file_info *);
 
@@ -217,6 +212,8 @@
      * have a file opened more than once, in which case only the last
      * release will mean, that no more reads/writes will happen on the
      * file.  The return value of release is ignored.
+     *
+     * Changed in version 2.2
      */
     int (*release) (const char *, struct fuse_file_info *);
 
@@ -224,6 +221,8 @@
      *
      * If the datasync parameter is non-zero, then only the user data
      * should be flushed, not the meta data.
+     *
+     * Changed in version 2.2
      */
     int (*fsync) (const char *, int, struct fuse_file_info *);
 
@@ -239,10 +238,12 @@
     /** Remove extended attributes */
     int (*removexattr) (const char *, const char *);
 
-    /** Open direcory
+    /** Open directory
      *
      * This method should check if the open operation is permitted for
      * this  directory
+     *
+     * Introduced in version 2.3
      */
     int (*opendir) (const char *, struct fuse_file_info *);
 
@@ -264,17 +265,24 @@
      * passes non-zero offset to the filler function.  When the buffer
      * is full (or an error happens) the filler function will return
      * '1'.
+     *
+     * Introduced in version 2.3
      */
     int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
                     struct fuse_file_info *);
 
-    /** Release directory */
+    /** Release directory
+     *
+     * Introduced in version 2.3
+     */
     int (*releasedir) (const char *, struct fuse_file_info *);
 
     /** Synchronize directory contents
      *
      * If the datasync parameter is non-zero, then only the user data
      * should be flushed, not the meta data
+     *
+     * Introduced in version 2.3
      */
     int (*fsyncdir) (const char *, int, struct fuse_file_info *);
 
@@ -284,6 +292,8 @@
      * The return value will passed in the private_data field of
      * fuse_context to all file operations and as a parameter to the
      * destroy() method.
+     *
+     * Introduced in version 2.3
      */
     void *(*init) (void);
 
@@ -291,8 +301,65 @@
      * Clean up filesystem
      *
      * Called on filesystem exit.
+     *
+     * Introduced in version 2.3
      */
     void (*destroy) (void *);
+
+    /**
+     * Check file access permissions
+     *
+     * This will be called for the access() system call.  If the
+     * 'default_permissions' mount option is given, this method is not
+     * called.
+     *
+     * This method is not called under Linux kernel versions 2.4.x
+     *
+     * Introduced in version 2.5
+     */
+    int (*access) (const char *, int);
+
+    /**
+     * Create and open a file
+     *
+     * If the file does not exist, first create it with the specified
+     * mode, and then open it.
+     *
+     * If this method is not implemented or under Linux kernel
+     * versions earlier than 2.6.15, the mknod() and open() methods
+     * will be called instead.
+     *
+     * Introduced in version 2.5
+     */
+    int (*create) (const char *, mode_t, struct fuse_file_info *);
+
+    /**
+     * Change the size of an open file
+     *
+     * This method is called instead of the truncate() method if the
+     * truncation was invoked from an ftruncate() system call.
+     *
+     * If this method is not implemented or under Linux kernel
+     * versions earlier than 2.6.15, the truncate() method will be
+     * called instead.
+     *
+     * Introduced in version 2.5
+     */
+    int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
+
+    /**
+     * Get attributes from an open file
+     *
+     * This method is called instead of the getattr() method if the
+     * file information is available.
+     *
+     * Currently this is only called after the create() method if that
+     * is implemented (see above).  Later it may be called for
+     * invocations of fstat() too.
+     *
+     * Introduced in version 2.5
+     */
+    int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
 };
 
 /** Extra context that may be needed by some filesystems
@@ -349,35 +416,16 @@
  * More detailed API                                           *
  * ----------------------------------------------------------- */
 
-/*
- * Create a FUSE mountpoint
- *
- * Returns a control file descriptor suitable for passing to
- * fuse_new()
- *
- * @param mountpoint the mount point path
- * @param opts a comma separated list of mount options.  Can be NULL.
- * @return the control file descriptor on success, -1 on failure
- */
-int fuse_mount(const char *mountpoint, const char *opts);
-
-/*
- * Umount a FUSE mountpoint
- *
- * @param mountpoint the mount point path
- */
-void fuse_unmount(const char *mountpoint);
-
 /**
  * Create a new FUSE filesystem.
  *
  * @param fd the control file descriptor
- * @param opts mount options to be used by the library
+ * @param args argument vector
  * @param op the operations
  * @param op_size the size of the fuse_operations structure
  * @return the created FUSE handle
  */
-struct fuse *fuse_new(int fd, const char *opts,
+struct fuse *fuse_new(int fd, struct fuse_args *args,
                       const struct fuse_operations *op, size_t op_size);
 
 /**
@@ -392,11 +440,11 @@
 /**
  * FUSE event loop.
  *
- * Requests from the kernel are processed, and the apropriate
+ * Requests from the kernel are processed, and the appropriate
  * operations are called.
  *
  * @param f the FUSE handle
- * @return 0 if no error occured, -1 otherwise
+ * @return 0 if no error occurred, -1 otherwise
  */
 int fuse_loop(struct fuse *f);
 
@@ -410,7 +458,7 @@
 /**
  * FUSE event loop with multiple threads
  *
- * Requests from the kernel are processed, and the apropriate
+ * Requests from the kernel are processed, and the appropriate
  * operations are called.  Request are processed in parallel by
  * distributing them between multiple threads.
  *
@@ -418,7 +466,7 @@
  * the application.
  *
  * @param f the FUSE handle
- * @return 0 if no error occured, -1 otherwise
+ * @return 0 if no error occurred, -1 otherwise
  */
 int fuse_loop_mt(struct fuse *f);
 
@@ -434,22 +482,13 @@
 struct fuse_context *fuse_get_context(void);
 
 /**
- * Invalidate cached data of a file.
+ * Obsolete, doesn't do anything
  *
- * Useful if the 'kernel_cache' mount option is given, since in that
- * case the cache is not invalidated on file open.
- *
- * @return 0 on success or -errno on failure
+ * @return -EINVAL
  */
 int fuse_invalidate(struct fuse *f, const char *path);
 
-/**
- * Check whether a mount option should be passed to the kernel or the
- * library
- *
- * @param opt the option to check
- * @return 1 if it is a library option, 0 otherwise
- */
+/* Deprecated, don't use */
 int fuse_is_lib_option(const char *opt);
 
 /**
@@ -464,9 +503,6 @@
  * Advanced API for event handling, don't worry about this...  *
  * ----------------------------------------------------------- */
 
-/** Structure containing a raw command */
-struct fuse_cmd;
-
 /** Function type used to process commands */
 typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
 
@@ -490,7 +526,7 @@
 
 /** Return the exited flag, which indicates if fuse_exit() has been
     called */
-int fuse_exited(struct fuse* f);
+int fuse_exited(struct fuse *f);
 
 /** Set function which can be used to get the current context */
 void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
@@ -499,17 +535,27 @@
  * Compatibility stuff                                         *
  * ----------------------------------------------------------- */
 
-#if FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11
+#ifndef __FreeBSD__
+
+#if FUSE_USE_VERSION == 22 || FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11
 #  include "fuse_compat.h"
+#  undef FUSE_MINOR_VERSION
+#  undef fuse_main
+#  if FUSE_USE_VERSION == 22
+#    define FUSE_MINOR_VERSION 4
+#    define fuse_main(argc, argv, op) \
+            fuse_main_real_compat22(argc, argv, op, sizeof(*(op)))
+#    define fuse_new fuse_new_compat22
+#    define fuse_setup fuse_setup_compat22
+#    define fuse_operations fuse_operations_compat22
+#    define fuse_file_info fuse_file_info_compat22
+#    define fuse_mount fuse_mount_compat22
+#  else
 #  define fuse_dirfil_t fuse_dirfil_t_compat
 #  define __fuse_read_cmd fuse_read_cmd
 #  define __fuse_process_cmd fuse_process_cmd
 #  define __fuse_loop_mt fuse_loop_mt_proc
-#  undef fuse_main
-#  undef FUSE_MINOR_VERSION
-#  undef FUSE_MAJOR_VERSION
 #  if FUSE_USE_VERSION == 21
-#    define FUSE_MAJOR_VERSION 2
 #    define FUSE_MINOR_VERSION 1
 #    define fuse_operations fuse_operations_compat2
 #    define fuse_main fuse_main_compat2
@@ -518,7 +564,10 @@
 #    define __fuse_teardown fuse_teardown
 #    define __fuse_exited fuse_exited
 #    define __fuse_set_getcontext_func fuse_set_getcontext_func
+#      define fuse_mount fuse_mount_compat22
 #  else
+#      warning Compatibility with API version 11 is deprecated
+#      undef FUSE_MAJOR_VERSION
 #    define FUSE_MAJOR_VERSION 1
 #    define FUSE_MINOR_VERSION 1
 #    define fuse_statfs fuse_statfs_compat1
@@ -528,10 +577,19 @@
 #    define fuse_mount fuse_mount_compat1
 #    define FUSE_DEBUG FUSE_DEBUG_COMPAT1
 #  endif
-#elif FUSE_USE_VERSION < 22
-#  error Compatibility with API version other than 21 and 11 not supported
+#  endif
+#elif FUSE_USE_VERSION < 25
+#  error Compatibility with API version other than 21, 22 and 11 not supported
 #endif
 
+#else /* __FreeBSD__ */
+
+#if FUSE_USE_VERSION < 25
+#  error On FreeBSD API version 25 or greater must be used
+#endif
+
+#endif /* __FreeBSD__ */
+
 #ifdef __cplusplus
 }
 #endif
Index: libfuse/include/fuse_compat.h
diff -u libfuse/include/fuse_compat.h:1.1 libfuse/include/fuse_compat.h:1.2
--- libfuse/include/fuse_compat.h:1.1   Mon Jan 30 22:37:59 2006
+++ libfuse/include/fuse_compat.h       Thu Apr 13 22:52:47 2006
@@ -1,6 +1,6 @@
 /*
     FUSE: Filesystem in Userspace
-    Copyright (C) 2001-2005  Miklos Szeredi <address@hidden>
+    Copyright (C) 2001-2006  Miklos Szeredi <address@hidden>
 
     This program can be distributed under the terms of the GNU LGPL.
     See the file COPYING.LIB.
@@ -9,6 +9,68 @@
 /* these definitions provide source compatibility to prior versions.
    Do not include this file directly! */
 
+#include <sys/statfs.h>
+
+struct fuse_file_info_compat22 {
+    int flags;
+    unsigned long fh;
+    int writepage;
+    unsigned int direct_io : 1;
+    unsigned int keep_cache : 1;
+};
+
+struct fuse_operations_compat22 {
+    int (*getattr) (const char *, struct stat *);
+    int (*readlink) (const char *, char *, size_t);
+    int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
+    int (*mknod) (const char *, mode_t, dev_t);
+    int (*mkdir) (const char *, mode_t);
+    int (*unlink) (const char *);
+    int (*rmdir) (const char *);
+    int (*symlink) (const char *, const char *);
+    int (*rename) (const char *, const char *);
+    int (*link) (const char *, const char *);
+    int (*chmod) (const char *, mode_t);
+    int (*chown) (const char *, uid_t, gid_t);
+    int (*truncate) (const char *, off_t);
+    int (*utime) (const char *, struct utimbuf *);
+    int (*open) (const char *, struct fuse_file_info_compat22 *);
+    int (*read) (const char *, char *, size_t, off_t,
+                 struct fuse_file_info_compat22 *);
+    int (*write) (const char *, const char *, size_t, off_t,
+                  struct fuse_file_info_compat22 *);
+    int (*statfs) (const char *, struct statfs *);
+    int (*flush) (const char *, struct fuse_file_info_compat22 *);
+    int (*release) (const char *, struct fuse_file_info_compat22 *);
+    int (*fsync) (const char *, int, struct fuse_file_info_compat22 *);
+    int (*setxattr) (const char *, const char *, const char *, size_t, int);
+    int (*getxattr) (const char *, const char *, char *, size_t);
+    int (*listxattr) (const char *, char *, size_t);
+    int (*removexattr) (const char *, const char *);
+    int (*opendir) (const char *, struct fuse_file_info_compat22 *);
+    int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
+                    struct fuse_file_info_compat22 *);
+    int (*releasedir) (const char *, struct fuse_file_info_compat22 *);
+    int (*fsyncdir) (const char *, int, struct fuse_file_info_compat22 *);
+    void *(*init) (void);
+    void (*destroy) (void *);
+};
+
+struct fuse *fuse_new_compat22(int fd, const char *opts,
+                               const struct fuse_operations_compat22 *op,
+                               size_t op_size);
+
+struct fuse *fuse_setup_compat22(int argc, char *argv[],
+                                 const struct fuse_operations_compat22 *op,
+                                 size_t op_size, char **mountpoint,
+                                 int *multithreaded, int *fd);
+
+int fuse_main_real_compat22(int argc, char *argv[],
+                            const struct fuse_operations_compat22 *op,
+                            size_t op_size);
+
+int fuse_mount_compat22(const char *mountpoint, const char *opts);
+
 typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int 
type);
 struct fuse_operations_compat2 {
     int (*getattr)     (const char *, struct stat *);
Index: libfuse/src/fuse_i.h
diff -u libfuse/src/fuse_i.h:1.1 libfuse/src/fuse_i.h:1.2
--- libfuse/src/fuse_i.h:1.1    Mon Jan 30 22:37:59 2006
+++ libfuse/src/fuse_i.h        Thu Apr 13 22:52:47 2006
@@ -17,7 +17,7 @@
 #ifdef FUSE_USE_VERSION
 #  include "fuse.h"
 #else
-#  define FUSE_USE_VERSION 23
+#  define FUSE_USE_VERSION 25
 #  include "fuse.h"
 #  include "fuse_compat.h"
 #endif
@@ -30,13 +30,15 @@
            __LINE__)
 
 /* pointer to the fuse_operations structure of this translator process */
-extern const struct fuse_operations *fuse_ops;
-extern const struct fuse_operations_compat2 *fuse_ops_compat;
+extern const struct fuse_operations_compat22 *fuse_ops_compat22;
+extern const struct fuse_operations_compat2 *fuse_ops_compat2;
 
-#define FUSE_OP_HAVE(a) ((fuse_ops) ? \
-                          (fuse_ops->a != NULL) : (fuse_ops_compat->a != NULL))
-#define FUSE_OP_CALL(a,b...) ((fuse_ops) ? \
-                               (fuse_ops->a(b)) : (fuse_ops_compat->a(b)))
+#define FUSE_OP_HAVE(a) ((fuse_ops_compat22) ? \
+                          (fuse_ops_compat22->a != NULL) : \
+                         (fuse_ops_compat2->a != NULL))
+#define FUSE_OP_CALL(a,b...) ((fuse_ops_compat22) ? \
+                               (fuse_ops_compat22->a(b)) : \
+                               (fuse_ops_compat2->a(b)))
 
 /*****************************************************************************
  *** netnodes (in memory representation of libfuse's files or directories) ***
@@ -53,7 +55,9 @@
 
   /* information about the opened file
    */
-  struct fuse_file_info info;
+  union {
+    struct fuse_file_info_compat22 compat22;
+  } info;
 
   /* pointer to our parent's netnode, if any */
   struct netnode *parent;
Index: libfuse/src/main.c
diff -u libfuse/src/main.c:1.2 libfuse/src/main.c:1.3
--- libfuse/src/main.c:1.2      Thu Apr 13 19:09:25 2006
+++ libfuse/src/main.c  Thu Apr 13 22:52:47 2006
@@ -32,8 +32,8 @@
 struct _libfuse_params libfuse_params = { 0 };
 
 /* pointer to the fuse_operations structure of this translator process */
-const struct fuse_operations *fuse_ops = NULL;
-const struct fuse_operations_compat2 *fuse_ops_compat = NULL;
+const struct fuse_operations_compat22 *fuse_ops_compat22 = NULL;
+const struct fuse_operations_compat2 *fuse_ops_compat2 = NULL;
 
 /* the port where to write out debug messages to, NULL to omit these */
 FILE *debug_port = NULL;
@@ -230,7 +230,7 @@
 {
   fuse_parse_argv(argc, argv);
 
-  int fd = fuse_mount(NULL, NULL);
+  int fd = fuse_mount_compat22(NULL, NULL);
   return (libfuse_params.disable_mt ? fuse_loop : fuse_loop_mt)
     (fuse_new_compat2(fd, NULL, op));
 }
@@ -240,17 +240,25 @@
 /* Main function of FUSE. 
  * named fuse_main_real, since originial fuse.h defines a macro renaming it */
 int 
-fuse_main_real(int argc, char *argv[],
-              const struct fuse_operations *op, size_t op_size)
+fuse_main_real_compat22(int argc, char *argv[],
+                       const struct fuse_operations_compat22 *op,
+                       size_t op_size)
 {
   fuse_parse_argv(argc, argv);
 
-  int fd = fuse_mount(NULL, NULL);
+  int fd = fuse_mount_compat22(NULL, NULL);
   return (libfuse_params.disable_mt ? fuse_loop : fuse_loop_mt)
-    (fuse_new(fd, NULL, op, op_size));
+    (fuse_new_compat22(fd, NULL, op, op_size));
 }
 
 
+int
+fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
+              size_t op_size)
+{
+  assert(0);
+}
+
 
 /* Create a new FUSE filesystem, actually there's nothing for us to do 
  * on the Hurd.
@@ -267,7 +275,7 @@
   if(fuse_parse_opts(opts))
     return NULL;
 
-  fuse_ops_compat = op;
+  fuse_ops_compat2 = op;
 
   return (void *) FUSE_MAGIC; /* we don't have a fuse structure, sorry. */
 }
@@ -275,12 +283,23 @@
 
 
 /* Create a new FUSE filesystem, actually there's nothing for us to do 
- * on the Hurd.
+ * on the Hurd. Hmm.
  */
 struct fuse *
-fuse_new(int fd, const char *opts, 
+fuse_new(int fd, struct fuse_args *args,
         const struct fuse_operations *op, size_t op_size)
 {
+  assert(0);
+}
+
+
+/* Create a new FUSE filesystem, actually there's nothing for us to do 
+ * on the Hurd.
+ */
+struct fuse *
+fuse_new_compat22(int fd, const char *opts, 
+                 const struct fuse_operations_compat22 *op, size_t op_size)
+{
   (void) op_size; /* FIXME, see what the real Fuse library does with 
                   * this argument */
 
@@ -290,18 +309,24 @@
   if(fuse_parse_opts(opts))
     return NULL;
 
-  fuse_ops = op;
+  fuse_ops_compat22 = op;
 
   return (void *) FUSE_MAGIC; /* we don't have a fuse structure, sorry. */
 }
 
 
-
 /* Create a new mountpoint for our fuse filesystem, i.e. do the netfs
  * initialization stuff ...
  */
 int 
-fuse_mount(const char *mountpoint, const char *opts)
+fuse_mount(const char *mountpoint, struct fuse_args *args)
+{
+  assert(0);
+}
+
+
+int 
+fuse_mount_compat22(const char *mountpoint, const char *opts)
 {
   (void) mountpoint; /* we don't care for the specified mountpoint, as 
                      * we need to be set up using settrans ... */
Index: libfuse/src/netfs.c
diff -u libfuse/src/netfs.c:1.1 libfuse/src/netfs.c:1.2
--- libfuse/src/netfs.c:1.1     Mon Jan 30 22:37:59 2006
+++ libfuse/src/netfs.c Thu Apr 13 22:52:47 2006
@@ -369,8 +369,8 @@
    * into memory. */
   if(! err) 
     {
-      node->nn->info.flags = flags;
-      if(flags & O_EXEC) node->nn->info.flags |= O_RDONLY;
+      node->nn->info.compat22.flags = flags;
+      if(flags & O_EXEC) node->nn->info.compat22.flags |= O_RDONLY;
     }
 
  out:
@@ -510,10 +510,11 @@
       goto out;
     }
 
-  if(fuse_ops)
-    err = -fuse_ops->fsync(node->nn->path, 0, &node->nn->info);
+  if(fuse_ops_compat22)
+    err = -fuse_ops_compat22->fsync(node->nn->path, 0,
+                                   &node->nn->info.compat22);
   else
-    err = -fuse_ops_compat->fsync(node->nn->path, 0);
+    err = -fuse_ops_compat2->fsync(node->nn->path, 0);
         
   if(! err)
     node->nn->may_need_sync = 0; 
@@ -1009,15 +1010,17 @@
       goto out;
     }
 
-  node->nn->info.writepage = 0; /* cannot distinct on the Hurd :( */
+  node->nn->info.compat22.writepage = 0; /* cannot distinct on the Hurd :( */
 
-  if(fuse_ops && fuse_ops->open)
-    if((err = fuse_ops->open(node->nn->path, &node->nn->info)))
+  if(fuse_ops_compat22 && fuse_ops_compat22->open)
+    if((err = fuse_ops_compat22->open(node->nn->path,
+                                     &node->nn->info.compat22)))
       goto out;
 
-  int sz = fuse_ops ? 
-    (fuse_ops->write(node->nn->path, data, *len, offset, &node->nn->info)) : 
-    (fuse_ops_compat->write(node->nn->path, data, *len, offset));
+  int sz = fuse_ops_compat22 ? 
+    (fuse_ops_compat22->write(node->nn->path, data, *len,
+                             offset, &node->nn->info.compat22)) : 
+    (fuse_ops_compat2->write(node->nn->path, data, *len, offset));
 
   /* FIXME: open, flush and release handling probably should be changed
    * completely, I mean, we probably should do fuse_ops->open in 
@@ -1026,11 +1029,12 @@
    *
    * This way we wouldn't be able to report any errors back.
    */
-  if(sz >= 0 && fuse_ops && fuse_ops->flush)
-    err = fuse_ops->flush(node->nn->path, &node->nn->info);
+  if(sz >= 0 && fuse_ops_compat22 && fuse_ops_compat22->flush)
+    err = fuse_ops_compat22->flush(node->nn->path, &node->nn->info.compat22);
 
-  if(fuse_ops && fuse_ops->open && fuse_ops->release)
-    fuse_ops->release(node->nn->path, &node->nn->info);
+  if(fuse_ops_compat22 && fuse_ops_compat22->open
+     && fuse_ops_compat22->release)
+    fuse_ops_compat22->release(node->nn->path, &node->nn->info.compat22);
      
   if(sz < 0)
     err = -sz;
@@ -1108,13 +1112,15 @@
       goto out;
     }
 
-  if(fuse_ops && fuse_ops->open)
-    if((err = fuse_ops->open(node->nn->path, &node->nn->info)))
+  if(fuse_ops_compat22 && fuse_ops_compat22->open)
+    if((err = fuse_ops_compat22->open(node->nn->path,
+                                     &node->nn->info.compat22)))
       goto out;
 
-  int sz = fuse_ops ? 
-    (fuse_ops->read(node->nn->path, data, *len, offset, &node->nn->info)) : 
-    (fuse_ops_compat->read(node->nn->path, data, *len, offset));
+  int sz = fuse_ops_compat22 ? 
+    (fuse_ops_compat22->read(node->nn->path, data, *len,
+                            offset, &node->nn->info.compat22)) : 
+    (fuse_ops_compat2->read(node->nn->path, data, *len, offset));
 
   /* FIXME: open, flush and release handling probably should be changed
    * completely, I mean, we probably should do fuse_ops->open in 
@@ -1123,11 +1129,12 @@
    *
    * This way we wouldn't be able to report any errors back.
    */
-  if(sz >= 0 && fuse_ops && fuse_ops->flush)
-    err = fuse_ops->flush(node->nn->path, &node->nn->info);
+  if(sz >= 0 && fuse_ops_compat22 && fuse_ops_compat22->flush)
+    err = fuse_ops_compat22->flush(node->nn->path, &node->nn->info.compat22);
 
-  if(fuse_ops && fuse_ops->open && fuse_ops->release)
-    fuse_ops->release(node->nn->path, &node->nn->info);
+  if(fuse_ops_compat22 && fuse_ops_compat22->open
+     && fuse_ops_compat22->release)
+    fuse_ops_compat22->release(node->nn->path, &node->nn->info.compat22);
 
   if(sz < 0)
     err = -sz;
@@ -1164,10 +1171,10 @@
 {
   struct stat stat;
   
-  assert(fuse_ops);
-  assert(fuse_ops->getattr);
+  assert(fuse_ops_compat22);
+  assert(fuse_ops_compat22->getattr);
   
-  fuse_ops->getattr(name, &stat);
+  fuse_ops_compat22->getattr(name, &stat);
   return stat.st_ino;
 }
 
@@ -1316,10 +1323,11 @@
   handle->parent = dir->nn;
   handle->hdrpos = (struct dirent*) *data;
 
-  if(fuse_ops)
-    fuse_ops->getdir(dir->nn->path, handle, get_dirents_getdir_helper);
+  if(fuse_ops_compat22)
+    fuse_ops_compat22->getdir(dir->nn->path, handle,
+                             get_dirents_getdir_helper);
   else
-    fuse_ops_compat->getdir(dir->nn->path, handle,
+    fuse_ops_compat2->getdir(dir->nn->path, handle,
                            get_dirents_getdir_helper_compat);
                            
 
@@ -1449,7 +1457,7 @@
   error_t err;
   FUNC_PROLOGUE_NODE("get_dirents_readdir", dir);
 
-  if(! (fuse_ops && fuse_ops->readdir))
+  if(! (fuse_ops_compat22 && fuse_ops_compat22->readdir))
     FUNC_RETURN(EOPNOTSUPP);
 
   fuse_dirh_t handle;
@@ -1479,20 +1487,22 @@
   handle->parent = dir->nn;
   handle->hdrpos = (struct dirent*) *data;
 
-  if(fuse_ops->opendir
-     && (err = fuse_ops->opendir(dir->nn->path, &dir->nn->info)))
+  if(fuse_ops_compat22->opendir
+     && (err = fuse_ops_compat22->opendir(dir->nn->path,
+                                         &dir->nn->info.compat22)))
     goto out;
 
-  if((err = fuse_ops->readdir(dir->nn->path, handle, 
-                             get_dirents_readdir_helper, first_entry, 
-                             &dir->nn->info))) 
+  if((err = fuse_ops_compat22->readdir(dir->nn->path, handle, 
+                                      get_dirents_readdir_helper,
+                                      first_entry, &dir->nn->info.compat22))) 
     {
-      fuse_ops->releasedir(dir->nn->path, &dir->nn->info);
+      fuse_ops_compat22->releasedir(dir->nn->path, &dir->nn->info.compat22);
       goto out;
     }
 
-  if(fuse_ops->releasedir
-     && (err = fuse_ops->releasedir(dir->nn->path, &dir->nn->info)))
+  if(fuse_ops_compat22->releasedir
+     && (err = fuse_ops_compat22->releasedir(dir->nn->path,
+                                            &dir->nn->info.compat22)))
     goto out;
 
   *data_len -= handle->size; /* subtract number of bytes left in the
@@ -1526,7 +1536,7 @@
     goto out;
 
 
-  if(fuse_ops && fuse_ops->readdir)
+  if(fuse_ops_compat22 && fuse_ops_compat22->readdir)
     err = get_dirents_readdir(dir, first_entry, num_entries, data, data_len,
                              data_entries);
 
Index: libfuse/src/netnode.c
diff -u libfuse/src/netnode.c:1.1 libfuse/src/netnode.c:1.2
--- libfuse/src/netnode.c:1.1   Mon Jan 30 22:37:59 2006
+++ libfuse/src/netnode.c       Thu Apr 13 22:52:47 2006
@@ -152,9 +152,10 @@
          {
            if(he->nn->may_need_sync)
              {
-               err = -(fuse_ops ?
-                       fuse_ops->fsync(he->nn->path, 0, &he->nn->info) :
-                       fuse_ops_compat->fsync(he->nn->path, 0));
+               err = -(fuse_ops_compat22 ?
+                       fuse_ops_compat22->fsync(he->nn->path, 0,
+                                                &he->nn->info.compat22) :
+                       fuse_ops_compat2->fsync(he->nn->path, 0));
                
                if(err)
                  goto out;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]