if (optind < argc)
usage();
- if (!force)
- check_plausibility(device_name, 0, NULL);
+ if (!check_plausibility(device_name, 0, NULL) && !force)
+ proceed_question();
+
check_mount(device_name, force, _("filesystem"));
/* Determine the size of the device (if possible) */
if (journal_device) {
ext2_filsys jfs;
- if (!force)
- check_plausibility(journal_device, CHECK_BLOCK_DEV,
- NULL);
+ if (!check_plausibility(journal_device, CHECK_BLOCK_DEV,
+ NULL) && !force)
+ proceed_question();
check_mount(journal_device, force, _("journal"));
retval = ext2fs_open(journal_device, EXT2_FLAG_RW|
goto err;
}
if (journal_device) {
- check_plausibility(journal_device, CHECK_BLOCK_DEV, NULL);
+ if (!check_plausibility(journal_device, CHECK_BLOCK_DEV,
+ NULL))
+ proceed_question();
check_mount(journal_device, 0, _("journal"));
#ifdef CONFIG_TESTIO_DEBUG
if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
exit(1);
}
-void check_plausibility(const char *device, int flags, int *ret_is_dev)
+/*
+ * return 1 if the device looks plausible
+ */
+int check_plausibility(const char *device, int flags, int *ret_is_dev)
{
int val, is_dev = 0;
ext2fs_struct_stat s;
if ((flags & CHECK_BLOCK_DEV) && !is_dev) {
printf(_("%s is not a block special device.\n"), device);
- proceed_question();
- return;
+ return 0;
}
#ifdef HAVE_LINUX_MAJOR_H
MINOR(s.st_rdev)%16 == 0))) {
printf(_("%s is entire device, not just one partition!\n"),
device);
- proceed_question();
+ return 0;
}
#endif
+ return 1;
}
void check_mount(const char *device, int force, const char *type)
#endif
extern char *get_progname(char *argv_zero);
extern void proceed_question(void);
-extern void check_plausibility(const char *device, int flags,
- int *ret_is_dev);
+extern int check_plausibility(const char *device, int flags,
+ int *ret_is_dev);
extern void parse_journal_opts(const char *opts);
extern void check_mount(const char *device, int force, const char *type);
extern unsigned int figure_journal_size(int size, ext2_filsys fs);