int main(int argc, char **argv) { struct fuse_args args = FUSE_ARGS_INIT(0, NULL); const char *imgname = NULL, *mntpoint = NULL; char fsname_buf[17 + PATH_MAX]; int r, fd; fuse_opt_add_arg(&args, argv[0]); if (argc < 2) panic("missing image or mountpoint parameter, see help"); for (r = 1; r < argc; r++) { if (imgname == NULL && argv[r][0] != '-' && strcmp(argv[r - 1], "-o") != 0) { imgname = argv[r]; } else if(mntpoint == NULL && argv[r][0] != '-' && strcmp(argv[r - 1], "-o") != 0) { mntpoint = argv[r]; fuse_opt_add_arg(&args, argv[r]); } else { fuse_opt_add_arg(&args, argv[r]); } } // Use a fsname (which shows up in df) in the style of sshfs, another // FUSE-based file system, with format "fsname#fslocation". snprintf(fsname_buf, sizeof(fsname_buf), "-ofsname=CS202fs#%s", imgname); fuse_opt_add_arg(&args, "-s"); // Always run single-threaded. fuse_opt_add_arg(&args, "-odefault_permissions"); // Kernel handles access. fuse_opt_add_arg(&args, fsname_buf); // Set the filesystem name. if (imgname == NULL) { fuse_opt_parse(&args, NULL, fs_opts, fs_parse_opt); return -1; } else { struct inode *dirroot; map_disk_image(imgname, mntpoint); // Make sure the superblock fields are sane. assert(super->s_magic == FS_MAGIC); assert(super->s_root != 0); // Guarantee that the root directory has proper permissions. // This is vital so that we can unmount the disk. dirroot = diskaddr(super->s_root); dirroot->i_mode = S_IFDIR | 0777; fuse_opt_parse(&args, NULL, fs_opts, fs_parse_opt); return fuse_main(args.argc, args.argv, &fs_oper, NULL); } }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); int res; struct rrafs_data *data = rrafs_get_rrafs_data(); data->mounter_uid = getuid(); data->mounter_gid = getgid(); if (fuse_opt_parse(&args, data, rrafs_opts, NULL) == -1) { rra_warning("Error parsing arguments"); exit(1); } if (data->regdir == NULL) { rra_warning("Didn't get regdir"); exit(1); } data->state = rra_cli_state_new_from_win_dir(data->regdir); res = fuse_main(args.argc, args.argv, rrafs_get_operations(), NULL); if (rra_cli_state_free(data->state)) { return 0; } else { return 1; } }
int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground) { int res; struct helper_opts hopts; memset(&hopts, 0, sizeof(hopts)); res = fuse_opt_parse(args, &hopts, fuse_helper_opts, fuse_helper_opt_proc); if (res == -1) return -1; if (!hopts.nodefault_subtype) { res = add_default_subtype(args->argv[0], args); if (res == -1) goto err; } if (mountpoint) *mountpoint = hopts.mountpoint; else free(hopts.mountpoint); if (multithreaded) *multithreaded = !hopts.singlethread; if (foreground) *foreground = hopts.foreground; return 0; err: free(hopts.mountpoint); return -1; }
int main (int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT (argc, argv); int res; res = fuse_opt_parse (&args, &basefd, rofs_opts, rofs_parse_opt); if (res != 0) { fprintf (stderr, "Invalid arguments\n"); fprintf (stderr, "see `%s -h' for usage\n", argv[0]); exit (EXIT_FAILURE); } if (basefd == -1) { fprintf (stderr, "Missing basepath\n"); fprintf (stderr, "see `%s -h' for usage\n", argv[0]); exit (EXIT_FAILURE); } created_devino_hash = g_hash_table_new_full (devino_hash, devino_equal, g_free, NULL); fuse_main (args.argc, args.argv, &callback_oper, NULL); return 0; }
int main(int argc, char **argv) { int ret; struct nsp_ctx *ctx = malloc(sizeof(*ctx)); struct fuse_args args = FUSE_ARGS_INIT(argc, argv); if (!ctx) ERR_EXIT("Out of memory\n", -ENOMEM); if ((ret = nspire_init(&ctx->handle))) ERR_EXIT(nspire_strerror(ret), std_libnspire_err(ret)); atomic_init(&ctx->lock); ctx->allow_bigfile = 0; ctx->thresh_bigfile = 512 * 1024; fuse_opt_parse(&args, ctx, nsp_opts, NULL); if (ctx->allow_bigfile) { fprintf(stderr, "Warning: Allowing files larger than %d bytes to be " "opened. Large files may hang filesystem operations.\n", ctx->thresh_bigfile); } ret = fuse_main(args.argc, args.argv, &nspire_fs, ctx); nspire_free(ctx->handle); free(ctx); return ret; }
int main(int argc, char **argv) { open_log(); char *d = xmalloc(100); time_t t = time(NULL); struct tm *tmp = localtime(&t); strftime(d, 99, "%c", tmp); log_msg("BEGIN LOG rs-mount %s", d); free(d); struct fuse_args args = FUSE_ARGS_INIT(argc, argv); memset(&RS_CONFIG, 0, sizeof(struct rs_config)); fuse_opt_parse(&args, &RS_CONFIG, rs_opts, NULL); REQUIRE_OPTION(base_url); REQUIRE_OPTION(token); RS_CONFIG.base_url_len = strlen(RS_CONFIG.base_url); RS_CONFIG.auth_header = xmalloc(strlen(RS_CONFIG.token) + 23); sprintf(RS_CONFIG.auth_header, "Authorization: Bearer %s", RS_CONFIG.token); curl_global_init(CURL_GLOBAL_ALL); init_remote(); atexit(cleanup); return fuse_main(args.argc, args.argv, &rs_ops, NULL); }
int main(int argc, char **argv) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct cusexmp_param param = { 0, 0, NULL, 0 }; char dev_name[128] = "DEVNAME="; const char *dev_info_argv[] = { dev_name }; struct cuse_info ci; if (fuse_opt_parse(&args, ¶m, cusexmp_opts, cusexmp_process_arg)) { printf("failed to parse option\n"); return 1; } if (!param.is_help) { if (!param.dev_name) { fprintf(stderr, "Error: device name missing\n"); return 1; } strncat(dev_name, param.dev_name, sizeof(dev_name) - 9); } memset(&ci, 0, sizeof(ci)); ci.dev_major = param.major; ci.dev_minor = param.minor; ci.dev_info_argc = 1; ci.dev_info_argv = dev_info_argv; ci.flags = CUSE_UNRESTRICTED_IOCTL; return cuse_lowlevel_main(args.argc, args.argv, &ci, &cusexmp_clop, NULL); }
int main (int argc, char *argv[]) { int ret; struct fuse_args args = FUSE_ARGS_INIT(argc, argv); memset(&options, 0, sizeof(struct options)); if (fuse_opt_parse(&args, &options, pifs_opts, NULL) == -1) { return -1; } if (!options.mdd) { fprintf(stderr, "%s: Metadata directory must be specified with -o mdd=<directory>\n", argv[0]); return -1; } if (access(options.mdd, R_OK | W_OK | X_OK) == -1) { fprintf(stderr, "%s: Cannot access metadata directory '%s': %s\n", argv[0], options.mdd, strerror(errno)); return -1; } ret = fuse_main(args.argc, args.argv, &pifs_ops, NULL); fuse_opt_free_args(&args); return ret; }
int main(int argc, char** argv) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); char* mountpoint; int multithreaded; int foreground; if (fuse_opt_parse(&args, NULL, tfs_opts, tfs_opt_proc) == -1) return 1; if (fuse_parse_cmdline(&args, &mountpoint, &multithreaded, &foreground) == -1) return 1; struct fuse_chan *ch = fuse_mount(mountpoint, &args); if (!ch) return 1; struct fuse *fuse = fuse_new(ch, &args, &tfs_oper, sizeof(struct fuse_operations), NULL); if (!fuse) { fuse_unmount(mountpoint, ch); return 1; } if (options.debug == 1 || foreground == 1) { if (fuse_daemonize(foreground) != -1) return 1; } if (fuse_set_signal_handlers(fuse_get_session(fuse)) == -1) { fuse_unmount(mountpoint, ch); fuse_destroy(fuse); return 1; } initMultiCastListener(); if (multithreaded) return fuse_loop_mt(fuse); if (!options.debug) fprintf(stderr, "Running single threaded and we are not debugging, your performance may suffer.\n"); return fuse_loop(fuse); };
/* * main */ int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); fuse_opt_parse(&args, &opt, NULL, memcachefs_opt_proc); if(!opt.host){ usage(); return EXIT_SUCCESS; } pool = handle_pool_new(&opt); if(!pool){ perror("malloc()"); return EXIT_FAILURE; } if(opt.verbose){ fprintf(stderr, "mounting to %s:%s\n", opt.host, opt.port); } fuse_main(args.argc, args.argv, &memcachefs_oper); fuse_opt_free_args(&args); handle_pool_free(pool); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); int res; res = fuse_opt_parse(&args, &rw_path, rofs_opts, rofs_parse_opt); if (res != 0) { fprintf(stderr, "Invalid arguments\n"); fprintf(stderr, "see `%s -h' for usage\n", argv[0]); exit(1); } if (rw_path == 0) { fprintf(stderr, "Missing readwritepath\n"); fprintf(stderr, "see `%s -h' for usage\n", argv[0]); exit(1); } #if FUSE_VERSION >= 26 fuse_main(args.argc, args.argv, &callback_oper, NULL); #else fuse_main(args.argc, args.argv, &callback_oper); #endif return 0; }
int main(int argc, char *argv[]) { int result; struct fuse_args args = FUSE_ARGS_INIT(argc, argv); memset(&stormfs, 0, sizeof(struct stormfs)); stormfs.progname = argv[0]; stormfs.service = AMAZON; set_defaults(); if(fuse_opt_parse(&args, &stormfs, stormfs_opts, stormfs_opt_proc) == -1) { fprintf(stderr, "%s: error parsing command-line options\n", stormfs.progname); exit(EXIT_FAILURE); } parse_config(stormfs.config); validate_config(); if(stormfs.rrs) stormfs.storage_class = "REDUCED_REDUNDANCY"; stormfs.virtual_url = stormfs_virtual_url(stormfs.url, stormfs.bucket); g_thread_init(NULL); result = stormfs_fuse_main(&args); fuse_opt_free_args(&args); return result; }
int main(int argc, char *argv[]) { int ret; //create the log creatlogfile(); servlog(INFO, "%s", "fsys start"); struct fuse_args args = FUSE_ARGS_INIT(argc, argv); if (fuse_opt_parse(&args, ¶ms, fsys_opts, fsys_opt_proc)) { fprintf(stderr, "Error parsing options.\n\n"); usage(argv[0]); return 1; } if (!params.basepath) { fprintf(stderr, "No valid flacdir specified.\n\n"); usage(argv[0]); return 1; } if (params.basepath[0] != '/') { fprintf(stderr, "flacdir must be an absolute path.\n\n"); usage(argv[0]); return 1; } struct stat st; if (stat(params.basepath, &st) != 0 || !S_ISDIR(st.st_mode)) { fprintf(stderr, "flacdir is not a valid directory: %s\n", params.basepath); fprintf(stderr, "Hint: Did you specify bitrate using the old " "syntax instead of the new -b?\n\n"); usage(argv[0]); return 1; } /* Log to the screen if debug is enabled. */ openlog("fsys", params.debug ? LOG_PERROR : 0, LOG_USER); servlog(INFO, "FSYS options:basepath->%s", params.basepath); // start FUSE umask(0); ret = fuse_main(args.argc, args.argv, &fsys_ops, NULL); fuse_opt_free_args(&args); servlog(INFO, "%s", "fsys have quited out"); closelog(); return ret; }
int main(int argc, char *argv[]) { memset(&cmdopt, 0, sizeof(cmdopt)); struct fuse_args args = FUSE_ARGS_INIT(argc, argv); fuse_opt_parse(&args, &cmdopt, mtnfs_opts, mtnfs_opt_parse); fuse_opt_add_arg(&args, "-oallow_other"); fuse_opt_add_arg(&args, "-odefault_permissions"); return(fuse_main(args.argc, args.argv, &mtn_oper, NULL)); }
/* ----------------------------------------------------- */ int main(int argc,char* argv[]) { signal(SIGINT, fs_sigint_handler); fs_set_limit_attr(); if (mpinit(0, 50)) return -1; voolefs.tc = 10; voolefs.tpool = threadpool_init(voolefs.tc ,10); voolefs.cinc = 8; voolefs.phost = mpcalloc(sizeof(struct host)); voolefs.phost->host = inet_addr("123.125.149.11"); voolefs.phost->port = htons(4869); voolefs.hostc = 1; voolefs.semc = 20; char* pmpoint = fs_create_mountpoint(); struct fuse_args args = FUSE_ARGS_INIT(argc, argv); char *fsname =(char*)mpcalloc(256); sprintf(fsname,"-osubtype=%s,fsname=%s",argv[0],pmpoint); mpfree(pmpoint); int ret = fuse_opt_parse(&args, NULL,NULL,NULL /*&voolefs, voolefs_opts, fs_opt_proc*/); int multithreaded = 0; int foreground = 0; ret = fuse_opt_insert_arg(&args,1,fsname); /* if (fuse_is_lib_option("ac_attr_timeout=")) fuse_opt_insert_arg(&args, 1, "-oauto_cache,ac_attr_timeout=0"); */ ret = fuse_parse_cmdline(&args, &voolefs.mountpoint, &multithreaded, &foreground); voolefs.ch = fuse_mount(voolefs.mountpoint, &args); // event_reinit(voolefs.ev_base); if(voolefs.ch) { ret = fcntl(fuse_chan_fd(voolefs.ch), F_SETFD, FD_CLOEXEC); voolefs.fuse = fuse_new(voolefs.ch,&args,&oper,sizeof(struct fuse_operations),NULL); if (voolefs.fuse == NULL) { fs_cleanup(); abort(); } fs_daemonize(0); voole_net_create(); /* if( multithreaded) ret = fuse_loop_mt(voolefs.fuse); else */ ret = fuse_loop(voolefs.fuse); } if( voolefs.fuse ) fuse_remove_signal_handlers(fuse_get_session(voolefs.fuse)); mpfree(fsname); if( voolefs.peventbase ) { event_base_free(voolefs.peventbase); voolefs.peventbase = NULL; } return ret; }
int main(int argc, char *argv[]) { fuse_args args = FUSE_ARGS_INIT(argc, argv); arg_ctx arg_ctx; if (fuse_opt_parse(&args, &arg_ctx, fuse_opts, fuse_opt_proc) == -1) { return EXIT_FAILURE; } int fd = -1; if (!arg_ctx.show_help) { if (!arg_ctx.source_file) { fprintf(stderr, "Missing source file\n"); return EXIT_FAILURE; } if (!arg_ctx.target_file) { fprintf(stderr, "Missing target file (mount point) parameter\n"); return EXIT_FAILURE; } fd = open(arg_ctx.source_file, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: Failed to open: %s\n", arg_ctx.source_file, strerror(errno)); return EXIT_FAILURE; } snprintf(source_fd_path, sizeof(source_fd_path), "/proc/self/fd/%d", fd); if (get_sparse_file_size() < 0) { close(fd); return EXIT_FAILURE; } } fuse_operations fuse_oper; memset(&fuse_oper, 0, sizeof(fuse_oper)); fuse_oper.getattr = fuse_getattr; fuse_oper.open = fuse_open; fuse_oper.read = fuse_read; fuse_oper.release = fuse_release; int fuse_ret = fuse_main(args.argc, args.argv, &fuse_oper, nullptr); if (!arg_ctx.show_help) { close(fd); } fuse_opt_free_args(&args); free(arg_ctx.source_file); free(arg_ctx.target_file); return fuse_ret; }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); init_syslog(); uopt_init(); if (fuse_opt_parse(&args, NULL, unionfs_opts, unionfs_opt_proc) == -1) RETURN(1); if (uopt.debug) debug_init(); if (!uopt.doexit) { if (uopt.nbranches == 0) { printf("You need to specify at least one branch!\n"); RETURN(1); } if (uopt.stats_enabled) stats_init(&stats); } // enable fuse permission checks, we need to set this, even we we are // not root, since we don't have our own access() function int uid = getuid(); int gid = getgid(); bool default_permissions = true; if (uid != 0 && gid != 0 && uopt.relaxed_permissions) { default_permissions = false; } else if (uopt.relaxed_permissions) { // protec the user of a very critical security issue fprintf(stderr, "Relaxed permissions disallowed for root!\n"); exit(1); } if (default_permissions) { if (fuse_opt_add_arg(&args, "-odefault_permissions")) { fprintf(stderr, "Severe failure, can't enable permssion checks, aborting!\n"); exit(1); } } unionfs_post_opts(); #ifdef FUSE_CAP_BIG_WRITES /* libfuse > 0.8 supports large IO, also for reads, to increase performance * We support any IO sizes, so lets enable that option */ if (fuse_opt_add_arg(&args, "-obig_writes")) { fprintf(stderr, "Failed to enable big writes!\n"); exit(1); } #endif umask(0); int res = fuse_main(args.argc, args.argv, &unionfs_oper, NULL); RETURN(uopt.doexit ? uopt.retval : res); }
int main (int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT (argc, argv); g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR); if (fuse_opt_parse (&args, NULL, NULL, opt_process) == -1) g_critical ("usage: %s <query> <mount point>", argv[0]); return fuse_main (args.argc, args.argv, &beagle_file_ops); }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); memset(current_buffer, 0, sizeof(current_buffer)); memset(display_buffer, 0, sizeof(display_buffer)); fuse_opt_parse(&args, NULL, display_options, option_processor); // run fuse return fuse_main(args.argc, args.argv, &display_operations, NULL); }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); if (fuse_opt_parse(&args, &rbd_options, rbdfs_opts, rbdfs_opt_proc) == -1) { exit(1); } pthread_mutex_init(&readdir_lock, NULL); return fuse_main(args.argc, args.argv, &rbdfs_oper, NULL); }
/* * always call fuse_lowlevel_new_common() internally, to work around a * misfeature in the FreeBSD runtime linker, which links the old * version of a symbol to internal references. */ struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args, const struct fuse_lowlevel_ops *op, size_t op_size, void *userdata) { struct fuse_ll *f; struct fuse_session *se; struct fuse_session_ops sop = { .process = fuse_ll_process, .destroy = fuse_ll_destroy, }; if (sizeof(struct fuse_lowlevel_ops) < op_size) { fprintf(stderr, "fuse: warning: library too old, some operations may not work\n"); op_size = sizeof(struct fuse_lowlevel_ops); } f = (struct fuse_ll *) calloc(1, sizeof(struct fuse_ll)); if (f == NULL) { fprintf(stderr, "fuse: failed to allocate fuse object\n"); goto out; } f->conn.async_read = 1; f->conn.max_write = UINT_MAX; f->conn.max_readahead = UINT_MAX; f->atomic_o_trunc = 0; list_init_req(&f->list); list_init_req(&f->interrupts); fuse_mutex_init(&f->lock); if (fuse_opt_parse(args, f, fuse_ll_opts, fuse_ll_opt_proc) == -1) goto out_free; if (f->debug) fprintf(stderr, "FUSE library version: %s\n", PACKAGE_VERSION); memcpy(&f->op, op, op_size); f->owner = getuid(); f->userdata = userdata; se = fuse_session_new(&sop, f); if (!se) goto out_free; return se; out_free: free(f); out: return NULL; }
int main (int argc, char **argv) { int ret; struct fuse_args args = FUSE_ARGS_INIT (argc, argv); get_mount_point (argc, argv); memset (&options, 0, sizeof (struct options)); if (-1 == fuse_opt_parse (&args, &options, arsenal_opts, NULL)) return -1; ret = fuse_main (args.argc, args.argv, &arsenal_oper, NULL); fuse_opt_free_args (&args); return ret; }
int main(int argc, char* argv[]) { umask(0); struct fuse_args args = FUSE_ARGS_INIT(argc, argv); fuse_opt_parse(&args, NULL, NULL, &diskfile_opt_proc); // Need at least a if (diskfile_entries_count < 2) usage(&args); // put the mountpoint back fuse_opt_add_arg(&args, diskfile_entries[--diskfile_entries_count].source); return fuse_main(args.argc, args.argv, &diskfile_operations, NULL); }
int main(int argc, char *argv[]) { int ret; struct fuse_args args = FUSE_ARGS_INIT(argc, argv); fuse_opt_parse(&args, NULL, NULL, darfs_opt_proc); ret = fuse_main(args.argc, args.argv, &hello_oper, NULL); /** free arguments */ fuse_opt_free_args(&args); return ret; }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); uid = getuid(); gid = getgid(); now = time(NULL); opts.host = "localhost"; opts.port = CC_XSTREAM_DEFAULT_PORT; opts.user = "******"; opts.pass = ""; opts.root = ""; if(fuse_opt_parse(&args, &opts, ccx_opts, ccx_opt_proc) == -1) { exit(1); } /* normalize to non-abs */ if(opts.root[0] == '/') { opts.root++; } /* not multithreaded */ fuse_opt_add_arg(&args, "-s"); /* 0x20000 (131072) hardcoded max ccx packet size (ccxclient.c) * set max read to max ccx packet - 100 (headers) */ fuse_opt_add_arg(&args, "-omax_readahead=130972"); if(cc_xstream_client_connect(opts.host, opts.port, &ccxconn) != CC_XSTREAM_CLIENT_OK) { fprintf(stderr, "Can't connect to host %s:%d.\n", opts.host, opts.port); exit(1); } if (cc_xstream_client_version_handshake(ccxconn) != CC_XSTREAM_CLIENT_OK) { fprintf(stderr, "Version handshake failed.\n"); exit(1); } if(cc_xstream_client_password_authenticate(ccxconn, opts.user, opts.pass) != CC_XSTREAM_CLIENT_OK) { fprintf(stderr, "Auth failed.\n"); exit(1); } return fuse_main(args.argc, args.argv, &ccx_oper, NULL); }
int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); opts.config = "pipefs.conf"; if(fuse_opt_parse(&args, &opts, pipefs_opts, pipefs_opt_proc) == -1) { exit(1); } pipefs_read_config(); return fuse_main(args.argc, args.argv, &pipefs_oper, NULL); }
void parse(struct fuse_args &args, config::Config &config) { fuse_opt_parse(&args, &config, NULL, ::option_processor); set_fsname(args,config); config.updateReadStr(); }
/** * main */ int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct mysqlfs_opt opt = { .init_conns = 1, .max_idling_conns = 5, .mycnf_group = "mysqlfs", #ifdef DEBUG .logfile = "mysqlfs.log", #endif }; log_file = stderr; /** theopts kludge is used for both statusdir (if configured at build) and for osxnospotlight */ theopts = &opt; fuse_opt_parse(&args, &opt, mysqlfs_opts, mysqlfs_opt_proc); if (pool_init(&opt) < 0) { log_printf(LOG_ERROR, "Error: pool_init() failed\n"); fuse_opt_free_args(&args); return EXIT_FAILURE; } /* * I found that -- running from a script (ie no term?) -- the MySQLfs would not background, so the terminal is held; this makes automated testing difficult. * * I (allanc) put this into here to allow for AUTOTEST, but then autotest has to seek-and-destroy the app. This isn't quite perfect yet, I get some flakiness here, othertines the pid is 4 more than the parent, which is odd. */ if (0 < opt.bg) { if (0 < fork()) return EXIT_SUCCESS; //else // fprintf (stderr, "forked %d\n", getpid()); } /* only create a log file if we have a logfile set; note that --enable-debug sets a default above */ if (NULL != opt.logfile) log_file = log_init(opt.logfile, 1); fuse_main(args.argc, args.argv, &mysqlfs_oper); fuse_opt_free_args(&args); pool_cleanup(); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { struct fuse_args args; sqfs_opts opts; sqfs_hl *hl; int ret; struct fuse_opt fuse_opts[] = { {"offset=%u", offsetof(sqfs_opts, offset), 0}, FUSE_OPT_END }; struct fuse_operations sqfs_hl_ops; memset(&sqfs_hl_ops, 0, sizeof(sqfs_hl_ops)); sqfs_hl_ops.init = sqfs_hl_op_init; sqfs_hl_ops.destroy = sqfs_hl_op_destroy; sqfs_hl_ops.getattr = sqfs_hl_op_getattr; sqfs_hl_ops.opendir = sqfs_hl_op_opendir; sqfs_hl_ops.releasedir = sqfs_hl_op_releasedir; sqfs_hl_ops.readdir = sqfs_hl_op_readdir; sqfs_hl_ops.open = sqfs_hl_op_open; sqfs_hl_ops.create = sqfs_hl_op_create; sqfs_hl_ops.release = sqfs_hl_op_release; sqfs_hl_ops.read = sqfs_hl_op_read; sqfs_hl_ops.readlink = sqfs_hl_op_readlink; sqfs_hl_ops.listxattr = sqfs_hl_op_listxattr; sqfs_hl_ops.getxattr = sqfs_hl_op_getxattr; args.argc = argc; args.argv = argv; args.allocated = 0; opts.progname = argv[0]; opts.image = NULL; opts.mountpoint = 0; opts.offset = 0; if (fuse_opt_parse(&args, &opts, fuse_opts, sqfs_opt_proc) == -1) sqfs_usage(argv[0], true); if (!opts.image) sqfs_usage(argv[0], true); hl = sqfs_hl_open(opts.image, opts.offset); if (!hl) return -1; fuse_opt_add_arg(&args, "-s"); /* single threaded */ ret = fuse_main(args.argc, args.argv, &sqfs_hl_ops, hl); fuse_opt_free_args(&args); return ret; }
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"); } umask(0); return fuse_main(args.argc, args.argv, &ciopfs_operations, NULL); }