2006-01-20 Miklos Szeredi <miklos@szeredi.hu>
- * 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
* 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 <miklos@szeredi.hu>
-AC_INIT(fuse, 2.6.0)
+AC_INIT(fuse, 2.5.1)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(include/config.h)
#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)
*/
#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
*
*/
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
*
-AC_INIT(fuse-kernel, 2.6.0)
+AC_INIT(fuse-kernel, 2.5.1)
AC_CONFIG_HEADERS([config.h])
AC_PROG_INSTALL
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
enum {
KEY_HELP,
+ KEY_KEEP
};
#define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v }
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),
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) {
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;
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) {
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;
KEY_HELP,
KEY_HELP_NOHEADER,
KEY_VERSION,
+ KEY_KEEP,
};
struct 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
};
}
default:
+ case KEY_KEEP:
return 1;
}
}