kern/85649: [patch] allow mounting msdos files systems as root device

Ben Thomas bthomas at virtualiron.com
Fri Sep 2 18:00:36 GMT 2005


>Number:         85649
>Category:       kern
>Synopsis:       [patch] allow mounting msdos files systems as root device
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 02 18:00:34 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Ben Thomas
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
Virtual Iron Software
>Environment:
System: FreeBSD bthomas4.katana-technology.com 5.4-RELEASE FreeBSD 5.4-RELEASE #10: Sun Aug 28 13:48:00 EDT 2005 ben at bthomas4.katana-technology.com:/usr/obj/usr/home/ben/BSD/RELENG_5_4_0_RELEASE/src/sys/BEN i386


>Description:

Support mounting of msdosfs file systems as root.  Yes, it's unusual.  Yes,
it was needed.

This patch is against the 5_4_0_RELEASE code

>How-To-Repeat:
>Fix:

--- msdosfs_vfsops.c-DIFF begins here ---
--- /usr/src.original/sys/fs/msdosfs/msdosfs_vfsops.c	Mon Jan 31 18:25:56 2005
+++ /usr/src/sys/fs/msdosfs/msdosfs_vfsops.c	Thu Aug 11 16:16:26 2005
@@ -197,6 +197,25 @@
 	int error, flags;
 	mode_t accessmode;
 
+	/*
+	 * Use NULL path to indicate we are mounting the root filesystem.
+	 */
+	struct vnode *rootvp;
+	if (path == NULL) {
+	  if ((error = bdevvp(rootdev, &rootvp))) {
+	    printf("msdosfs_mountroot: can't find rootvp\n");
+	    return (error);
+	  }
+
+	  if ((error = mountmsdosfs(rootvp, mp, td, NULL)) != 0)
+	    return (error);
+	  (void)VFS_STATFS(mp, &mp->mnt_stat, td);
+	  (void) msdosfs_statfs(mp, &mp->mnt_stat, td);
+	  args.mask = ALLPERMS;
+	  update_mp(mp, &args, td);
+	  return (0);
+	}
+
 	error = copyin(data, (caddr_t)&args, sizeof(struct msdosfs_args));
 	if (error)
 		return (error);
--- msdosfs_vfsops.c-DIFF ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list