freebsd-dev/sys/fs/msdosfs
Bruce Evans 4eb3abf0a5 Make using msdosfs as the root file system sort of work:
o Initialize ownerships and permissions.  They were garbage (0) for
  root mounts since vfs_mountroot_try() doesn't ask for them to be set
  and msdosfs's old incomplete code to set them was removed.  The
  garbage happened to give the correct ownerships root:wheel, but it
  gave permissions 000 so init could not be execed.  Use the macros
  for root: wheel and 0755.  (The removed code gave 0:0 and 0777.  0755
  is more normal and secure, thought wrong for /tmp.)

o Check the readonly flag for initial (non-MNT_UPDATE) mounts in the
  correct place, as in ffs.  For root mounts, it is only passed in
  mp->mnt_flags, since vfs_mountroot_try() only passes it as a flag
  and nothing translates the flag to the "ro" option string.  msdosfs
  only looked for it in the string, so it gave a rw mount for root
  mounts without even clearing the flag in mp->mnt_flags, so the final
  state was inconsistent.  Checking the flag only in mp->mnt_flags
  works for initial userland mounts too.  The MNT_UPDATE case is
  messier.

The main point that should work but doesn't is fsck of msdosfs root
while it is mounted ro.  This needs mainly MNT_RELOAD support to work.
It should be possible to run fsck -p and succeed provided the fs is
consistent, not just for msdosfs, but this fails because fsck -p always
tries to open the device rw.  The hack that allows open for writing
in ffs is not implemented in msdosfs, since without MNT_RELOAD support
writing could only be harmful.  So fsck must be turned off to use
msdosfs as root.  This is quite dangerous, since msdosfs is still missing
actually using its fs-dirty flag internally, so it is happy to mount
dirty fileystems rw.

Unrelated changes:
- Fix missing error handling for MNT_UPDATE from rw to ro.
- Catch up with renaming msdos to msdosfs in a string.

Approved by:	re (kensmith)
2007-07-23 07:10:17 +00:00
..
bootsect.h Remove checks for BOOTSIG[23] from FAT32 bootblocks. 2005-09-29 14:09:46 +00:00
bpb.h Fix some bugs involving the fsinfo block (many remain unfixed). This is 2007-07-12 16:09:07 +00:00
denode.h Add a 3rd entry in the cache, which keeps the end position 2007-01-16 23:43:14 +00:00
direntry.h Replace slightly crummy fattime<->timespec conversion functions. 2006-10-24 11:14:05 +00:00
fat.h
msdosfs_conv.c o From the submitter: dos2unixchr will convert to lower case if 2006-11-26 18:49:44 +00:00
msdosfs_denode.c Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
msdosfs_fat.c Clean up before implementing vfs clustering for msdosfs: 2007-07-20 16:21:47 +00:00
msdosfs_fileno.c Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
msdosfs_iconv.c
msdosfs_lookup.c Do not assume that `char direntry::deExtension[3]' starts right after 2006-01-22 21:09:38 +00:00
msdosfs_vfsops.c Make using msdosfs as the root file system sort of work: 2007-07-23 07:10:17 +00:00
msdosfs_vnops.c Implement vfs clustering for msdosfs. 2007-07-20 17:06:57 +00:00
msdosfsmount.h Fix some bugs involving the fsinfo block (many remain unfixed). This is 2007-07-12 16:09:07 +00:00