diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-07 20:57:53 -0700 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-15 18:53:45 -0700 |
commit | 0bef21e8543dda7f02b5f4cb3008a7292d249842 (patch) | |
tree | 2ac14db6288588ed28d691053be1f1d5e6624965 /lib | |
parent | 86b261490611ffb0ccd46d3f0f2ae9eca9ae98af (diff) |
Removed -o nonempty option
This brings the default behavior in-line with that of the
regular `mount` command.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mount.c | 11 | ||||
-rw-r--r-- | lib/mount_bsd.c | 1 | ||||
-rw-r--r-- | lib/mount_util.c | 33 | ||||
-rw-r--r-- | lib/mount_util.h | 2 |
4 files changed, 0 insertions, 47 deletions
diff --git a/lib/mount.c b/lib/mount.c index 45ac60a..faac1ea 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -65,7 +65,6 @@ struct mount_opts { int allow_other; int allow_root; int flags; - int nonempty; int auto_unmount; int blkdev; char *fsname; @@ -81,14 +80,12 @@ struct mount_opts { static const struct fuse_opt fuse_mount_opts[] = { FUSE_MOUNT_OPT("allow_other", allow_other), FUSE_MOUNT_OPT("allow_root", allow_root), - FUSE_MOUNT_OPT("nonempty", nonempty), FUSE_MOUNT_OPT("blkdev", blkdev), FUSE_MOUNT_OPT("auto_unmount", auto_unmount), FUSE_MOUNT_OPT("fsname=%s", fsname), FUSE_MOUNT_OPT("subtype=%s", subtype), FUSE_OPT_KEY("allow_other", KEY_KERN_OPT), FUSE_OPT_KEY("allow_root", KEY_ALLOW_ROOT), - FUSE_OPT_KEY("nonempty", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("auto_unmount", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("blkdev", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("fsname=", KEY_FUSERMOUNT_OPT), @@ -125,7 +122,6 @@ void fuse_mount_help(void) " -o allow_other allow access to other users\n" " -o allow_root allow access to root\n" " -o auto_unmount auto unmount on process termination\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 subtype=NAME set filesystem type\n" @@ -421,13 +417,6 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo, return -1; } - if (!mo->nonempty) { - res = fuse_mnt_check_empty("fuse", mnt, stbuf.st_mode, - stbuf.st_size); - if (res == -1) - return -1; - } - if (mo->auto_unmount) { /* Tell the caller to fallback to fusermount because auto-unmount does not work otherwise. */ diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c index c838fcf..dc05506 100644 --- a/lib/mount_bsd.c +++ b/lib/mount_bsd.c @@ -90,7 +90,6 @@ static const struct fuse_opt fuse_mount_opts[] = { * handle them */ FUSE_OPT_KEY("fsname=", KEY_KERN), - FUSE_OPT_KEY("nonempty", KEY_KERN), FUSE_OPT_END }; diff --git a/lib/mount_util.c b/lib/mount_util.c index a23ab0b..8b64ca2 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -333,39 +333,6 @@ char *fuse_mnt_resolve_path(const char *progname, const char *orig) return dst; } -int fuse_mnt_check_empty(const char *progname, const char *mnt, - mode_t rootmode, off_t rootsize) -{ - int isempty = 1; - - if (S_ISDIR(rootmode)) { - struct dirent *ent; - DIR *dp = opendir(mnt); - if (dp == NULL) { - fprintf(stderr, - "%s: failed to open mountpoint for reading: %s\n", - progname, strerror(errno)); - return -1; - } - while ((ent = readdir(dp)) != NULL) { - if (strcmp(ent->d_name, ".") != 0 && - strcmp(ent->d_name, "..") != 0) { - isempty = 0; - break; - } - } - closedir(dp); - } else if (rootsize) - isempty = 0; - - if (!isempty) { - fprintf(stderr, "%s: mountpoint is not empty\n", progname); - fprintf(stderr, "%s: if you are sure this is safe, use the 'nonempty' mount option\n", progname); - return -1; - } - return 0; -} - int fuse_mnt_check_fuseblk(void) { char buf[256]; diff --git a/lib/mount_util.h b/lib/mount_util.h index dc5c916..55c6c5e 100644 --- a/lib/mount_util.h +++ b/lib/mount_util.h @@ -14,6 +14,4 @@ int fuse_mnt_remove_mount(const char *progname, const char *mnt); int fuse_mnt_umount(const char *progname, const char *abs_mnt, const char *rel_mnt, int lazy); char *fuse_mnt_resolve_path(const char *progname, const char *orig); -int fuse_mnt_check_empty(const char *progname, const char *mnt, - mode_t rootmode, off_t rootsize); int fuse_mnt_check_fuseblk(void); |