From 1eb58cefd72af76e3086a3e2c6228bd35885efc7 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Sat, 21 Jan 2006 09:37:16 +0000 Subject: [PATCH] reverted some changes --- ChangeLog | 7 ------- configure.in | 2 +- include/fuse_common.h | 2 +- include/fuse_opt.h | 31 ------------------------------- kernel/configure.ac | 2 +- lib/Makefile.am | 2 +- lib/fuse.c | 5 +++-- lib/fuse_opt.c | 39 ++++++++++++++++++--------------------- lib/fuse_versionscript | 7 +------ lib/helper.c | 8 +++++--- 10 files changed, 31 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85a9382..f2b7f4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,5 @@ 2006-01-20 Miklos Szeredi - * fuse_opt: add new helper constants FUSE_OPT_KEY_KEEP and - FUSE_OPT_KEY_DISCARD - * Sanitize storage type and help message in mount_bsd.c. Patch from Csaba Henk @@ -10,10 +7,6 @@ * lib: if "fsname=" option was given, pass it to fusermount - * fuse_opt: add new fuse_opt_insert_arg() function, which is - needed by filesystems to implement some argument manipulations - correctly - * fuse_opt: fix memory leak in handling "--" option 2006-01-18 Miklos Szeredi diff --git a/configure.in b/configure.in index 1cb45a9..aa627ca 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(fuse, 2.6.0) +AC_INIT(fuse, 2.5.1) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AM_CONFIG_HEADER(include/config.h) diff --git a/include/fuse_common.h b/include/fuse_common.h index 613a1e8..0f35ea6 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -20,7 +20,7 @@ #define FUSE_MAJOR_VERSION 2 /** Minor version of FUSE library interface */ -#define FUSE_MINOR_VERSION 6 +#define FUSE_MINOR_VERSION 5 #define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min)) #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION) diff --git a/include/fuse_opt.h b/include/fuse_opt.h index 9e159d5..2988902 100644 --- a/include/fuse_opt.h +++ b/include/fuse_opt.h @@ -132,22 +132,6 @@ struct fuse_args { */ #define FUSE_OPT_KEY_NONOPT -2 -/** - * Special key value for options to keep - * - * Argument is not passed to processing function, but behave as if the - * processing function returned 1 - */ -#define FUSE_OPT_KEY_KEEP -3 - -/** - * Special key value for options to discard - * - * Argument is not passed to processing function, but behave as if the - * processing function returned zero - */ -#define FUSE_OPT_KEY_DISCARD -4 - /** * Processing function * @@ -217,21 +201,6 @@ int fuse_opt_add_opt(char **opts, const char *opt); */ int fuse_opt_add_arg(struct fuse_args *args, const char *arg); -/** - * Add an argument at the specified position in a NULL terminated - * argument vector - * - * Adds the argument to the N-th position. This is useful for adding - * options at the beggining of the array which must not come after the - * special '--' option. - * - * @param args is the structure containing the current argument list - * @param pos is the position at which to add the argument - * @param arg is the new argument to add - * @return -1 on allocation error, 0 on success - */ -int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg); - /** * Free the contents of argument list * diff --git a/kernel/configure.ac b/kernel/configure.ac index f90a57b..570f8ce 100644 --- a/kernel/configure.ac +++ b/kernel/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(fuse-kernel, 2.6.0) +AC_INIT(fuse-kernel, 2.5.1) AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL diff --git a/lib/Makefile.am b/lib/Makefile.am index e0fbfb0..fb52a0b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -22,7 +22,7 @@ libfuse_la_SOURCES = \ helper.c \ $(mount_source) -libfuse_la_LDFLAGS = -lpthread -version-number 2:6:0 \ +libfuse_la_LDFLAGS = -lpthread -version-number 2:5:1 \ -Wl,--version-script,fuse_versionscript EXTRA_DIST = fuse_versionscript diff --git a/lib/fuse.c b/lib/fuse.c index 0488c9c..7d66a7d 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -1808,6 +1808,7 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)) enum { KEY_HELP, + KEY_KEEP }; #define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v } @@ -1815,8 +1816,8 @@ enum { static const struct fuse_opt fuse_lib_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), - FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP), - FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP), + FUSE_OPT_KEY("debug", KEY_KEEP), + FUSE_OPT_KEY("-d", KEY_KEEP), FUSE_LIB_OPT("debug", debug, 1), FUSE_LIB_OPT("-d", debug, 1), FUSE_LIB_OPT("hard_remove", hard_remove, 1), diff --git a/lib/fuse_opt.c b/lib/fuse_opt.c index 582c6ad..3ba6098 100644 --- a/lib/fuse_opt.c +++ b/lib/fuse_opt.c @@ -62,21 +62,6 @@ int fuse_opt_add_arg(struct fuse_args *args, const char *arg) return 0; } -int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg) -{ - assert(pos <= args->argc); - if (fuse_opt_add_arg(args, arg) == -1) - return -1; - - if (pos != args->argc - 1) { - char *newarg = args->argv[args->argc - 1]; - memmove(&args->argv[pos + 1], &args->argv[pos], - sizeof(char *) * (args->argc - pos - 1)); - args->argv[pos] = newarg; - } - return 0; -} - static int next_arg(struct fuse_opt_context *ctx, const char *opt) { if (ctx->argctr + 1 >= ctx->argc) { @@ -117,13 +102,25 @@ static int add_opt(struct fuse_opt_context *ctx, const char *opt) return fuse_opt_add_opt(&ctx->opts, opt); } +static int insert_arg(struct fuse_opt_context *ctx, int pos, const char *arg) +{ + assert(pos <= ctx->outargs.argc); + if (add_arg(ctx, arg) == -1) + return -1; + + if (pos != ctx->outargs.argc - 1) { + char *newarg = ctx->outargs.argv[ctx->outargs.argc - 1]; + memmove(&ctx->outargs.argv[pos + 1], &ctx->outargs.argv[pos], + sizeof(char *) * (ctx->outargs.argc - pos - 1)); + ctx->outargs.argv[pos] = newarg; + } + return 0; +} + static int call_proc(struct fuse_opt_context *ctx, const char *arg, int key, int iso) { - if (key == FUSE_OPT_KEY_DISCARD) - return 0; - - if (key != FUSE_OPT_KEY_KEEP && ctx->proc) { + if (ctx->proc) { int res = ctx->proc(ctx->data, arg, key, &ctx->outargs); if (res == -1 || !res) return res; @@ -324,8 +321,8 @@ static int opt_parse(struct fuse_opt_context *ctx) return -1; if (ctx->opts) { - if (fuse_opt_insert_arg(&ctx->outargs, 1, "-o") == -1 || - fuse_opt_insert_arg(&ctx->outargs, 2, ctx->opts) == -1) + if (insert_arg(ctx, 1, "-o") == -1 || + insert_arg(ctx, 2, ctx->opts) == -1) return -1; } if (ctx->nonopt && ctx->nonopt == ctx->outargs.argc) { diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index c09a905..9927158 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -84,12 +84,7 @@ FUSE_2.5 { fuse_setup; fuse_setup_compat22; fuse_set_signal_handlers; -} FUSE_2.4; - -FUSE_2.6 { - global: - fuse_opt_insert_arg; local: *; -} FUSE_2.5; +} FUSE_2.4; diff --git a/lib/helper.c b/lib/helper.c index fcaaf36..c4a7b3a 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -22,6 +22,7 @@ enum { KEY_HELP, KEY_HELP_NOHEADER, KEY_VERSION, + KEY_KEEP, }; struct helper_opts { @@ -45,9 +46,9 @@ static const struct fuse_opt fuse_helper_opts[] = { FUSE_OPT_KEY("-ho", KEY_HELP_NOHEADER), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), - FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP), - FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP), - FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP), + FUSE_OPT_KEY("-d", KEY_KEEP), + FUSE_OPT_KEY("debug", KEY_KEEP), + FUSE_OPT_KEY("fsname=", KEY_KEEP), FUSE_OPT_END }; @@ -106,6 +107,7 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key, } default: + case KEY_KEEP: return 1; } } -- 2.30.2