本文整理汇总了C++中FUSE_ARGS_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ FUSE_ARGS_INIT函数的具体用法?C++ FUSE_ARGS_INIT怎么用?C++ FUSE_ARGS_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FUSE_ARGS_INIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: main
/*
* First we divide the given arguments into FUSE and cmd arguments, pass the
* FUSE arguments to FUSE, and call cmd_Dispatch in the FUSE init function.
*/
int
main(int argc, char **argv)
{
int code;
struct fuse_args args = FUSE_ARGS_INIT(argc-1, &argv[1]);
fuse_opt_add_arg(&afsd_args, argv[0]);
#ifdef AFS_SUN511_ENV
/* for some reason, Solaris 11 FUSE takes the filesystem name from
* argv[0], and ignores the -ofsname option */
fuse_opt_add_arg(&fuse_args, "AFS");
#else
fuse_opt_add_arg(&fuse_args, argv[0]);
#endif
/* let us determine file inode numbers, not FUSE. also make "AFS" appear
* in df/mount/mnttab/etc output. */
fuse_opt_add_arg(&fuse_args, "-ouse_ino,fsname=AFS");
if (getuid() == 0) {
/* allow other users to access the mountpoint. only do this for
* root, since non-root may or may not be able to do this */
fuse_opt_add_arg(&fuse_args, "-oallow_other");
}
code = uafs_Setup("/afs");
if (code) {
errno = code;
perror("libuafs");
return 1;
}
split_args(&args);
uafs_ParseArgs(afsd_args.argc, afsd_args.argv);
/* pass "-- /mount/dir" to fuse to specify dir to mount; "--" is
* just to make sure fuse doesn't interpret the mount dir as a flag
*/
#ifndef AFS_SUN511_ENV
/* This seems to screw up option parsing on Solaris 11 FUSE, so just
* don't do it. This makes it slightly more annoying to mount on a dir
* called -foo or something, but oh well. */
fuse_opt_add_arg(&fuse_args, "--");
#endif
fuse_opt_add_arg(&fuse_args, uafs_MountDir());
return fuse_main(fuse_args.argc, fuse_args.argv, &fuafsd_oper, NULL);
}
开发者ID:jblaine,项目名称:openafs,代码行数:53,代码来源:afsd_fuse.c
示例17: main
/**
* 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;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:52,代码来源:mysqlfs.c
示例18: main
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);
}
开发者ID:Equidamoid,项目名称:ciopfs,代码行数:15,代码来源:ciopfs.c
示例19: main
int main(int argc, char *argv[])
{
umask(0);
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
fuse_opt_parse(&args, &the_config, cow_opts, cow_opt_proc);
if (the_config.src_dir == NULL || the_config.cow_dir == NULL) {
fprintf(stderr,
"You must specify -o src_dir=... and a -o cow_dir=...\n");
exit(1);
}
return fuse_main(args.argc, args.argv, &cow_oper, NULL);
}
开发者ID:bowei,项目名称:fuse-simple-cow,代码行数:15,代码来源:simple-cow.c
示例20: parse_options
struct fuse_args * parse_options(int argc, char *argv[])
{
struct fuse_args * args=calloc(1, sizeof(struct fuse_args));
struct cow_config *conf = cow_getConfig();
int pathmaxcnt = 0;
do{
pathmaxcnt++;
conf->cwd = calloc(PATH_MAX*pathmaxcnt, sizeof(char));
if(getcwd(conf->cwd, PATH_MAX*pathmaxcnt)==NULL){
free(conf->cwd);
conf->cwd = NULL;
}
}while(conf->cwd==NULL && errno == ERANGE);
if(conf->cwd==NULL){
fprintf(stderr, "ERROR: couldnt allocate current working directory buffer (%d)\n", errno);
exit(-1);
}
{
struct fuse_args tmp=FUSE_ARGS_INIT(argc, argv);
memcpy(args, &tmp, sizeof(struct fuse_args));
}
if (fuse_opt_parse(args, cow_getConfig(), cow_opts, cow_opt_proc)==-1)
exit(-1);
char *cliopt = NULL;
int clilen = strlen(FUSE_MP_OPT_STR)+strlen(conf->srcdir)+1;
int i = 0;
for(i=0;i<conf->dstdircnt;i++){
if(i) clilen++; /* separator character */
clilen += strlen(conf->dstdirs[i]);
}
clilen++; /* null byte */
cliopt = calloc(clilen, sizeof(char));
sprintf(cliopt, "%s%s=", FUSE_MP_OPT_STR, conf->srcdir);
for(i=0;i<conf->dstdircnt;i++){
if(i) strcat(cliopt, ";");
strcat(cliopt, conf->dstdirs[i]);
}
fuse_opt_insert_arg(args, 1, cliopt);
fuse_opt_insert_arg(args, 1, conf->mountpt);
return args;
}
开发者ID:VRciF,项目名称:scripts,代码行数:48,代码来源:cowfs.c
注:本文中的FUSE_ARGS_INIT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论