From: Miklos Szeredi Date: Wed, 18 Jan 2006 12:17:33 +0000 (+0000) Subject: fix X-Git-Tag: fuse_2_5_2~11 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d1d734c271d341f007090d187c24e38309a275a5;p=qemu-gpiodev%2Flibfuse.git fix --- diff --git a/ChangeLog b/ChangeLog index 8b76422..756d02b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-01-18 Miklos Szeredi + + * kernel: fix detection of case when fuse is not configured into + the kernel either as module or built-in + + * fuse_opt.h: fix incompatibility with C++ compilers by renaming + 'template' structure member to 'templ'. Reported by Takashi Iwai + + * fuse.h: fix compatibility bugs. Patch by Yura Pakhuchiy + + * kernel: support version 2.6.16 (i_sem -> i_mutex) + 2006-01-14 Miklos Szeredi * Released 2.5.0 @@ -12,7 +24,7 @@ * Clearing ->connected or ->mounted connection flags could race with setting other bitfields not protected with a lock - + 2006-01-10 Miklos Szeredi * kernel: add necessary compile flags for 2.4.X/x86_64. diff --git a/configure.in b/configure.in index d14db87..aa627ca 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(fuse, 2.5.0) +AC_INIT(fuse, 2.5.1) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AM_CONFIG_HEADER(include/config.h) diff --git a/include/fuse.h b/include/fuse.h index a94c61a..09206b4 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -549,13 +549,14 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); # define fuse_setup fuse_setup_compat22 # define fuse_operations fuse_operations_compat22 # define fuse_file_info fuse_file_info_compat22 +# define fuse_mount fuse_mount_compat22 # else # define fuse_dirfil_t fuse_dirfil_t_compat # define __fuse_read_cmd fuse_read_cmd # define __fuse_process_cmd fuse_process_cmd # define __fuse_loop_mt fuse_loop_mt_proc # if FUSE_USE_VERSION == 21 -# define FUSE_MAJOR_VERSION 2 +# define FUSE_MINOR_VERSION 1 # define fuse_operations fuse_operations_compat2 # define fuse_main fuse_main_compat2 # define fuse_new fuse_new_compat2 @@ -563,6 +564,7 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); # define __fuse_teardown fuse_teardown # define __fuse_exited fuse_exited # define __fuse_set_getcontext_func fuse_set_getcontext_func +# define fuse_mount fuse_mount_compat22 # else # warning Compatibility with API version 11 is deprecated # undef FUSE_MAJOR_VERSION diff --git a/include/fuse_opt.h b/include/fuse_opt.h index 2ef5d56..2988902 100644 --- a/include/fuse_opt.h +++ b/include/fuse_opt.h @@ -72,7 +72,7 @@ extern "C" { */ struct fuse_opt { /** Matching template and optional parameter formatting */ - const char *template; + const char *templ; /** * Offset of variable within 'data' parameter of fuse_opt_parse() @@ -82,7 +82,7 @@ struct fuse_opt { /** * Value to set the variable to, or to be passed as 'key' to the - * processing function. Ignored if template a format + * processing function. Ignored if template has a format */ int value; }; @@ -91,13 +91,13 @@ struct fuse_opt { * Key option. In case of a match, the processing function will be * called with the specified key. */ -#define FUSE_OPT_KEY(template, key) { template, -1U, key } +#define FUSE_OPT_KEY(templ, key) { templ, -1U, key } /** * Last option. An array of 'struct fuse_opt' must end with a NULL * template value */ -#define FUSE_OPT_END { .template = NULL } +#define FUSE_OPT_END { .templ = NULL } /** * Argument list @@ -120,7 +120,7 @@ struct fuse_args { /** * Key value passed to the processing function if an option did not - * match any templated + * match any template */ #define FUSE_OPT_KEY_OPT -1 diff --git a/kernel/configure.ac b/kernel/configure.ac index 12d224a..570f8ce 100644 --- a/kernel/configure.ac +++ b/kernel/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(fuse-kernel, 2.5.0) +AC_INIT(fuse-kernel, 2.5.1) AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL @@ -37,7 +37,9 @@ if test -z "$enable_kernel_module" -a -z "$kernelbuild" && echo "$runver" | grep fi if test "$checkmodule" = yes; then AC_MSG_CHECKING([if FUSE module is from official kernel]) - if fgrep -q "fuse distribution version: " /lib/modules/${runver}/kernel/fs/fuse/fuse.ko 2> /dev/null; then + if test ! -f /lib/modules/${runver}/kernel/fs/fuse/fuse.ko; then + AC_MSG_RESULT([no]) + elif fgrep -q "fuse distribution version: " /lib/modules/${runver}/kernel/fs/fuse/fuse.ko 2> /dev/null; then AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) diff --git a/kernel/file.c b/kernel/file.c index 14c4f7c..bf46a9c 100644 --- a/kernel/file.c +++ b/kernel/file.c @@ -675,9 +675,15 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf, struct inode *inode = file->f_dentry->d_inode; ssize_t res; /* Don't allow parallel writes to the same file */ +#ifdef KERNEL_2_6_16_PLUS + mutex_lock(&inode->i_mutex); + res = fuse_direct_io(file, buf, count, ppos, 1); + mutex_unlock(&inode->i_mutex); +#else down(&inode->i_sem); res = fuse_direct_io(file, buf, count, ppos, 1); up(&inode->i_sem); +#endif return res; } diff --git a/kernel/fuse_i.h b/kernel/fuse_i.h index 84e17dc..57d9194 100644 --- a/kernel/fuse_i.h +++ b/kernel/fuse_i.h @@ -40,6 +40,9 @@ # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) # define KERNEL_2_6_13_PLUS # endif +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) +# define KERNEL_2_6_16_PLUS +# endif #endif #include "config.h" diff --git a/lib/Makefile.am b/lib/Makefile.am index d58cfed..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:5:0 \ +libfuse_la_LDFLAGS = -lpthread -version-number 2:5:1 \ -Wl,--version-script,fuse_versionscript EXTRA_DIST = fuse_versionscript diff --git a/lib/fuse_opt.c b/lib/fuse_opt.c index 2ac499c..65ff1ec 100644 --- a/lib/fuse_opt.c +++ b/lib/fuse_opt.c @@ -155,8 +155,8 @@ static int match_template(const char *t, const char *arg, unsigned *sepp) static const struct fuse_opt *find_opt(const struct fuse_opt *opt, const char *arg, unsigned *sepp) { - for (; opt && opt->template; opt++) - if (match_template(opt->template, arg, sepp)) + for (; opt && opt->templ; opt++) + if (match_template(opt->templ, arg, sepp)) return opt; return NULL; } @@ -195,11 +195,11 @@ static int process_opt(struct fuse_opt_context *ctx, return -1; } else { void *var = ctx->data + opt->offset; - if (sep && opt->template[sep + 1]) { + if (sep && opt->templ[sep + 1]) { const char *param = arg + sep; - if (opt->template[sep] == '=') + if (opt->templ[sep] == '=') param ++; - if (process_opt_param(var, opt->template + sep + 1, + if (process_opt_param(var, opt->templ + sep + 1, param, arg) == -1) return -1; } else @@ -239,7 +239,7 @@ static int process_gopt(struct fuse_opt_context *ctx, const char *arg, int iso) if (opt) { for (; opt; opt = find_opt(opt + 1, arg, &sep)) { int res; - if (sep && opt->template[sep] == ' ' && !arg[sep]) + if (sep && opt->templ[sep] == ' ' && !arg[sep]) res = process_opt_sep_arg(ctx, opt, sep, arg, iso); else res = process_opt(ctx, opt, sep, arg, iso);