fix
authorMiklos Szeredi <miklos@szeredi.hu>
Sat, 4 Dec 2004 21:20:05 +0000 (21:20 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Sat, 4 Dec 2004 21:20:05 +0000 (21:20 +0000)
ChangeLog
fuse.pc.in
include/fuse.h
lib/helper.c

index 28bb9ce4c31a57c1755da8ef9d8ea311ebed0139..db3ed7de916d3a4bd4883e3fcd76af78c281962e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-12-04  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Add -D_FILE_OFFSET_BITS=64 to cflags provided by pkg-config
+
+       * helper.c: add -ho option, which only displays the options not
+       the usage header.  This can be used by filesystems which have
+       their own options.
+
 2004-12-03  Miklos Szeredi <miklos@szeredi.hu>
 
        * Add source compatibility to 2.1 and 1.1 APIs.  To select betwen
index d55970c6bbf71cb8434ec759f3c952e14285a9d6..54f0c494a1bceea4a6c40a15ac4d85ca5e1646b5 100644 (file)
@@ -7,4 +7,4 @@ Name: fuse
 Description: Filesystem in Userspace
 Version: @VERSION@
 Libs: -L${libdir} -lfuse
-Cflags: -I${includedir}/fuse
+Cflags: -I${includedir}/fuse -D_FILE_OFFSET_BITS=64
index 3223155b3bf299bfd4b74a1d932447d4a72f457d..ebf86986f06141d338bb508d3a12a12c541625fe 100644 (file)
@@ -17,6 +17,7 @@
    even older 1.X API define it to 11. */
 
 #ifndef FUSE_USE_VERSION
+#warning FUSE_USE_VERSION not defined, defaulting to 21
 #define FUSE_USE_VERSION 21
 #endif
 
@@ -342,7 +343,6 @@ void __fuse_set_getcontext_func(struct fuse_context *(*func)(void));
 #    define fuse_new _fuse_new_compat2
 #    define __fuse_setup _fuse_setup_compat2
 #  else
-#    undef FUSE_MAJOR_VERSION
 #    define FUSE_MAJOR_VERSION 1
 #    define FUSE_MINOR_VERSION 1
 #    define fuse_statfs _fuse_statfs_compat1
@@ -352,8 +352,8 @@ void __fuse_set_getcontext_func(struct fuse_context *(*func)(void));
 #    define fuse_mount _fuse_mount_compat1
 #    define FUSE_DEBUG _FUSE_DEBUG_COMPAT1
 #  endif
-#elif FUSE_USE_VERSION != 22
-#  error API version other than 22, 21 and 11 not supported
+#elif FUSE_USE_VERSION < 22
+#  error Compatibility with API version other than 21 and 11 not supported
 #endif
 
 #ifdef __cplusplus
index 50d43c1b2fa0a494773c0b86584f90d3d339e771..fc179734057d8888baafc47629f42bc9908c6299 100644 (file)
@@ -19,9 +19,12 @@ static struct fuse *fuse_instance;
 
 static void usage(const char *progname)
 {
-    fprintf(stderr,
-            "usage: %s mountpoint [options]\n"
-            "Options:\n"
+    if (progname)
+        fprintf(stderr,
+                "usage: %s mountpoint [FUSE options]\n\n", progname);
+
+    fprintf(stderr, 
+            "FUSE options:\n"
             "    -d                  enable debug output (implies -f)\n"
             "    -f                  foreground operation\n"
             "    -s                  disable multithreaded operation\n"
@@ -38,14 +41,13 @@ static void usage(const char *progname)
             "    max_read=N             set maximum size of read requests\n"
             "    hard_remove            immediate removal (don't hide files)\n"
             "    debug                  enable debug output\n"
-            "    fsname=NAME            set filesystem name in mtab\n",
-            progname);
+            "    fsname=NAME            set filesystem name in mtab\n");
 }
 
 static void invalid_option(const char *argv[], int argctr)
 {
     fprintf(stderr, "fuse: invalid option: %s\n\n", argv[argctr]);
-    usage(argv[0]);
+    fprintf(stderr, "see '%s -h' for usage\n", argv[0]);
 }
 
 static void exit_handler()
@@ -171,8 +173,8 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
                 switch (argv[argctr][1]) {
                 case 'o':
                     if (argctr + 1 == argc || argv[argctr+1][0] == '-') {
-                        fprintf(stderr, "missing option after -o\n\n");
-                        usage(argv[0]);
+                        fprintf(stderr, "missing option after -o\n");
+                        fprintf(stderr, "see '%s -h' for usage\n", argv[0]);
                         goto err;
                     }
                     argctr ++;
@@ -215,8 +217,10 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
                     res = add_options(lib_opts, kernel_opts, &argv[argctr][2]);
                     if (res == -1)
                         goto err;
-                }
-                else {
+                } else if(strcmp(argv[argctr], "-ho") == 0) {
+                    usage(NULL);
+                    goto err;
+                } else {
                     invalid_option(argv, argctr);
                     goto err;
                 }
@@ -235,8 +239,8 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
     }
 
     if (*mountpoint == NULL) {
-        fprintf(stderr, "missing mountpoint\n\n");
-        usage(argv[0]);
+        fprintf(stderr, "missing mountpoint\n");
+        fprintf(stderr, "see '%s -h' for usage\n", argv[0]);
         goto err;
     }
     return 0;
@@ -369,7 +373,7 @@ static int fuse_main_common(int argc, char *argv[],
     return 0;
 }
 
-int __fuse_main(int argc, char *argv[],const struct fuse_operations *op,
+int __fuse_main(int argc, char *argv[], const struct fuse_operations *op,
                  size_t op_size)
 {
     return fuse_main_common(argc, argv, op, op_size, 0);