diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2007-06-20 21:37:58 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2007-06-20 21:37:58 +0000 |
commit | 62c24a8e4b10d77e08ee4a40c6f6b6a8d1eafeab (patch) | |
tree | a94336f70cf1199760a84089c8e83dfe1fe01167 /lib/helper.c | |
parent | 2b3a22fea0509681d9e86d5131a0008165bbf6ba (diff) |
Add fs subtype support to libfuse and fusermount
Diffstat (limited to 'lib/helper.c')
-rw-r--r-- | lib/helper.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/helper.c b/lib/helper.c index 1de088f..d7cc9b7 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -29,7 +29,7 @@ enum { struct helper_opts { int singlethread; int foreground; - int fsname; + int nodefault_subtype; char *mountpoint; }; @@ -40,7 +40,8 @@ static const struct fuse_opt fuse_helper_opts[] = { FUSE_HELPER_OPT("debug", foreground), FUSE_HELPER_OPT("-f", foreground), FUSE_HELPER_OPT("-s", singlethread), - FUSE_HELPER_OPT("fsname=", fsname), + FUSE_HELPER_OPT("fsname=", nodefault_subtype), + FUSE_HELPER_OPT("subtype=", nodefault_subtype), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), @@ -50,6 +51,7 @@ static const struct fuse_opt fuse_helper_opts[] = { 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 }; @@ -117,24 +119,24 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key, } } -static int add_default_fsname(const char *progname, struct fuse_args *args) +static int add_default_subtype(const char *progname, struct fuse_args *args) { int res; - char *fsname_opt; + char *subtype_opt; const char *basename = strrchr(progname, '/'); if (basename == NULL) basename = progname; else if (basename[1] != '\0') basename++; - fsname_opt = (char *) malloc(strlen(basename) + 64); - if (fsname_opt == NULL) { + subtype_opt = (char *) malloc(strlen(basename) + 64); + if (subtype_opt == NULL) { fprintf(stderr, "fuse: memory allocation failed\n"); return -1; } - sprintf(fsname_opt, "-ofsname=%s", basename); - res = fuse_opt_add_arg(args, fsname_opt); - free(fsname_opt); + sprintf(subtype_opt, "-osubtype=%s", basename); + res = fuse_opt_add_arg(args, subtype_opt); + free(subtype_opt); return res; } @@ -149,8 +151,8 @@ int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, if (res == -1) return -1; - if (!hopts.fsname) { - res = add_default_fsname(args->argv[0], args); + if (!hopts.nodefault_subtype) { + res = add_default_subtype(args->argv[0], args); if (res == -1) goto err; } @@ -331,6 +333,11 @@ int fuse_main(void) return -1; } +int fuse_version(void) +{ + return FUSE_VERSION; +} + #include "fuse_compat.h" #ifndef __FreeBSD__ |