void parse(fuse_args &args, Config &config) { const struct fuse_opt opts[] = { FUSE_OPT_KEY("-h",MERGERFS_OPT_HELP), FUSE_OPT_KEY("--help",MERGERFS_OPT_HELP), FUSE_OPT_KEY("-v",MERGERFS_OPT_VERSION), FUSE_OPT_KEY("-V",MERGERFS_OPT_VERSION), FUSE_OPT_KEY("--version",MERGERFS_OPT_VERSION), {NULL,-1U,0} }; fuse_opt_parse(&args, &config, opts, ::option_processor); set_fsname(args,config.srcmounts); set_subtype(args); }
return KEEP; } default: fprintf(stderr, "%s: only two arguments allowed: filename and mountpoint\n", PROGRAM); return ERROR; } } default: { return KEEP; } } } static const struct fuse_opt fusezip_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-r", KEY_RO), FUSE_OPT_KEY("ro", KEY_RO), FUSE_OPT_KEY("-p", KEY_USE_PASSWD), {NULL, 0, 0} }; int main(int argc, char *argv[]) { if (sizeof(void*) > sizeof(uint64_t)) { fprintf(stderr,"%s: This program cannot be run on your system because of FUSE design limitation\n", PROGRAM); return EXIT_FAILURE; } struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
.unlink = grasa_unlink, .open = grasa_open, .read = grasa_read, .truncate = grasa_truncate, .write = grasa_write, .utimens = grasa_utimens, }; enum { KEY_VERSION, KEY_HELP, }; static struct fuse_opt fuse_options[] = { // Estos son parametros por defecto que ya tiene FUSE FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_END, }; int main(int argc, char* argv[]) { char* filepath = argv[1]; //struct fuse_args args = FUSE_ARGS_INIT(argc, argv); obtener_tamanio_disco(filepath); obtener_bitmap_cant_bloques();
MYSQLFS_OPT_KEY( "osxspotlight", osxnospotlight, 0), MYSQLFS_OPT_KEY("noosxspotlight", osxnospotlight, 1), MYSQLFS_OPT_KEY("osxnospotlight", osxnospotlight, 1), MYSQLFS_OPT_KEY( "password=%s", passwd, 0), MYSQLFS_OPT_KEY("--password=%s", passwd, 0), MYSQLFS_OPT_KEY( "port=%d", port, 0), MYSQLFS_OPT_KEY("--port=%d", port, 0), MYSQLFS_OPT_KEY( "-P %d", port, 0), MYSQLFS_OPT_KEY( "socket=%s", socket, 0), MYSQLFS_OPT_KEY("--socket=%s", socket, 0), MYSQLFS_OPT_KEY( "-S %s", socket, 0), MYSQLFS_OPT_KEY( "user=%s", user, 0), MYSQLFS_OPT_KEY("--user=%s", user, 0), MYSQLFS_OPT_KEY( "-u %s", user, 0), FUSE_OPT_KEY("debug-dnq", KEY_DEBUG_DNQ), FUSE_OPT_KEY("-v", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_END }; static int mysqlfs_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs){ struct mysqlfs_opt *opt = (struct mysqlfs_opt *) data; switch (key) { case FUSE_OPT_KEY_OPT: /* dig through the list for matches */
struct arg_ctx { char *source_file = nullptr; char *target_file = nullptr; bool show_help = false; }; enum { KEY_HELP }; static fuse_opt fuse_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_END }; static void usage(FILE *stream, const char *progname) { fprintf(stream, "Usage: %s <sparse file> <target file> [options]\n" "\n" "general options:\n" " -o opt,[opt...] comma-separated list of mount options\n" " -h --help show this help message\n" "\n", progname); }
char *subtype_opt; char *mtab_opts; char *fusermount_opts; char *kernel_opts; }; #define FUSE_MOUNT_OPT(t, p) { t, offsetof(struct mount_opts, p), 1 } static const struct fuse_opt fuse_mount_opts[] = { FUSE_MOUNT_OPT("allow_other", allow_other), FUSE_MOUNT_OPT("allow_root", allow_root), FUSE_MOUNT_OPT("nonempty", nonempty), FUSE_MOUNT_OPT("blkdev", blkdev), FUSE_MOUNT_OPT("fsname=%s", fsname), FUSE_MOUNT_OPT("subtype=%s", subtype), FUSE_OPT_KEY("allow_other", KEY_KERN_OPT), FUSE_OPT_KEY("allow_root", KEY_ALLOW_ROOT), FUSE_OPT_KEY("nonempty", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("blkdev", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("fsname=", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("subtype=", KEY_SUBTYPE_OPT), FUSE_OPT_KEY("large_read", KEY_KERN_OPT), FUSE_OPT_KEY("blksize=", KEY_KERN_OPT), FUSE_OPT_KEY("default_permissions", KEY_KERN_OPT), FUSE_OPT_KEY("max_read=", KEY_KERN_OPT), FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_KEEP), FUSE_OPT_KEY("user="******"-r", KEY_RO), FUSE_OPT_KEY("ro", KEY_KERN_FLAG), FUSE_OPT_KEY("rw", KEY_KERN_FLAG), FUSE_OPT_KEY("suid", KEY_KERN_FLAG),
struct fuse_session *cuse_lowlevel_setup(int argc, char *argv[], const struct cuse_info *ci, const struct cuse_lowlevel_ops *clop, int *multithreaded, void *userdata) { const char *devname = "/dev/cuse"; static const struct fuse_opt kill_subtype_opts[] = { FUSE_OPT_KEY("subtype=", FUSE_OPT_KEY_DISCARD), FUSE_OPT_END }; struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_session *se; struct fuse_chan *ch; int fd; int foreground; int res; res = fuse_parse_cmdline(&args, NULL, multithreaded, &foreground); if (res == -1) goto err_args; res = fuse_opt_parse(&args, NULL, kill_subtype_opts, NULL); if (res == -1) goto err_args; /* * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos * would ensue. */ do { fd = open("/dev/null", O_RDWR); if (fd > 2) close(fd); } while (fd >= 0 && fd <= 2); se = cuse_lowlevel_new(&args, ci, clop, userdata); fuse_opt_free_args(&args); if (se == NULL) goto err_args; fd = open(devname, O_RDWR); if (fd == -1) { if (errno == ENODEV || errno == ENOENT) fprintf(stderr, "cuse: device not found, try 'modprobe cuse' first\n"); else fprintf(stderr, "cuse: failed to open %s: %s\n", devname, strerror(errno)); goto err_se; } ch = fuse_kern_chan_new(fd); if (!ch) { close(fd); goto err_se; } fuse_session_add_chan(se, ch); res = fuse_set_signal_handlers(se); if (res == -1) goto err_se; res = fuse_daemonize(foreground); if (res == -1) goto err_sig; return se; err_sig: fuse_remove_signal_handlers(se); err_se: fuse_session_destroy(se); err_args: fuse_opt_free_args(&args); return NULL; }
fuse_chan::~fuse_chan() { if (dokanDll) FreeLibrary(dokanDll); } /////////////////////////////////////////////////////////////////////////////////////// ////// This are just "emulators" of native FUSE api for the sake of compatibility /////////////////////////////////////////////////////////////////////////////////////// #define FUSE_LIB_OPT(t, p, v) { t, offsetof(struct fuse_config, p), v } enum { KEY_HELP }; 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_LIB_OPT("debug", debug, 1), FUSE_LIB_OPT("-d", debug, 1), FUSE_LIB_OPT("umask=%o", umask, 0), FUSE_LIB_OPT("fileumask=%o", fileumask, 0), FUSE_LIB_OPT("dirumask=%o", dirumask, 0), FUSE_LIB_OPT("fsname=%s", fsname, 0), FUSE_LIB_OPT("volname=%s", volname, 0), FUSE_LIB_OPT("setsignals=%s", setsignals, 0), FUSE_OPT_END }; static void fuse_lib_help(void)
KEY_HELP, KEY_VERSION, KEY_BIG_WRITES, KEY_NO_BIG_WRITES, KEY_ENABLED_FUSE, }; #define VMHGFS_OPT(t, p, v) { t, offsetof(struct vmhgfsConfig, p), v } const struct fuse_opt vmhgfsOpts[] = { #ifdef VMX86_DEVEL VMHGFS_OPT("--loglevel %i", logLevel, 4), VMHGFS_OPT("-l %i", logLevel, 4), #endif /* We will change the default value, unless it is specified explicitly. */ FUSE_OPT_KEY("big_writes", KEY_BIG_WRITES), FUSE_OPT_KEY("nobig_writes", KEY_NO_BIG_WRITES), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-e", KEY_ENABLED_FUSE), FUSE_OPT_KEY("--enabled", KEY_ENABLED_FUSE), FUSE_OPT_END }; /* *---------------------------------------------------------------------- *
usage(outargs->argv[0]); fuse_opt_add_arg(outargs, "-ho"); fuse_main(outargs->argc, outargs->argv, &ciopfs_operations, NULL); exit(0); case CIOPFS_OPT_VERSION: fprintf(stderr, "%s: "VERSION" fuse: %d\n", outargs->argv[0], fuse_version()); exit(0); default: fprintf(stderr, "see `%s -h' for usage\n", outargs->argv[0]); exit(1); } return 1; } static struct fuse_opt ciopfs_opts[] = { FUSE_OPT_KEY("-h", CIOPFS_OPT_HELP), FUSE_OPT_KEY("--help", CIOPFS_OPT_HELP), FUSE_OPT_KEY("--version", CIOPFS_OPT_VERSION), FUSE_OPT_END }; int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); fuse_opt_parse(&args, &dirname, ciopfs_opts, ciopfs_opt_parse); if (single_threaded) { fuse_opt_add_arg(&args, "-s"); log_print("disabling multithreaded mode for root mounted " "filesystem that is accessible for other users " "via the `-o allow_other' option\n");
.ftruncate = tarix_ftruncate, .utimens = tarix_utimens, }; static struct fuse_operations null_oper = { }; enum tarix_opt_keys { TARIX_KEY_ZLIB = 1, TARIX_KEY_HELP = 2, }; #define TARIX_OPT(t, p, v) { t, offsetof(struct tarixfs_t, p), v } static struct fuse_opt tarix_opts[] = { TARIX_OPT("tar=%s", tarfilename, 0), TARIX_OPT("tarix=%s", indexfilename, 0), FUSE_OPT_KEY("zlib", TARIX_KEY_ZLIB), FUSE_OPT_KEY("--help", TARIX_KEY_HELP), FUSE_OPT_KEY("-h", TARIX_KEY_HELP), FUSE_OPT_END }; int tarix_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { switch (key) { case FUSE_OPT_KEY_OPT: return 1; case FUSE_OPT_KEY_NONOPT: if (tarixfs.tarfilename == NULL) { tarixfs.tarfilename = strdup(arg); return 0; }
int debug; } options = { .point = NULL, .dev = NULL, .readonly = 0, .debug = 0, }; enum { KEY_VERSION, KEY_HELP, KEY_PORT, KEY_READONLY, KEY_DEBUG, }; static struct fuse_opt opts[] = { FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("--readonly", KEY_READONLY), FUSE_OPT_KEY("--debug", KEY_DEBUG), FUSE_OPT_END }; const char *usage = "\ usage: ehs5fs [fuse options] device mountpoint\n\ --version show software version inforamtion\n\ --readonly disable any writting operations\n\ --debug start in debug mode\n\ ";
break; } } // values for setting options enum { KEY_HELP, KEY_VERSION, KEY_PANEL, KEY_SPI }; static struct fuse_opt display_options[] = { FUSE_OPT_KEY("--panel=%s", KEY_PANEL), FUSE_OPT_KEY("panel=%s", KEY_PANEL), FUSE_OPT_KEY("--spi=%s", KEY_SPI), FUSE_OPT_KEY("spi=%s", KEY_SPI), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_END }; static int option_processor(void *data, const char *arg, int key, struct fuse_args *outargs) {
exit(0); case OPTK_READAHEAD: mo.readahead = 1; return(0); case OPTK_EXEC: opt_exec_files = 1; return(0); default: fprintf(stderr, "see `%s -h' for usage (arg=%s, key=%d)\n", outargs->argv[0], arg, key); exit(1); } return 1; } static struct fuse_opt rofs_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("--readahead", OPTK_READAHEAD), FUSE_OPT_KEY("readahead", OPTK_READAHEAD), FUSE_OPT_KEY("--execfiles", OPTK_EXEC), FUSE_OPT_KEY("execfiles", OPTK_EXEC), {"--metadata=%s", offsetof(MyOptions, metadata), -1}, {"metadata=%s", offsetof(MyOptions, metadata), -1}, {"--url=%s", offsetof(MyOptions, path), -1}, {"url=%s", offsetof(MyOptions, path), -1}, {"--chunks=%d", offsetof(MyOptions, chunks), -1}, {"chunks=%d", offsetof(MyOptions, chunks), -1}, {"--chunksise=%d", offsetof(MyOptions, chunksize), -1}, {"chunksise=%d", offsetof(MyOptions, chunksize), -1},
LOG_PRINT(loglevel, "hardlinks: %s\n", YESNO((discofs_options.fs_features & FEAT_HARDLINKS))); #if HAVE_SETXATTR LOG_PRINT(loglevel, "extended attributes: %s\n", YESNO((discofs_options.fs_features & FEAT_XATTR))); #endif } /*! macro to define simple options */ #define OPT_KEY(t, p, v) { t, offsetof(struct options, p), v } /*! @struct discofs_opts * options recognized. * anything else will be passed to FUSE */ static struct fuse_opt discofs_opts[] = { /* user or group ID to change to before mounting */ FUSE_OPT_KEY("uid=%s", DISCOFS_OPT_UID), FUSE_OPT_KEY("gid=%s", DISCOFS_OPT_GID), /* alternate directory for database and cache */ OPT_KEY("data=%s", data_root, 0), /* host to PING */ OPT_KEY("host=%s", host, 0), /* PID file to check */ OPT_KEY("pid=%s", pid_file, 0), /* interval to wait before scanning remote fs for changes */ OPT_KEY("scan=%u", scan_interval, 0), /* conflict resolution mode */
.forget = lo_forget, .getattr = lo_getattr, .readlink = lo_readlink, .opendir = lo_opendir, .readdir = lo_readdir, .readdirplus = lo_readdirplus, .releasedir = lo_releasedir, .open = lo_open, .release = lo_release, .read = lo_read, }; #define LO_OPT(t, p, v) { t, offsetof(struct lo_data, p), v } static const struct fuse_opt lo_opts[] = { FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP), FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP), LO_OPT("debug", debug, 1), LO_OPT("-d", debug, 1), FUSE_OPT_END }; int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_chan *ch; char *mountpoint; int ret = -1; struct lo_data lo = { .debug = 0 }; if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1)
}; enum { KEY_HELP, KEY_VERSION, KEY_DEVFILE, KEY_TRACKS, KEY_SEEKBUFFER, }; #define ZDSFS_OPT(t, p, v) { t, offsetof(struct zdsfs_info, p), v } static const struct fuse_opt zdsfs_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-v", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-l %s", KEY_DEVFILE), FUSE_OPT_KEY("tracks=", KEY_TRACKS), FUSE_OPT_KEY("seekbuffer=", KEY_SEEKBUFFER), ZDSFS_OPT("rdw", keepRDW, 1), ZDSFS_OPT("ignore_incomplete", allow_inclomplete_multi_volume, 1), FUSE_OPT_END }; static void usage(const char *progname) { fprintf(stderr,
/* Note that we open the image file when we're processing the command * line options; close it when we're shutting down. */ void hw3_destroy(void *context) { disk->ops->close(disk); } /* The other way to parse options is with a table like this. Again, * matching arguments are "stolen" from the list and not seen by * fuse_main. (not that it matters, as if --cmdline is passed then we * don't call fuse_main) */ static struct fuse_opt hw3_opts[] = { FUSE_OPT_KEY("--cmdline", KEY_CMDLINE), FUSE_OPT_END }; int main(int argc, char **argv) { /* Argument processing - see comments for hw3_opt_proc */ struct fuse_args args = FUSE_ARGS_INIT(argc, argv); if (fuse_opt_parse(&args, &hw3_data, hw3_opts, hw3_opt_proc) == -1) exit(1); hw3_ops.destroy = hw3_destroy; if (hw3_data.cmd_mode) { hw3_ops.init(NULL);
/*! \brief Keeps zlomekFS command line configuration */ struct zfs_opts { /*! Path to local configuration file. */ char *config; /* Command line forced loglevel */ int loglevel; }; #define ZFS_OPT(t, p, v) { t, offsetof (struct zfs_opts, p), v } static const struct fuse_opt main_options[] = { ZFS_OPT("config=%s", config, 0), ZFS_OPT("loglevel=%u", loglevel, DEFAULT_LOG_LEVEL), FUSE_OPT_KEY("--help", OPTION_HELP), FUSE_OPT_KEY("--version", OPTION_VERSION), FUSE_OPT_END }; /* *! Process command line arguments. */ static int handle_one_argument(ATTRIBUTE_UNUSED void *data, const char *arg, int key, ATTRIBUTE_UNUSED struct fuse_args *outargs) { if (is_logger_arg(arg) == TRUE) return 0; switch (key)
#include "fuse_opt.h" #include "fuse_private.h" #include "debug.h" static struct fuse_session *sigse; static struct fuse_context *ictx = NULL; enum { KEY_HELP, KEY_HELP_WITHOUT_HEADER, KEY_VERSION, KEY_DEBUG }; static struct fuse_opt fuse_core_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-ho", KEY_HELP_WITHOUT_HEADER), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("debug", KEY_DEBUG), FUSE_OPT_KEY("-d", KEY_DEBUG), FUSE_OPT_KEY("-f", KEY_DEBUG), FUSE_OPT_KEY("-s", KEY_DEBUG), FUSE_OPT_END }; int fuse_loop(struct fuse *fuse) { struct fusebuf fbuf;
.exchange = subdir_exchange, .getxtimes = subdir_getxtimes, .setbkuptime = subdir_setbkuptime, .setchgtime = subdir_setchgtime, .setcrtime = subdir_setcrtime, .chflags = subdir_chflags, .setattr_x = subdir_setattr_x, .fsetattr_x = subdir_fsetattr_x, #endif .flag_nullpath_ok = 1, .flag_nopath = 1, }; static struct fuse_opt subdir_opts[] = { FUSE_OPT_KEY("-h", 0), FUSE_OPT_KEY("--help", 0), { "subdir=%s", offsetof(struct subdir, base), 0 }, { "rellinks", offsetof(struct subdir, rellinks), 1 }, { "norellinks", offsetof(struct subdir, rellinks), 0 }, FUSE_OPT_END }; static void subdir_help(void) { fprintf(stderr, " -o subdir=DIR prepend this directory to all paths (mandatory)\n" " -o [no]rellinks transform absolute symlinks to relative\n"); } static int subdir_opt_proc(void *data, const char *arg, int key,
PASCAL_OPT_WRITE, PASCAL_OPT_FORMAT, PASCAL_OPT_VERBOSE }; struct options { char *format; int readOnly; int readWrite; int verbose; } options; #define PASCAL_OPT_KEY(T, P, V) {T, offsetof(struct options, P), V} static struct fuse_opt pascal_options[] = { FUSE_OPT_KEY("-h", PASCAL_OPT_HELP), FUSE_OPT_KEY("--help", PASCAL_OPT_HELP), FUSE_OPT_KEY("-V", PASCAL_OPT_VERSION), FUSE_OPT_KEY("--version", PASCAL_OPT_VERSION), PASCAL_OPT_KEY("-v", verbose, 1), PASCAL_OPT_KEY("-w", readWrite, 1), PASCAL_OPT_KEY("rw", readWrite, 1), PASCAL_OPT_KEY("--format=%s", format, 0), PASCAL_OPT_KEY("format=%s", format, 0), {0, 0, 0} };
static struct fuse_opt stormfs_opts[] = { STORMFS_OPT("acl=%s", acl, 0), STORMFS_OPT("config=%s", config, 0), STORMFS_OPT("url=%s", url, 0), STORMFS_OPT("encryption", encryption, 1), STORMFS_OPT("expires=%s", expires, 0), STORMFS_OPT("use_ssl", ssl, true), STORMFS_OPT("no_verify_ssl", verify_ssl, 0), STORMFS_OPT("use_rrs", rrs, true), STORMFS_OPT("nocache", cache, 0), STORMFS_OPT("stormfs_debug", debug, true), STORMFS_OPT("mime_path=%s", mime_path, 0), STORMFS_OPT("cache_path=%s", cache_path, 0), STORMFS_OPT("cache_timeout=%u", cache_timeout, 0), FUSE_OPT_KEY("-d", KEY_FOREGROUND), FUSE_OPT_KEY("--debug", KEY_FOREGROUND), FUSE_OPT_KEY("-f", KEY_FOREGROUND), FUSE_OPT_KEY("--foreground", KEY_FOREGROUND), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_END }; static int valid_path(const char *path) { char *p = NULL; char *tmp = strdup(path);
#include "unionfs.h" #include "opts.h" #include "stats.h" #include "debug.h" #include "findbranch.h" #include "general.h" #include "unlink.h" #include "rmdir.h" #include "readdir.h" #include "cow.h" #include "string.h" #include "usyslog.h" static struct fuse_opt unionfs_opts[] = { FUSE_OPT_KEY("chroot=%s,", KEY_CHROOT), FUSE_OPT_KEY("cow", KEY_COW), FUSE_OPT_KEY("-d", KEY_DEBUG), FUSE_OPT_KEY("debug_file=%s", KEY_DEBUG_FILE), FUSE_OPT_KEY("dirs=%s", KEY_DIRS), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("hide_meta_dir", KEY_HIDE_METADIR), FUSE_OPT_KEY("hide_meta_files", KEY_HIDE_META_FILES), FUSE_OPT_KEY("max_files=%s", KEY_MAX_FILES), FUSE_OPT_KEY("noinitgroups", KEY_NOINITGROUPS), FUSE_OPT_KEY("relaxed_permissions", KEY_RELAXED_PERMISSIONS), FUSE_OPT_KEY("statfs_omit_ro", KEY_STATFS_OMIT_RO), FUSE_OPT_KEY("stats", KEY_STATS), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-V", KEY_VERSION),
size_t block_size; /* block size to use to store data in BYTEA fields */ } PgFuseOptions; #define PGFUSE_OPT( t, p, v ) { t, offsetof( PgFuseOptions, p ), v } enum { KEY_HELP, KEY_VERBOSE, KEY_VERSION }; static struct fuse_opt pgfuse_opts[] = { PGFUSE_OPT( "ro", read_only, 1 ), PGFUSE_OPT( "noatime", noatime, 1 ), PGFUSE_OPT( "blocksize=%d", block_size, DEFAULT_BLOCK_SIZE ), FUSE_OPT_KEY( "-h", KEY_HELP ), FUSE_OPT_KEY( "--help", KEY_HELP ), FUSE_OPT_KEY( "-v", KEY_VERBOSE ), FUSE_OPT_KEY( "--verbose", KEY_VERBOSE ), FUSE_OPT_KEY( "-V", KEY_VERSION ), FUSE_OPT_KEY( "--version", KEY_VERSION ), FUSE_OPT_END }; static int pgfuse_opt_proc( void* data, const char* arg, int key, struct fuse_args* outargs ) { PgFuseOptions *pgfuse = (PgFuseOptions *)data; switch( key ) { case FUSE_OPT_KEY_OPT:
KEY_META, KEY_HOST, KEY_PORT, KEY_BIND, KEY_PROXY, KEY_PATH, KEY_PASSWORDASK, KEY_NOSTDMOUNTOPTIONS, KEY_HELP, KEY_VERSION, }; #define MFS_OPT(t, p, v) { t, offsetof(struct mfsopts, p), v } static struct fuse_opt mfs_opts_stage1[] = { FUSE_OPT_KEY("mfscfgfile=", KEY_CFGFILE), FUSE_OPT_KEY("-c ", KEY_CFGFILE), FUSE_OPT_END }; static struct fuse_opt mfs_opts_stage2[] = { MFS_OPT("mfsmaster=%s", masterhost, 0), MFS_OPT("mfsport=%s", masterport, 0), MFS_OPT("mfsbind=%s", bindhost, 0), MFS_OPT("mfsproxy=%s", proxyhost, 0), MFS_OPT("mfssubfolder=%s", subfolder, 0), MFS_OPT("mfspassword=%s", password, 0), MFS_OPT("mfsmd5pass=%s", md5pass, 0), MFS_OPT("mfspreflabels=%s", preferedlabels, 0), MFS_OPT("mfsrlimitnofile=%u", nofile, 0), MFS_OPT("mfsnice=%d", nice, 0),
#include "debug.h" static struct fuse_session *sigse; static struct fuse_context *ictx = NULL; static int max_read = FUSEBUFMAXSIZE; enum { KEY_HELP, KEY_HELP_WITHOUT_HEADER, KEY_VERSION, KEY_MAXREAD, KEY_STUB }; static struct fuse_opt fuse_core_opts[] = { FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-ho", KEY_HELP_WITHOUT_HEADER), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("max_read=", KEY_MAXREAD), FUSE_OPT_KEY("debug", KEY_STUB), FUSE_OPT_KEY("-d", KEY_STUB), FUSE_OPT_KEY("-f", KEY_STUB), FUSE_OPT_KEY("-s", KEY_STUB), FUSE_OPT_KEY("use_ino", KEY_STUB), FUSE_OPT_KEY("big_writes", KEY_STUB), FUSE_OPT_KEY("default_permissions", KEY_STUB), FUSE_OPT_KEY("fsname=", KEY_STUB), FUSE_OPT_END };
IQUEST_FUSE_OPT("--indicator=%s", indicator, 0), IQUEST_FUSE_OPT("indicator=%s", indicator, 0), IQUEST_FUSE_OPT("-r %s", slash_remap, 0), IQUEST_FUSE_OPT("--remap-slash-char=%s", slash_remap, 0), IQUEST_FUSE_OPT("remap-slash-char=%s", slash_remap, 0), IQUEST_FUSE_OPT("--require-conn", require_conn, 1), IQUEST_FUSE_OPT("require-conn", require_conn, 1), IQUEST_FUSE_OPT("--no-require-conn", require_conn, 0), IQUEST_FUSE_OPT("no-require-conn", require_conn, 0), IQUEST_FUSE_OPT("--show-indicator", show_indicator, 1), IQUEST_FUSE_OPT("show-indicator", show_indicator, 1), FUSE_OPT_KEY("--debug", IQUEST_FUSE_CONF_KEY_DEBUG_ME), /* the --debug option is only recongnised by iquestFuse, not FUSE itself */ FUSE_OPT_KEY("--debug-trace", IQUEST_FUSE_CONF_KEY_TRACE_ME), FUSE_OPT_KEY("-V", IQUEST_FUSE_CONF_KEY_VERSION), FUSE_OPT_KEY("--version", IQUEST_FUSE_CONF_KEY_VERSION), FUSE_OPT_KEY("-h", IQUEST_FUSE_CONF_KEY_HELP), FUSE_OPT_KEY("--help", IQUEST_FUSE_CONF_KEY_HELP), FUSE_OPT_KEY("-d", IQUEST_FUSE_CONF_KEY_DEBUG_ALL), FUSE_OPT_KEY("debug", IQUEST_FUSE_CONF_KEY_DEBUG_ALL), FUSE_OPT_KEY("-f", IQUEST_FUSE_CONF_KEY_FOREGROUND), FUSE_OPT_KEY("-s", IQUEST_FUSE_CONF_KEY_SINGLETHREAD),
int foreground; int nodefault_subtype; char *mountpoint; }; #define FUSE_HELPER_OPT(t, p) { t, offsetof(struct helper_opts, p), 1 } static const struct fuse_opt fuse_helper_opts[] = { FUSE_HELPER_OPT("-d", foreground), FUSE_HELPER_OPT("debug", foreground), FUSE_HELPER_OPT("-f", foreground), FUSE_HELPER_OPT("-s", singlethread), FUSE_HELPER_OPT("fsname=", nodefault_subtype), FUSE_HELPER_OPT("subtype=", nodefault_subtype), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), 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("subtype=", FUSE_OPT_KEY_KEEP), FUSE_OPT_END }; static void usage(const char *progname) { fprintf(stderr, "usage: %s mountpoint [options]\n\n", progname);
.write = fs_write, .statfs = fs_statfs, .fsync = fs_fsync, .ftruncate = fs_ftruncate, .fgetattr = fs_fgetattr, .utimens = fs_utimens, }; enum { KEY_VERSION, KEY_HELP, KEY_TEST_OPS, }; static struct fuse_opt fs_opts[] = { FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("-ho", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("--test-ops", KEY_TEST_OPS), FUSE_OPT_END, }; // -------------------------------------------------------------- // Primitive file system operations test // -------------------------------------------------------------- static char *msg = "This is a rather uninteresting message.\n\n"; void