Module Name:    src
Committed By:   martin
Date:           Tue Mar 16 14:53:08 UTC 2010

Modified Files:
        src/sys/dev/sun: disksubr.c

Log Message:
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>.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sun/disksubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sun/disksubr.c
diff -u src/sys/dev/sun/disksubr.c:1.12 src/sys/dev/sun/disksubr.c:1.13
--- src/sys/dev/sun/disksubr.c:1.12	Mon Mar 16 23:11:16 2009
+++ src/sys/dev/sun/disksubr.c	Tue Mar 16 14:53:08 2010
@@ -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) {

Reply via email to