From 799993c4b7c096c3d131515b127628d8329e395f Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Sat, 4 Dec 2004 21:20:05 +0000 Subject: [PATCH] fix --- ChangeLog | 8 ++++++++ fuse.pc.in | 2 +- include/fuse.h | 6 +++--- lib/helper.c | 30 +++++++++++++++++------------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28bb9ce..db3ed7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-12-04 Miklos Szeredi + + * 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 * Add source compatibility to 2.1 and 1.1 APIs. To select betwen diff --git a/fuse.pc.in b/fuse.pc.in index d55970c..54f0c49 100644 --- a/fuse.pc.in +++ b/fuse.pc.in @@ -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 diff --git a/include/fuse.h b/include/fuse.h index 3223155..ebf8698 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -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 diff --git a/lib/helper.c b/lib/helper.c index 50d43c1..fc17973 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -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); -- 2.30.2