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-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
2003-04-03 Theodore Ts'o <tytso@mit.edu>
* badblocks.c (bb_output): Flush output to the badblocks
-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)
static int parse_fstab_line(char *line, struct fs_info **ret_fs)
{
char *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp;
static int parse_fstab_line(char *line, struct fs_info **ret_fs)
{
char *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp;
struct fs_info *fs;
*ret_fs = 0;
struct fs_info *fs;
*ret_fs = 0;
dev = blkid_get_devname(cache, device, NULL);
if (dev)
device = dev;
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);
freq ? atoi(freq) : -1,
passno ? atoi(passno) : -1);
if (dev)
free(dev);
+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
*/
/*
* Load the filesystem database from /etc/fstab
*/
static struct fs_info *lookup(char *filesys)
{
struct fs_info *fs;
static struct fs_info *lookup(char *filesys)
{
struct fs_info *fs;
/* No filesys name given. */
if (filesys == NULL)
/* No filesys name given. */
if (filesys == NULL)
*/
static void fsck_device(struct fs_info *fs, int interactive)
{
*/
static void fsck_device(struct fs_info *fs, int interactive)
{
- 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;
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);
num_running++;
retval = execute(type, fs->device, fs->mountpt, interactive);
if (fs->passno == 0)
return 1;
if (fs->passno == 0)
return 1;
/*
* If a specific fstype is specified, and it doesn't match,
* ignore it.
/*
* If a specific fstype is specified, and it doesn't match,
* ignore it.
/*
* Do an initial scan over the filesystem; mark filesystems
/*
* 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))
*/
for (fs = filesys_info; fs; fs = fs->next) {
if (ignore(fs))
{
int i, status = 0;
int interactive = 0;
{
int i, status = 0;
int interactive = 0;
- char *type, *oldpath = getenv("PATH");
+ char *oldpath = getenv("PATH");
const char *fstab;
struct fs_info *fs;
const char *fstab;
struct fs_info *fs;
}
fs = lookup(devices[i]);
if (!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);