diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-07 10:14:34 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-07 10:14:34 +0000 |
commit | ad005978f76c3f5f6d533c4e3f13b5ed39e43173 (patch) | |
tree | 70fc88e6706d89b81473bbc5a782132c724eb6da /lib/mount.c | |
parent | 60c69a2191bdb347a379a272b2a878090491ad3a (diff) | |
download | libfuse-ad005978f76c3f5f6d533c4e3f13b5ed39e43173.tar.gz |
fix
Diffstat (limited to 'lib/mount.c')
-rw-r--r-- | lib/mount.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/mount.c b/lib/mount.c index b53889d..91d96f4 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -27,11 +27,14 @@ enum { KEY_KERN, KEY_ALLOW_ROOT, KEY_RO, + KEY_HELP, + KEY_VERSION, }; struct mount_opts { int allow_other; int allow_root; + int ishelp; char *kernel_opts; }; @@ -58,9 +61,32 @@ static const struct fuse_opt fuse_mount_opts[] = { FUSE_OPT_KEY("sync", KEY_KERN), FUSE_OPT_KEY("atime", KEY_KERN), FUSE_OPT_KEY("noatime", KEY_KERN), + FUSE_OPT_KEY("-h", KEY_HELP), + FUSE_OPT_KEY("--help", KEY_HELP), + FUSE_OPT_KEY("-V", KEY_VERSION), + FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_END }; +static void mount_help(void) +{ + fprintf(stderr, + " -o allow_other allow access to other users\n" + " -o allow_root allow access to root\n" + " -o nonempty allow mounts over non-empty file/dir\n" + " -o default_permissions enable permission checking by kernel\n" + " -o fsname=NAME set filesystem name\n" + " -o large_read issue large read requests (2.4 only)\n" + " -o max_read=N set maximum size of read requests\n" + "\n" + ); +} + +static void mount_version(void) +{ + system(FUSERMOUNT_PROG " --version"); +} + static int fuse_mount_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { @@ -79,6 +105,16 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key, case KEY_KERN: return fuse_opt_add_opt(&mo->kernel_opts, arg); + + case KEY_HELP: + mount_help(); + mo->ishelp = 1; + break; + + case KEY_VERSION: + mount_version(); + mo->ishelp = 1; + break; } return 1; } @@ -133,6 +169,9 @@ void fuse_unmount(const char *mountpoint) const char *mountprog = FUSERMOUNT_PROG; int pid; + if (!mountpoint) + return; + #ifdef HAVE_FORK pid = fork(); #else @@ -235,6 +274,8 @@ int fuse_mount(const char *mountpoint, struct fuse_args *args) fprintf(stderr, "fuse: 'allow_other' and 'allow_root' options are mutually exclusive\n"); goto out; } + if (mo.ishelp) + return 0; res = fuse_mount_compat22(mountpoint, mo.kernel_opts); out: |