History log of /openbsd-current/lib/libfuse/fuse_opt.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.27 16-Jan-2022 naddy

libfuse: fix -Wunused-but-set-variable warning

ok tb@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.26 15-May-2018 helg

Use memset(3) instead of bzero(3) for consistency and as per POSIX
recommendation.


Revision tags: OPENBSD_6_3_BASE
# 1.25 15-Dec-2017 jca

Export only symbols to what's declared in fuse.h/fuse_opt.h

While here, use guenther's magic recipe to avoid the PLT when calling
exported symbols from within the library.

ok kettenis@ for v1, ok guenther@ helg@


# 1.24 14-Dec-2017 jca

fuse_opt_add_opt_escaped needs to allocate space for the terminating NUL

Spotted by malloc.conf -> S, ok helg@


# 1.23 13-Dec-2017 helg

If the list of templates 'o' passed to fuse_opt_parse(3) is NULL then
the processing function should be called in the same way as if no match
was found.

ok mpi@


# 1.22 11-Dec-2017 helg

sscanf(3) is now used to parse templates that contain format specifiers
(e.g. %u, %o) other than %s. This aligns libfuse with the Linux reference
implementation.


ok mpi@


# 1.21 11-Dec-2017 helg

Update to fuse_opt_parse(3) so that all option templates are now matched for
the supplied option. This allows the following templates to be supplied to set
multiple members of a struct at the same time. e.g.

#define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v }

static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("gid=", set_gid, 1),
FUSE_LIB_OPT("gid=%u", gid, 0),
FUSE_OPT_END
};

If "-ogid=1000" is passed to fuse_opt_parse(3) it will set both:

fuse_config.set_gid=1
fuse_config.gid=1000


ok mpi@


# 1.20 11-Dec-2017 helg

The fuse_opt_match(3) library function does not match options correctly.
libfuse supports option templates of the following form that can be used
to automatically parse arguments supplied on the command line.

"-p " argument that takes an option e.g -p 22 or -p22
"-p %x" argument that takes an option parsed like sscanf(3)
"cache=yes" matches -ocache=yes or -o cache=yes
"cache=%s" matches -ocache=<string> or -o cache=<string>
"cache=" matches same as above but value is passed to option proc
"noatime" matches -onoatime or -o atime

For example, it does not match options of the form "-p 22" or
"cache=yes" to the corresponding templates "-p " and "cache=yes". This
patch fixes that and updates the regression tests accordingly.

ok mpi@


# 1.19 16-Nov-2017 helg

Add support for:
multiple options after -o.
arguments that require options e.g. -p 22
%s, %lu, %u option templates

ok mpi@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 04-Jan-2017 stsp

Revert fuse_opt.c r1.17. It broke exfat-fuse and perhaps other plugins.
http://marc.info/?l=openbsd-ports&m=148170738917809&w=2
reported by yasuoka@


# 1.17 23-Nov-2016 mpi

Empty strings are invalid arguments.

Fix a regression introduced when merging the two options parsers.

ok stsp@


Revision tags: OPENBSD_6_0_BASE
# 1.16 24-May-2016 okan

NUL-terminate argv when parsing options, following other
implementations; fixes issue when exec*() is used for
fuse_args, notably in sshfs; from Hiltjo Posthuma and
reminded by ray.

ok mpi@


Revision tags: OPENBSD_5_9_BASE
# 1.15 19-Oct-2015 tedu

missing deref on char check. from David Binderman


# 1.14 24-Aug-2015 mpi

When an option is not recognized call the processing function with
FUSE_OPT_KEY_OPT, while here fix the last argument of a call in
fuse_opt_parse().

Diff from Thi��baud Weksteen <thiebaud AT weksteen DOT fr>, thanks!

ok syl@, ajacoutot@


Revision tags: OPENBSD_5_8_BASE
# 1.13 07-Jul-2015 ajacoutot

Unbreak option parsing:
fuse_opt_pase is called with an opaque void * and struct fuse_opt. If val has a
positive value and off != -1, we modify the opaque void * at the offset off to
put it val.
This matches what the GNU libfuse does.

fixes (at least) simple-mtpfs option parsing
diff from slacker syl@, thanks!

"it can't get worse than not working" mikeb@
ok miod@ sthen@


Revision tags: OPENBSD_5_7_BASE
# 1.12 06-Feb-2015 millert

SIZE_MAX is standard, we should be using it in preference to the
obsolete SIZE_T_MAX. OK miod@ beck@


# 1.11 08-Oct-2014 deraadt

use reallocarray(); ok doug


Revision tags: OPENBSD_5_6_BASE
# 1.10 20-May-2014 syl

Add support for -o XXX or -oXXX options in libfuse.

inputs from tedu@, ok tedu@


# 1.9 15-Apr-2014 syl

Init outargs only once, and fix a bad bzero().

Spotted by jsg@, ok jsg@


Revision tags: OPENBSD_5_5_BASE
# 1.8 21-Jan-2014 jca

Mark fuse_opt_parse()'s third argument as a point to const, to match the
reference FUSE implementation. ok syl@


# 1.7 04-Nov-2013 syl

fuse_opt_insert_arg() can take empty string as argument.

unbreak ntfs-3g.
ok pirofti@


# 1.6 02-Nov-2013 syl

Update the fuse_opt to have option like -h working.

ok ajacoutot@


Revision tags: OPENBSD_5_4_BASE
# 1.5 11-Jul-2013 syl

Merge fuse_opt code with stsp@ fuse_opt code.

ok tedu@


# 1.4 12-Jun-2013 tedu

style for loops


# 1.3 12-Jun-2013 tedu

correct realloc usage


# 1.2 12-Jun-2013 tedu

style


# 1.1 12-Jun-2013 tedu

fuse_opt support from Sylvestre


# 1.26 15-May-2018 helg

Use memset(3) instead of bzero(3) for consistency and as per POSIX
recommendation.


Revision tags: OPENBSD_6_3_BASE
# 1.25 15-Dec-2017 jca

Export only symbols to what's declared in fuse.h/fuse_opt.h

While here, use guenther's magic recipe to avoid the PLT when calling
exported symbols from within the library.

ok kettenis@ for v1, ok guenther@ helg@


# 1.24 14-Dec-2017 jca

fuse_opt_add_opt_escaped needs to allocate space for the terminating NUL

Spotted by malloc.conf -> S, ok helg@


# 1.23 13-Dec-2017 helg

If the list of templates 'o' passed to fuse_opt_parse(3) is NULL then
the processing function should be called in the same way as if no match
was found.

ok mpi@


# 1.22 11-Dec-2017 helg

sscanf(3) is now used to parse templates that contain format specifiers
(e.g. %u, %o) other than %s. This aligns libfuse with the Linux reference
implementation.


ok mpi@


# 1.21 11-Dec-2017 helg

Update to fuse_opt_parse(3) so that all option templates are now matched for
the supplied option. This allows the following templates to be supplied to set
multiple members of a struct at the same time. e.g.

#define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v }

static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("gid=", set_gid, 1),
FUSE_LIB_OPT("gid=%u", gid, 0),
FUSE_OPT_END
};

If "-ogid=1000" is passed to fuse_opt_parse(3) it will set both:

fuse_config.set_gid=1
fuse_config.gid=1000


ok mpi@


# 1.20 11-Dec-2017 helg

The fuse_opt_match(3) library function does not match options correctly.
libfuse supports option templates of the following form that can be used
to automatically parse arguments supplied on the command line.

"-p " argument that takes an option e.g -p 22 or -p22
"-p %x" argument that takes an option parsed like sscanf(3)
"cache=yes" matches -ocache=yes or -o cache=yes
"cache=%s" matches -ocache=<string> or -o cache=<string>
"cache=" matches same as above but value is passed to option proc
"noatime" matches -onoatime or -o atime

For example, it does not match options of the form "-p 22" or
"cache=yes" to the corresponding templates "-p " and "cache=yes". This
patch fixes that and updates the regression tests accordingly.

ok mpi@


# 1.19 16-Nov-2017 helg

Add support for:
multiple options after -o.
arguments that require options e.g. -p 22
%s, %lu, %u option templates

ok mpi@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 04-Jan-2017 stsp

Revert fuse_opt.c r1.17. It broke exfat-fuse and perhaps other plugins.
http://marc.info/?l=openbsd-ports&m=148170738917809&w=2
reported by yasuoka@


# 1.17 23-Nov-2016 mpi

Empty strings are invalid arguments.

Fix a regression introduced when merging the two options parsers.

ok stsp@


Revision tags: OPENBSD_6_0_BASE
# 1.16 24-May-2016 okan

NUL-terminate argv when parsing options, following other
implementations; fixes issue when exec*() is used for
fuse_args, notably in sshfs; from Hiltjo Posthuma and
reminded by ray.

ok mpi@


Revision tags: OPENBSD_5_9_BASE
# 1.15 19-Oct-2015 tedu

missing deref on char check. from David Binderman


# 1.14 24-Aug-2015 mpi

When an option is not recognized call the processing function with
FUSE_OPT_KEY_OPT, while here fix the last argument of a call in
fuse_opt_parse().

Diff from Thi��baud Weksteen <thiebaud AT weksteen DOT fr>, thanks!

ok syl@, ajacoutot@


Revision tags: OPENBSD_5_8_BASE
# 1.13 07-Jul-2015 ajacoutot

Unbreak option parsing:
fuse_opt_pase is called with an opaque void * and struct fuse_opt. If val has a
positive value and off != -1, we modify the opaque void * at the offset off to
put it val.
This matches what the GNU libfuse does.

fixes (at least) simple-mtpfs option parsing
diff from slacker syl@, thanks!

"it can't get worse than not working" mikeb@
ok miod@ sthen@


Revision tags: OPENBSD_5_7_BASE
# 1.12 06-Feb-2015 millert

SIZE_MAX is standard, we should be using it in preference to the
obsolete SIZE_T_MAX. OK miod@ beck@


# 1.11 08-Oct-2014 deraadt

use reallocarray(); ok doug


Revision tags: OPENBSD_5_6_BASE
# 1.10 20-May-2014 syl

Add support for -o XXX or -oXXX options in libfuse.

inputs from tedu@, ok tedu@


# 1.9 15-Apr-2014 syl

Init outargs only once, and fix a bad bzero().

Spotted by jsg@, ok jsg@


Revision tags: OPENBSD_5_5_BASE
# 1.8 21-Jan-2014 jca

Mark fuse_opt_parse()'s third argument as a point to const, to match the
reference FUSE implementation. ok syl@


# 1.7 04-Nov-2013 syl

fuse_opt_insert_arg() can take empty string as argument.

unbreak ntfs-3g.
ok pirofti@


# 1.6 02-Nov-2013 syl

Update the fuse_opt to have option like -h working.

ok ajacoutot@


Revision tags: OPENBSD_5_4_BASE
# 1.5 11-Jul-2013 syl

Merge fuse_opt code with stsp@ fuse_opt code.

ok tedu@


# 1.4 12-Jun-2013 tedu

style for loops


# 1.3 12-Jun-2013 tedu

correct realloc usage


# 1.2 12-Jun-2013 tedu

style


# 1.1 12-Jun-2013 tedu

fuse_opt support from Sylvestre


# 1.25 15-Dec-2017 jca

Export only symbols to what's declared in fuse.h/fuse_opt.h

While here, use guenther's magic recipe to avoid the PLT when calling
exported symbols from within the library.

ok kettenis@ for v1, ok guenther@ helg@


# 1.24 14-Dec-2017 jca

fuse_opt_add_opt_escaped needs to allocate space for the terminating NUL

Spotted by malloc.conf -> S, ok helg@


# 1.23 13-Dec-2017 helg

If the list of templates 'o' passed to fuse_opt_parse(3) is NULL then
the processing function should be called in the same way as if no match
was found.

ok mpi@


# 1.22 11-Dec-2017 helg

sscanf(3) is now used to parse templates that contain format specifiers
(e.g. %u, %o) other than %s. This aligns libfuse with the Linux reference
implementation.


ok mpi@


# 1.21 11-Dec-2017 helg

Update to fuse_opt_parse(3) so that all option templates are now matched for
the supplied option. This allows the following templates to be supplied to set
multiple members of a struct at the same time. e.g.

#define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v }

static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("gid=", set_gid, 1),
FUSE_LIB_OPT("gid=%u", gid, 0),
FUSE_OPT_END
};

If "-ogid=1000" is passed to fuse_opt_parse(3) it will set both:

fuse_config.set_gid=1
fuse_config.gid=1000


ok mpi@


# 1.20 11-Dec-2017 helg

The fuse_opt_match(3) library function does not match options correctly.
libfuse supports option templates of the following form that can be used
to automatically parse arguments supplied on the command line.

"-p " argument that takes an option e.g -p 22 or -p22
"-p %x" argument that takes an option parsed like sscanf(3)
"cache=yes" matches -ocache=yes or -o cache=yes
"cache=%s" matches -ocache=<string> or -o cache=<string>
"cache=" matches same as above but value is passed to option proc
"noatime" matches -onoatime or -o atime

For example, it does not match options of the form "-p 22" or
"cache=yes" to the corresponding templates "-p " and "cache=yes". This
patch fixes that and updates the regression tests accordingly.

ok mpi@


# 1.19 16-Nov-2017 helg

Add support for:
multiple options after -o.
arguments that require options e.g. -p 22
%s, %lu, %u option templates

ok mpi@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 04-Jan-2017 stsp

Revert fuse_opt.c r1.17. It broke exfat-fuse and perhaps other plugins.
http://marc.info/?l=openbsd-ports&m=148170738917809&w=2
reported by yasuoka@


# 1.17 23-Nov-2016 mpi

Empty strings are invalid arguments.

Fix a regression introduced when merging the two options parsers.

ok stsp@


Revision tags: OPENBSD_6_0_BASE
# 1.16 24-May-2016 okan

NUL-terminate argv when parsing options, following other
implementations; fixes issue when exec*() is used for
fuse_args, notably in sshfs; from Hiltjo Posthuma and
reminded by ray.

ok mpi@


Revision tags: OPENBSD_5_9_BASE
# 1.15 19-Oct-2015 tedu

missing deref on char check. from David Binderman


# 1.14 24-Aug-2015 mpi

When an option is not recognized call the processing function with
FUSE_OPT_KEY_OPT, while here fix the last argument of a call in
fuse_opt_parse().

Diff from Thi��baud Weksteen <thiebaud AT weksteen DOT fr>, thanks!

ok syl@, ajacoutot@


Revision tags: OPENBSD_5_8_BASE
# 1.13 07-Jul-2015 ajacoutot

Unbreak option parsing:
fuse_opt_pase is called with an opaque void * and struct fuse_opt. If val has a
positive value and off != -1, we modify the opaque void * at the offset off to
put it val.
This matches what the GNU libfuse does.

fixes (at least) simple-mtpfs option parsing
diff from slacker syl@, thanks!

"it can't get worse than not working" mikeb@
ok miod@ sthen@


Revision tags: OPENBSD_5_7_BASE
# 1.12 06-Feb-2015 millert

SIZE_MAX is standard, we should be using it in preference to the
obsolete SIZE_T_MAX. OK miod@ beck@


# 1.11 08-Oct-2014 deraadt

use reallocarray(); ok doug


Revision tags: OPENBSD_5_6_BASE
# 1.10 20-May-2014 syl

Add support for -o XXX or -oXXX options in libfuse.

inputs from tedu@, ok tedu@


# 1.9 15-Apr-2014 syl

Init outargs only once, and fix a bad bzero().

Spotted by jsg@, ok jsg@


Revision tags: OPENBSD_5_5_BASE
# 1.8 21-Jan-2014 jca

Mark fuse_opt_parse()'s third argument as a point to const, to match the
reference FUSE implementation. ok syl@


# 1.7 04-Nov-2013 syl

fuse_opt_insert_arg() can take empty string as argument.

unbreak ntfs-3g.
ok pirofti@


# 1.6 02-Nov-2013 syl

Update the fuse_opt to have option like -h working.

ok ajacoutot@


Revision tags: OPENBSD_5_4_BASE
# 1.5 11-Jul-2013 syl

Merge fuse_opt code with stsp@ fuse_opt code.

ok tedu@


# 1.4 12-Jun-2013 tedu

style for loops


# 1.3 12-Jun-2013 tedu

correct realloc usage


# 1.2 12-Jun-2013 tedu

style


# 1.1 12-Jun-2013 tedu

fuse_opt support from Sylvestre