I have a question regarding mounting filesystem without giving filesystem type as argument to mount command:<div><br></div><div><br></div><div>AFAIK when mount command is run to mount a FS the corresponding call made in kernel is "compat_sys_mount" as per kernel 2.6.36. Now compat_sys_kernel expects a filesystem "type" name as argument but in compat_sys_mount there is no check for "type" argument as NULL, now as part of this mount path do_kern_mount also called which uses the "type" argument to compat_sys_mount and finds out the corresponding file_system_type structure from the file_system_type structure list and if not matching structure is found it returns with error.</div>
<div><br></div><div><div><div> 842 asmlinkage long compat_sys_mount(const char __user * dev_name,</div><div> 843 const char __user * dir_name,</div><div> 844 const char __user * type, unsigned long flags, <====== type argument to compat_sys_mount</div>
<div> 845 const void __user * data)</div><div> 846 {</div><div> 847 char *kernel_type;</div><div> 848 unsigned long data_page;</div><div> 849 char *kernel_dev;</div>
<div> 850 char *dir_page;</div><div> 851 int retval;</div><div> 852</div><div> 853 retval = copy_mount_string(type, &kernel_type);</div></div><div><br></div><div><br></div><div> 1098 do_kern_mount(const char *fstype, int flags, const char *name, void *data)</div>
<div> 1099 {</div><div> 1100 struct file_system_type *type = get_fs_type(fstype); <======= same type argument to search in list</div><div> 1101 struct vfsmount *mnt;</div><div> 1102 if (!type) <======= if the type name entry not found in list return ERRROR</div>
<div> 1103 return ERR_PTR(-ENODEV);</div><div> 1104 mnt = vfs_kern_mount(type, flags, name, data);</div><div> 1105 if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&</div>
<div> 1106 !mnt->mnt_sb->s_subtype)</div><div> 1107 mnt = fs_set_subtype(mnt, fstype);</div><div> 1108 put_filesystem(type);</div><div> 1109 return mnt;</div><div>
1110 }</div></div><div><br></div><div><br></div><div>Now my question is that if I don't provide FS type name to mount command how the FS gets mounted. Is there some other path for this code or if before calling compat_sys_mount i.e in user mode FS type is determined somehow?</div>
<div><br></div><div><br></div><div>Regards,</div><div>Piyush</div><div><br></div><div><br></div><div><br></div>