From: Peter MacDonald (pmacdona@sanjuan)
Date: 07/25/92


From: pmacdona@sanjuan (Peter MacDonald)
Subject: auto-detect fs type on mount
Date: Sat, 25 Jul 1992 16:20:11 GMT

Here is a simple patch to allow the kernel to try to auto
detect the FS type upon a mount request with no type
specified, or with a type of "-". Actually, as you can see,
it just changes sys_mount to try the three current types,
minix, ext, and msdos. We should probably get rid of
the "magic match" msg. Also, overwriting the dev_name
field with the FS type upon return may not be acceptable?

I am sending this to Linus as well, since I am not entirely
sure he can keep up with reading this group anymore :-)

Peter (pmacdona@tadpole.bcsc.gov.bc.ca, pmacdona@sanjuan.uvic.ca)
================================================================

*** super.c.save Sat Jul 25 07:32:30 1992
--- super.c Sat Jul 25 08:58:28 1992
***************
*** 275,288 ****
                        i = 4095;
                memcpy_fromfs((void *) page,data,i);
        }
! if (type) {
                for (i = 0 ; i < 100 ; i++)
                        if (!(tmp[i] = get_fs_byte(type++)))
                                break;
                t = tmp;
! } else
! t = "minix";
! retval = do_mount(dev,dir_name,t,flags,(void *) page);
        free_page(page);
        return retval;
  }
--- 275,297 ----
                        i = 4095;
                memcpy_fromfs((void *) page,data,i);
        }
! if (!type || ('-' == get_fs_byte(type))) {
! if (0 == (retval = do_mount(dev,dir_name,"minix",flags,(void *) page)))
! put_fs_byte('m', dev_name);
! else
! if (0 == (retval = do_mount(dev,dir_name,"ext",flags,(void *) page)))
! put_fs_byte('e', dev_name);
! else
! if (0 == (retval = do_mount(dev,dir_name,"msdos",flags,(void *) page)))
! put_fs_byte('m', dev_name);
!
! } else {
                for (i = 0 ; i < 100 ; i++)
                        if (!(tmp[i] = get_fs_byte(type++)))
                                break;
                t = tmp;
! retval = do_mount(dev,dir_name,t,flags,(void *) page);
! }
        free_page(page);
        return retval;
  }