+2003-04-06 Theodore Ts'o <tytso@mit.edu>
+
+ * fsck.c (parse_fstab_line, interpret_type, fsck_device, ignore,
+ main): Don't evaluate the filesystem type when loading the
+ fstab file, since that might cause fsck to hang trying to
+ read from a floppy disk. (Addresses Debian bug #187812)
+ Add tmpfs and devpts to filesystems that should be
+ ignored, and add jfs, reseirfs, and xfs as filesystems
+ types where we should complain if we can't find the fsck
+ program for that filesystem type.
+
2003-04-03 Theodore Ts'o <tytso@mit.edu>
* badblocks.c (bb_output): Flush output to the badblocks
"proc",
"sw",
"swap",
+ "tmpfs",
+ "devpts",
NULL
};
"minix",
"ext2",
"ext3",
+ "jfs",
+ "reiserfs",
"xiafs",
+ "xfs",
NULL
};
return;
}
-static struct fs_info *create_fs_device(char *device, char *mntpnt,
- char *type, char *opts, int freq,
- int passno)
+static struct fs_info *create_fs_device(const char *device, const char *mntpnt,
+ const char *type, const char *opts,
+ int freq, int passno)
{
struct fs_info *fs;
static int parse_fstab_line(char *line, struct fs_info **ret_fs)
{
char *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp;
- char *t = NULL;
struct fs_info *fs;
*ret_fs = 0;
dev = blkid_get_devname(cache, device, NULL);
if (dev)
device = dev;
-
- if (strcmp(type, "auto") == 0 || (strchr(type, ',') != 0))
- t = blkid_get_tag_value(cache, "TYPE", device);
- if (t)
- type = t;
- fs = create_fs_device(device, mntpnt, type, opts,
+ if (strchr(type, ','))
+ type = 0;
+
+ fs = create_fs_device(device, mntpnt, type ? type : "auto", opts,
freq ? atoi(freq) : -1,
passno ? atoi(passno) : -1);
if (dev)
free(dev);
- if (t)
- free(t);
if (!fs)
return -1;
return 0;
}
+static void interpret_type(struct fs_info *fs)
+{
+ char *t;
+
+ if (strcmp(fs->type, "auto") != 0)
+ return;
+ t = blkid_get_tag_value(cache, "TYPE", fs->device);
+ if (t) {
+ free(fs->type);
+ fs->type = t;
+ }
+}
+
/*
* Load the filesystem database from /etc/fstab
*/
static struct fs_info *lookup(char *filesys)
{
struct fs_info *fs;
- int try_again = 0;
/* No filesys name given. */
if (filesys == NULL)
*/
static void fsck_device(struct fs_info *fs, int interactive)
{
- const char *type = 0;
+ const char *type;
int retval;
- if (fstype && strncmp(fstype, "no", 2) &&
+ interpret_type(fs);
+
+ if (strcmp(fs->type, "auto") != 0)
+ type = fs->type;
+ else if (fstype && strncmp(fstype, "no", 2) &&
strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) &&
!strchr(fstype, ','))
type = fstype;
-
- type = fs->type ? fs->type : DEFAULT_FSTYPE;
+ else
+ type = DEFAULT_FSTYPE;
num_running++;
retval = execute(type, fs->device, fs->mountpt, interactive);
if (fs->passno == 0)
return 1;
+ interpret_type(fs);
+
/*
* If a specific fstype is specified, and it doesn't match,
* ignore it.
/*
* Do an initial scan over the filesystem; mark filesystems
- * which should be ignored as done, and resolve LABEL= and
- * UUID= specifications to the real device.
+ * which should be ignored as done, and resolve any "auto"
+ * filesystem types (done as a side-effect of calling ignore()).
*/
for (fs = filesys_info; fs; fs = fs->next) {
if (ignore(fs))
{
int i, status = 0;
int interactive = 0;
- char *type, *oldpath = getenv("PATH");
+ char *oldpath = getenv("PATH");
const char *fstab;
struct fs_info *fs;
}
fs = lookup(devices[i]);
if (!fs) {
- type = blkid_get_tag_value(cache, "TYPE", devices[i]);
- if (!type) {
- fprintf(stderr, _("Could not determine "
- "filesystem type for %s\n"),
- devices[i]);
- continue;
- }
- fs = create_fs_device(devices[i], 0, type, 0, -1, -1);
- free(type);
+ fs = create_fs_device(devices[i], 0, "auto",
+ 0, -1, -1);
if (!fs)
continue;
}