From ca55a451cdfa48f7640cd2f122aa25dedbd4edf5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 27 Apr 2010 15:15:11 +0200 Subject: [PATCH] mount: revert ugly ENOMEDIUM support Signed-off-by: Karel Zak --- include/blkdev.h | 3 --- lib/fsprobe.c | 25 +------------------------ mount/mount.c | 10 ---------- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/include/blkdev.h b/include/blkdev.h index 98efad68..34e4e924 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -8,9 +8,6 @@ #define DEFAULT_SECTOR_SIZE 512 -/* open() retries when errno is ENOMEDIUM */ -#define CRDOM_NOMEDIUM_RETRIES 5 - #if !defined(BLKROSET) && defined(__linux__) #define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ diff --git a/lib/fsprobe.c b/lib/fsprobe.c index 8eb08fac..e92e03fc 100644 --- a/lib/fsprobe.c +++ b/lib/fsprobe.c @@ -20,29 +20,6 @@ static blkid_cache blcache; -#ifdef HAVE_LIBBLKID_INTERNAL -/* ask kernel developers why we need such ugly open() method... */ -static int -open_device(const char *devname) -{ - int retries = 0; - - do { - int fd = open(devname, O_RDONLY); - if (fd >= 0) - return fd; - if (errno != ENOMEDIUM) - break; - if (retries >= CRDOM_NOMEDIUM_RETRIES) - break; - ++retries; - sleep(3); - } while(1); - - return -1; -} -#endif - /* * Parses NAME=value, returns -1 on parse error, 0 success. The success is also * when the 'spec' doesn't contain name=value pair (because the spec could be @@ -124,7 +101,7 @@ fsprobe_get_value(const char *name, const char *devname, int *ambi) if (!devname || !name) return NULL; - fd = open_device(devname); + fd = open(devname, O_RDONLY); if (fd < 0) return NULL; if (!blprobe) diff --git a/mount/mount.c b/mount/mount.c index 8cab2e8a..969e81fc 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1346,7 +1346,6 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, int loop = 0; const char *loopdev = 0, *loopfile = 0; struct stat statbuf; - int retries = 0; /* Nr of retries for mount in case of ENOMEDIUM */ /* copies for freeing on exit */ const char *opts1, *spec1, *node1, *types1, *extra_opts1; @@ -1412,7 +1411,6 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, goto out; } -mount_retry: block_signals (SIG_BLOCK); if (!fake) { @@ -1658,14 +1656,6 @@ mount_retry: break; } case ENOMEDIUM: - if (retries < CRDOM_NOMEDIUM_RETRIES) { - if (verbose) - printf(_("mount: no medium found on %s ...trying again\n"), - spec); - sleep(3); - ++retries; - goto mount_retry; - } error(_("mount: no medium found on %s"), spec); break; default: -- 2.39.5