Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sun Do not overwrite a ISO9660 partition (which the ...



details:   https://anonhg.NetBSD.org/src/rev/af6704a8b5ad
branches:  trunk
changeset: 753124:af6704a8b5ad
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Mar 16 14:53:08 2010 +0000

description:
Do not overwrite a ISO9660 partition (which the sunlabel can not properly
represent, but the cd driver carefully crafted including session data).
This makes it possible to just mount cd0a as cd9660fs on a sparc* install
CD. Solution suggested by <mlelstv>.

diffstat:

 sys/dev/sun/disksubr.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 6d69f570c2a5 -r af6704a8b5ad sys/dev/sun/disksubr.c
--- a/sys/dev/sun/disksubr.c    Tue Mar 16 12:53:17 2010 +0000
+++ b/sys/dev/sun/disksubr.c    Tue Mar 16 14:53:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disksubr.c,v 1.12 2009/03/16 23:11:16 dsl Exp $ */
+/*     $NetBSD: disksubr.c,v 1.13 2010/03/16 14:53:08 martin Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.12 2009/03/16 23:11:16 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.13 2010/03/16 14:53:08 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -321,6 +321,19 @@
        for (i = 0; i < 8; i++) {
                spp = &sl->sl_part[i];
                npp = &lp->d_partitions[i];
+               if (npp->p_fstype == FS_ISO9660
+                   && spp->sdkp_cyloffset * secpercyl == npp->p_offset
+                   && spp->sdkp_nsectors <= npp->p_size
+                   && npp->p_size > 0 && spp->sdkp_nsectors > 0) {
+                       /*
+                        * This happens for example on sunlabel'd hybrid
+                        * (ffs + ISO9660) CDs, like our install CDs.
+                        * The cd driver has initialized a valid ISO9660
+                        * partition (including session parameters), so
+                        * we better not overwrite it.
+                        */
+                       continue;
+               }
                npp->p_offset = spp->sdkp_cyloffset * secpercyl;
                npp->p_size = spp->sdkp_nsectors;
                if (npp->p_size == 0) {



Home | Main Index | Thread Index | Old Index