コード例 #1
0
ファイル: opts.c プロジェクト: bplaa-yai/unionfs-fuse
int unionfs_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) {
	(void)data;

	int res = 0; // for general purposes

	switch (key) {
		case FUSE_OPT_KEY_NONOPT:
			res = parse_branches(arg);
			if (res > 0) return 0;
			uopt.retval = 1;
			return 1;
		case KEY_DIRS:
			// skip the "dirs="
			res = parse_branches(arg+5);
			if (res > 0) return 0;
			uopt.retval = 1;
			return 1;
		case KEY_CHROOT:
			uopt.chroot = get_opt_str(arg, "chroot");
			return 0;
		case KEY_COW:
			uopt.cow_enabled = true;
			return 0;
		case KEY_DEBUG_FILE:
			uopt.dbgpath = get_opt_str(arg, "debug_file");
			uopt.debug = true;
			return 0;
		case KEY_HELP:
			print_help(outargs->argv[0]);
			fuse_opt_add_arg(outargs, "-ho");
			uopt.doexit = 1;
			return 0;
		case KEY_HIDE_META_FILES:
		case KEY_HIDE_METADIR:
			uopt.hide_meta_files = true;
			return 0;
		case KEY_MAX_FILES:
			set_max_open_files(arg);
			return 0;
		case KEY_NOINITGROUPS:
			// option only for compatibility with older versions
			return 0;
		case KEY_STATFS_OMIT_RO:
			uopt.statfs_omit_ro = true;
			return 0;
		case KEY_RELAXED_PERMISSIONS:
			uopt.relaxed_permissions = true;
			return 0;
		case KEY_VERSION:
			printf("unionfs-fuse version: "VERSION"\n");
#ifdef HAVE_XATTR
			printf("(compiled with xattr support)\n");
#endif
			uopt.doexit = 1;
			return 1;
		default:
 			uopt.retval = 1;
			return 1;
	}
}
コード例 #2
0
ファイル: opts.c プロジェクト: ystk/debian-unionfs-fuse
int unionfs_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) {
	(void)data;

	int res = 0; // for general purposes

	switch (key) {
		case FUSE_OPT_KEY_NONOPT:
			res = parse_branches(arg);
			if (res > 0) return 0;
			uopt.retval = 1;
			return 1;
		case KEY_STATS:
			uopt.stats_enabled = 1;
			return 0;
		case KEY_COW:
			uopt.cow_enabled = true;
			return 0;
		case KEY_STATFS_OMIT_RO:
			uopt.statfs_omit_ro = true;
			return 0;
		case KEY_NOINITGROUPS:
			// option only for compatibility with older versions
			return 0;
		case KEY_CHROOT:
			uopt.chroot = get_chroot(arg);
			return 0;
		case KEY_MAX_FILES:
			set_max_open_files(arg);
			return 0;
		case KEY_HELP:
			print_help(outargs->argv[0]);
			fuse_opt_add_arg(outargs, "-ho");
			uopt.doexit = 1;
			return 0;
		case KEY_VERSION:
			printf("unionfs-fuse version: "VERSION"\n");
			uopt.doexit = 1;
			return 1;
		default:
 			uopt.retval = 1;
			return 1;
	}
}