From 100944bd7216669701715ddd61059f9d6750a4cf Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Thu, 13 Jul 2017 13:23:32 +0200 Subject: Only declare fuse_new_30() when FUSE_USE_VERSION == 30 This function shouldn't be called when using a newer fuse version, so we should not define it in that case. --- include/fuse.h | 4 ++-- lib/fuse.c | 50 ++++++++++++++++++++++++++------------------------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/include/fuse.h b/include/fuse.h index f4ac670..19fd12c 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -835,13 +835,13 @@ void fuse_lib_help(struct fuse_args *args); * @return the created FUSE handle */ #if FUSE_USE_VERSION == 30 +struct fuse *fuse_new_30(struct fuse_args *args, const struct fuse_operations *op, + size_t op_size, void *private_data); #define fuse_new(args, op, size, data) fuse_new_30(args, op, size, data) #else struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *private_data); #endif -struct fuse *fuse_new_30(struct fuse_args *args, const struct fuse_operations *op, - size_t op_size, void *private_data); /** * Mount a FUSE file system. diff --git a/lib/fuse.c b/lib/fuse.c index 08dab22..75f13d7 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -4626,30 +4626,6 @@ void fuse_stop_cleanup_thread(struct fuse *f) } -/* Emulates 3.0-style fuse_new(), which processes --help */ -FUSE_SYMVER(".symver fuse_new_30,fuse_new@FUSE_3.0"); -struct fuse *fuse_new_30(struct fuse_args *args, - const struct fuse_operations *op, - size_t op_size, void *user_data) -{ - struct fuse_config conf; - const struct fuse_opt opts[] = { - FUSE_LIB_OPT("-h", show_help, 1), - FUSE_LIB_OPT("--help", show_help, 1), - FUSE_OPT_END - }; - - if (fuse_opt_parse(args, &conf, opts, - fuse_lib_opt_proc) == -1) - return NULL; - - if (conf.show_help) { - fuse_lib_help(args); - return NULL; - } else - return fuse_new_31(args, op, op_size, user_data); -} - /* Explicit prototype to prevent compiler warnings (fuse.h only defines fuse_new()) */ struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *op, @@ -4803,6 +4779,32 @@ out: return NULL; } +/* Emulates 3.0-style fuse_new(), which processes --help */ +struct fuse *fuse_new_30(struct fuse_args *args, const struct fuse_operations *op, + size_t op_size, void *private_data); +FUSE_SYMVER(".symver fuse_new_30,fuse_new@FUSE_3.0"); +struct fuse *fuse_new_30(struct fuse_args *args, + const struct fuse_operations *op, + size_t op_size, void *user_data) +{ + struct fuse_config conf; + const struct fuse_opt opts[] = { + FUSE_LIB_OPT("-h", show_help, 1), + FUSE_LIB_OPT("--help", show_help, 1), + FUSE_OPT_END + }; + + if (fuse_opt_parse(args, &conf, opts, + fuse_lib_opt_proc) == -1) + return NULL; + + if (conf.show_help) { + fuse_lib_help(args); + return NULL; + } else + return fuse_new_31(args, op, op_size, user_data); +} + void fuse_destroy(struct fuse *f) { size_t i; -- cgit v1.2.3