当前位置: 首页>>代码示例>>C++>>正文


C++ FUSE_ARGS_INIT函数代码示例

本文整理汇总了C++中FUSE_ARGS_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ FUSE_ARGS_INIT函数的具体用法?C++ FUSE_ARGS_INIT怎么用?C++ FUSE_ARGS_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FUSE_ARGS_INIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FUSE_ARGS_INIT

void SMTPFileSystem::printVersion() const
{
    struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
    struct fuse_operations tmp_operations;
    memset(&tmp_operations, 0, sizeof(tmp_operations));
    fuse_opt_add_arg(&args, m_args.argv[0]);
    fuse_opt_add_arg(&args, "--version");
    std::cout << "simple-mtpfs version " << VERSION << "\n";
    fuse_main(args.argc, args.argv, &tmp_operations, nullptr);
    fuse_opt_free_args(&args);
}
开发者ID:wulf7,项目名称:simple-mtpfs,代码行数:11,代码来源:simple-mtpfs-fuse.cpp

示例2: runfuse

int runfuse(int argc, const char* const* argv)
{
	struct fuse_args fua = FUSE_ARGS_INIT(argc, (char**) argv);
	struct cuse_info info;
	const char *iav[] = { "DEVNAME=jrandom",NULL };
	vzero(info);
	info.dev_info_argc = 1;
	info.dev_info_argv = iav;
	info.flags = CUSE_UNRESTRICTED_IOCTL;
	return cuse_lowlevel_main(fua.argc, fua.argv, &info, GET_RNDEV_OPS(), NULL);
}
开发者ID:byte-mug,项目名称:jrandom,代码行数:11,代码来源:starter.c

示例3: main

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 | O_CLOEXEC);
        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 = {};
    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;
}
开发者ID:chenxiaolong,项目名称:DualBootPatcher,代码行数:54,代码来源:fuse-sparse.cpp

示例4: main

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);
}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:12,代码来源:beaglefs.c

示例5: main

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);
}
开发者ID:bskrt,项目名称:gratis,代码行数:12,代码来源:epd_fuse.c

示例6: main

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);
		}
	}

	// 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);
}
开发者ID:strarsis,项目名称:unionfs-fuse,代码行数:52,代码来源:unionfs.c

示例7: sqfs_usage

void sqfs_usage(char *progname, bool fuse_usage) {
	fprintf(stderr, "%s (c) 2012 Dave Vasilevsky\n\n", PACKAGE_STRING);
	fprintf(stderr, "Usage: %s [options] ARCHIVE MOUNTPOINT\n",
		progname ? progname : PACKAGE_NAME);
	if (fuse_usage) {
		struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
		fuse_opt_add_arg(&args, ""); /* progname */
		fuse_opt_add_arg(&args, "-ho");
		fprintf(stderr, "\n");
		fuse_parse_cmdline(&args, NULL, NULL, NULL);
	}
	exit(-2);
}
开发者ID:emiraga,项目名称:squashfuse,代码行数:13,代码来源:fuseprivate.c

示例8: main

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);
}
开发者ID:hufman,项目名称:ceph,代码行数:13,代码来源:rbd-fuse.c

示例9: FUSE_ARGS_INIT

struct fuse *fuse_setup_common(int argc, char *argv[],
			       const struct fuse_operations *op,
			       size_t op_size,
			       char **mountpoint,
			       int *multithreaded,
			       int *fd,
			       void *user_data,
			       int compat)
{
	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
	struct fuse_chan *ch;
	struct fuse *fuse;
	int foreground;
	int res;

	res = fuse_parse_cmdline(&args, mountpoint, multithreaded, &foreground);
	if (res == -1)
		return NULL;

	ch = fuse_mount_common(*mountpoint, &args);
	if (!ch) {
		fuse_opt_free_args(&args);
		goto err_free;
	}

	fuse = fuse_new_common(ch, &args, op, op_size, user_data, compat);
	fuse_opt_free_args(&args);
	if (fuse == NULL)
		goto err_unmount;

	res = fuse_daemonize(foreground);
	if (res == -1)
		goto err_unmount;

	res = fuse_set_signal_handlers(fuse_get_session(fuse));
	if (res == -1)
		goto err_unmount;

	if (fd)
		*fd = fuse_chan_fd(ch);

	return fuse;

err_unmount:
	fuse_unmount_common(*mountpoint, ch);
	if (fuse)
		fuse_destroy(fuse);
err_free:
	free(*mountpoint);
	return NULL;
}
开发者ID:Abhinav1997,项目名称:Team-Win-Recovery-Project,代码行数:51,代码来源:helper.c

示例10: main

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);
}
开发者ID:wader,项目名称:fuse-misc,代码行数:14,代码来源:pipefs.c

示例11: main

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 = "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);
}
开发者ID:wader,项目名称:fuse-misc,代码行数:50,代码来源:ccxfuse.c

示例12: main

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);
	}
}
开发者ID:js6450,项目名称:Operating-Systems,代码行数:50,代码来源:fsdriver.c

示例13: main

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;
}
开发者ID:jdegges,项目名称:arsenal,代码行数:14,代码来源:arsenal.c

示例14: main

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;
}
开发者ID:gderosa,项目名称:darfs,代码行数:14,代码来源:fuse.c

示例15: main

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);
}
开发者ID:dothan009,项目名称:diskfile,代码行数:14,代码来源:main.c


注:本文中的FUSE_ARGS_INIT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。