#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) */
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
if (!devname || !name)
return NULL;
- fd = open_device(devname);
+ fd = open(devname, O_RDONLY);
if (fd < 0)
return NULL;
if (!blprobe)
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;
goto out;
}
-mount_retry:
block_signals (SIG_BLOCK);
if (!fake) {
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: