From 0c9f67f315efbb3a0ee059464b04f1691113438a Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 5 Feb 2008 22:18:39 +0000 Subject: [PATCH] remove never used fuse code related to the 'nonempty' mount option --- libfuse-lite/fusermount.c | 7 ------- libfuse-lite/mount.c | 9 --------- libfuse-lite/mount_util.c | 32 -------------------------------- libfuse-lite/mount_util.h | 2 -- 4 files changed, 50 deletions(-) diff --git a/libfuse-lite/fusermount.c b/libfuse-lite/fusermount.c index 06a226c1..fbe9abb6 100644 --- a/libfuse-lite/fusermount.c +++ b/libfuse-lite/fusermount.c @@ -378,7 +378,6 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode, char *subtype = NULL; char *source = NULL; char *type = NULL; - int check_empty = 1; int blkdev = 0; optbuf = (char *) malloc(strlen(opts) + 128); @@ -400,8 +399,6 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode, goto err; } else if (opt_eq(s, len, "blkdev")) { blkdev = 1; - } else if (opt_eq(s, len, "nonempty")) { - check_empty = 0; } else if (!begins_with(s, "fd=") && !begins_with(s, "rootmode=") && !begins_with(s, "user_id=") && @@ -451,10 +448,6 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode, sprintf(d, "fd=%i,rootmode=%o,user_id=%i,group_id=%i", fd, rootmode, getuid(), getgid()); - if (check_empty && - fuse_mnt_check_empty(progname, mnt, rootmode, rootsize) == -1) - goto err; - source = malloc((fsname ? strlen(fsname) : 0) + (subtype ? strlen(subtype) : 0) + strlen(dev) + 32); diff --git a/libfuse-lite/mount.c b/libfuse-lite/mount.c index 2c95e5eb..b011b3df 100644 --- a/libfuse-lite/mount.c +++ b/libfuse-lite/mount.c @@ -44,7 +44,6 @@ struct mount_opts { int allow_root; int ishelp; int flags; - int nonempty; int blkdev; char *fsname; char *subtype; @@ -59,13 +58,11 @@ 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("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("blkdev", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("fsname=", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("subtype=", KEY_SUBTYPE_OPT), @@ -244,12 +241,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; - } - fd = open(devname, O_RDWR); if (fd == -1) { if (errno == ENODEV || errno == ENOENT) diff --git a/libfuse-lite/mount_util.c b/libfuse-lite/mount_util.c index 05098293..ddd81f7b 100644 --- a/libfuse-lite/mount_util.c +++ b/libfuse-lite/mount_util.c @@ -191,38 +191,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/libfuse-lite/mount_util.h b/libfuse-lite/mount_util.h index b7350213..a7559675 100644 --- a/libfuse-lite/mount_util.h +++ b/libfuse-lite/mount_util.h @@ -12,8 +12,6 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname, const char *mnt, const char *type, const char *opts); int fuse_mnt_umount(const char *progname, const char *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); int fusermount(int unmount, int quiet, int lazy, const char *opts,