char *fsck_path = 0;
static int ignore(struct fs_info *);
-char *string_copy(const char *s)
-{
- char *ret;
-
- ret = malloc(strlen(s)+1);
- if (ret)
- strcpy(ret, s);
- return ret;
-}
-
static char *skip_over_blank(char *cp)
{
while (*cp && isspace(*cp))
*/
static char *interpret_device(char *spec)
{
- char *dev = NULL;
-
- if (!strncmp(spec, "UUID=", 5))
- dev = get_spec_by_uuid(spec+5);
- else if (!strncmp(spec, "LABEL=", 6))
- dev = get_spec_by_volume_label(spec+6);
- else
- return spec;
- if (dev) {
- free(spec);
- return (dev);
- }
+ char *dev = interpret_spec(spec);
+
+ if (dev)
+ return dev;
+
/*
* Check to see if this was because /proc/partitions isn't
* found.
* Check to see if this is because we're not running as root
*/
if (geteuid())
- fprintf(stderr, "Must be root to scan for matching "
- "filesystems: %s\n", spec);
+ fprintf(stderr,
+ "Must be root to scan for matching filesystems: %s\n",
+ spec);
else
- fprintf(stderr, "Couldn't find matching filesystem: %s\n",
+ fprintf(stderr, "Couldn't find matching filesystem: %s\n",
spec);
exit(EXIT_ERROR);
}
/*
+ * Interpret filesystem auto type if necessary
+ */
+static void interpret_type(struct fs_info *fs)
+{
+ const char *type;
+
+ if (strcmp(fs->type, "auto") == 0) {
+ type = identify_fs(fs->device);
+ if (type) {
+ free(fs->type);
+ fs->type = string_copy(type);
+ } else
+ fprintf(stderr, _("Could not determine "
+ "filesystem type for %s\n"),
+ fs->device);
+ }
+}
+
+
+/*
* Load the filesystem database from /etc/fstab
*/
static void load_fs_info(const char *filename)
if ((fsent = lookup(device))) {
device = fsent->device;
+ interpret_type(fsent);
if (!type)
type = fsent->type;
}
#define FS_TYPE_NEGOPT 2
static const char *fs_type_syntax_error =
-_("Either all or none of the filesystem types passed to -t must be prefixed\n"
- "with 'no' or '!'.\n");
+N_("Either all or none of the filesystem types passed to -t must be prefixed\n"
+ "with 'no' or '!'.\n");
static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp)
{
}
if ((negate && !cmp->negate) ||
(!negate && cmp->negate)) {
- fprintf(stderr, fs_type_syntax_error);
+ fprintf(stderr, _(fs_type_syntax_error));
exit(EXIT_USAGE);
}
}
if (fs->passno == 0)
return 1;
+ interpret_type(fs);
+
/*
* If a specific fstype is specified, and it doesn't match,
* ignore it.
if (!base)
return (instance_list != 0);
for (inst = instance_list; inst; inst = inst->next) {
- if (!strcmp(base, inst->base_device)) {
+ if (!inst->base_device || !strcmp(base, inst->base_device)) {
free(base);
return 1;
}
for (fs = filesys_info; fs; fs = fs->next) {
if (ignore(fs))
fs->flags |= FLAG_DONE;
- fs->device = interpret_device(fs->device);
+ else
+ fs->device = interpret_device(fs->device);
}
/*
PRS(argc, argv);
if (!notitle)
- printf(_("Parallelizing fsck version %s (%s)\n"),
- E2FSPROGS_VERSION, E2FSPROGS_DATE);
+ printf("fsck %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
fstab = getenv("FSTAB_FILE");
if (!fstab)
if (doall)
return check_all();
+ if (num_devices == 0) {
+ fprintf(stderr, _("\nNo devices specified to be checked!\n"));
+ exit(EXIT_ERROR);
+ }
for (i = 0 ; i < num_devices; i++) {
fsck_device(devices[i], interactive);
if (serialize) {