libfuse: fuse_opt Struct Reference

libfuse

Data Fields
fuse_opt Struct Reference

`#include <fuse_opt.h>`

## Data Fields
const char * | templ
unsigned long | offset
int | value

## Detailed Description

Option description

This structure describes a single option, and action associated with it, in case it matches.

More than one such match may occur, in which case the action for each match is executed.

There are three possible actions in case of a match:

i) An integer (int or unsigned) variable determined by 'offset' is set to 'value'

ii) The processing function is called, with 'value' as the key

iii) An integer (any) or string (char *) variable determined by 'offset' is set to the value of an option parameter

'offset' should normally be either set to

- 'offsetof(struct foo, member)' actions i) and iii)
- -1 action ii)

The 'offsetof()' macro is defined in the <stddef.h> header.

The template determines which options match, and also have an effect on the action. Normally the action is either i) or ii), but if a format is present in the template, then action iii) is performed.

The types of templates are:

1) "-x", "-foo", "--foo", "--foo-bar", etc. These match only themselves. Invalid values are "--" and anything beginning with "-o"

2) "foo", "foo-bar", etc. These match "-ofoo", "-ofoo-bar" or the relevant option in a comma separated option list

3) "bar=", "--foo=", etc. These are variations of 1) and 2) which have a parameter

4) "bar=%s", "--foo=%lu", etc. Same matching as above but perform action iii).

5) "-x ", etc. Matches either "-xparam" or "-x param" as two separate arguments

6) "-x %s", etc. Combination of 4) and 5)

If the format is "%s", memory is allocated for the string unlike with scanf(). The previous value (if non-NULL) stored at the this location is freed.

Definition at line 77 of file fuse_opt.h.

## Field Documentation

## ◆ offset

unsigned long fuse_opt::offset

Offset of variable within 'data' parameter of fuse_opt_parse() or -1

Definition at line 85 of file fuse_opt.h.

## ◆ templ

const char * fuse_opt::templ

Matching template and optional parameter formatting

Definition at line 79 of file fuse_opt.h.

## ◆ value

int fuse_opt::value

Value to set the variable to, or to be passed as 'key' to the processing function. Ignored if template has a format

Definition at line 91 of file fuse_opt.h.

The documentation for this struct was generated from the following files:

- fuse-3.17.4/include/fuse_opt.h
- fuse-3.18.1/include/fuse_opt.h
- include/fuse_opt.h