mount: don't always autodetect

This commit is contained in:
David van Moolenbroek 2010-08-03 13:46:00 +00:00
parent 42bbd56673
commit 256c37f7fa

View file

@ -26,7 +26,7 @@ int main(argc, argv)
int argc; int argc;
char *argv[]; char *argv[];
{ {
int i, n, v, mountflags; int i, n, v = 0, mountflags;
char **ap, *vs, *opt, *err, *type, *args, *device; char **ap, *vs, *opt, *err, *type, *args, *device;
char special[PATH_MAX+1], mounted_on[PATH_MAX+1], version[10], rw_flag[10]; char special[PATH_MAX+1], mounted_on[PATH_MAX+1], version[10], rw_flag[10];
@ -61,13 +61,13 @@ char *argv[];
device = argv[1]; device = argv[1];
if (!strcmp(device, "none")) device = NULL; if (!strcmp(device, "none")) device = NULL;
/* auto-detect type */ if ((type == NULL || !strcmp(type, MINIX_FS_TYPE)) && device != NULL) {
v = fsversion(argv[1], "mount"); /* auto-detect type and/or version */
if (type == NULL) { v = fsversion(device, "mount");
switch (v) { switch (v) {
case FSVERSION_MFS1: case FSVERSION_MFS1:
case FSVERSION_MFS2: case FSVERSION_MFS2:
case FSVERSION_MFS3: type = "mfs"; break; case FSVERSION_MFS3: type = MINIX_FS_TYPE; break;
case FSVERSION_EXT2: type = "ext2"; break; case FSVERSION_EXT2: type = "ext2"; break;
} }
} }
@ -98,7 +98,7 @@ char *argv[];
} }
} }
/* For MFS, use a version number. Otherwise, use the FS type name. */ /* For MFS, use a version number. Otherwise, use the FS type name. */
if (type == NULL || !strcmp(type, MINIX_FS_TYPE)) { if (!strcmp(type, MINIX_FS_TYPE)) {
switch (v) { switch (v) {
case FSVERSION_MFS1: vs = "1"; break; case FSVERSION_MFS1: vs = "1"; break;
case FSVERSION_MFS2: vs = "2"; break; case FSVERSION_MFS2: vs = "2"; break;