-static void proceed_question(NOARGS)
-{
- char buf[256];
- char *short_yes = _("yY");
-
- fflush(stdout);
- fflush(stderr);
- printf(_("Proceed anyway? (y,n) "));
- buf[0] = 0;
- fgets(buf, sizeof(buf), stdin);
- if (strchr(short_yes, buf[0]) == 0)
- exit(1);
-}
-
-#ifndef SCSI_BLK_MAJOR
-#define SCSI_BLK_MAJOR(M) ((M) == SCSI_DISK_MAJOR || (M) == SCSI_CDROM_MAJOR)
-#endif
-
-static void check_plausibility(const char *device)
-{
-#ifdef HAVE_LINUX_MAJOR_H
-#ifndef MAJOR
-#define MAJOR(dev) ((dev)>>8)
-#define MINOR(dev) ((dev) & 0xff)
-#endif
-
- int val;
- struct stat s;
-
- val = stat(device, &s);
-
- if(val == -1) {
- fprintf(stderr, _("Could not stat %s --- %s\n"),
- device, error_message(errno));
- if (errno == ENOENT)
- fprintf(stderr, _("\nThe device apparently does "
- "not exist; did you specify it correctly?\n"));
- exit(1);
- }
- if(!S_ISBLK(s.st_mode)) {
- printf(_("%s is not a block special device.\n"), device);
- proceed_question();
- return;
- } else if ((MAJOR(s.st_rdev) == HD_MAJOR &&
- MINOR(s.st_rdev)%64 == 0) ||
- (SCSI_BLK_MAJOR(MAJOR(s.st_rdev)) &&
- MINOR(s.st_rdev)%16 == 0)) {
- printf(_("%s is entire device, not just one partition!\n"),
- device);
- proceed_question();
- }
-#endif
-}
-
-static void check_mount(const char *device)
-{
- errcode_t retval;
- int mount_flags;
-
- retval = ext2fs_check_if_mounted(device, &mount_flags);
- if (retval) {
- com_err("ext2fs_check_if_mount", retval,
- _("while determining whether %s is mounted."),
- device);
- return;
- }
- if (!(mount_flags & EXT2_MF_MOUNTED))
- return;
-
- fprintf(stderr, _("%s is mounted; "), device);
- if (force) {
- fprintf(stderr, _("mke2fs forced anyway. "
- "Hope /etc/mtab is incorrect.\n"));
- } else {
- fprintf(stderr, _("will not make a filesystem here!\n"));
- exit(1);
- }
-}
-