/**
* Create a new FUSE filesystem.
*
+ * Known parameters in `args` are removed. If there are any unknown
+ * arguments, an error is printed to stderr and the function returns
+ * NULL.
+ *
+ * If the --help or --version parameters are specified, the function
+ * prints the requested information to stdout and returns NULL.
+ *
* @param ch the communication channel
* @param args argument vector
* @param op the filesystem operations
* Create a FUSE mountpoint
*
* Returns a control file descriptor suitable for passing to
- * fuse_new()
+ * fuse_new(). Unknown parameters in `args` are passed through
+ * unchanged. Known parameters (with the exception of --help and
+ * --version) are removed from `args`.
+ *
+ * If the --help or --version parameters are specified, the function
+ * prints the requested information to stdout and returns a valid
+ * pointer. However, it does not actually perform the mount.
*
* @param mountpoint the mount point path
* @param args argument vector
void fuse_unmount(const char *mountpoint, struct fuse_chan *ch);
/**
- * Parse common options
+ * Utility functions for simple file systems to parse common options.
*
* The following options are parsed:
*
* '-ofsname=..' file system name, if not present, then set to the program
* name
*
- * All parameters may be NULL
+ * Unknown parameters in `args` are passed through unchanged. Known
+ * parameters (with the exception of --help and --version) are removed.
+ *
+ * All parameters may be NULL (in which case they may still
+ * be specified on the command line, but will not be set).
*
* @param args argument vector
* @param mountpoint the returned mountpoint, should be freed after use
/**
* Create a low level session
*
+ * Known parameters in `args` are removed. If there are any unknown
+ * arguments, an error is printed to stderr and the function returns
+ * NULL.
+ *
+ * If the --help or --version parameters are specified, the function
+ * prints the requsted information to stdout and returns NULL.
+ *
* @param args argument vector
* @param op the low level filesystem operations
* @param op_size sizeof(struct fuse_lowlevel_ops)
init_list_head(&f->full_slabs);
init_list_head(&f->lru_table);
+ /* When --help or --version are specified, we print messages
+ to stderr but continue for now (and keep the arguments in
+ `args` for use below */
if (fuse_opt_parse(args, &f->conf, fuse_lib_opts,
fuse_lib_opt_proc) == -1)
goto out_free_fs;
f->conf.readdir_ino = 1;
#endif
+ /* This function will return NULL if there is an --help
+ or --version argument in `args` */
f->se = fuse_lowlevel_new(args, &llop, sizeof(llop), f);
if (f->se == NULL) {
if (f->conf.help)
fprintf(stderr, "fuse: unknown option `%s'\n", arg);
}
+ /* Fail */
return -1;
}
}
default:
+ /* Pass through unknown options */
return 1;
}
}
mo->ishelp = 1;
break;
}
+
+ /* Pass through unknown options */
return 1;
}
mo->ishelp = 1;
break;
}
+
+ /* Pass through unknown options */
return 1;
}