Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm Fix for cd disklabel issues on arm machines.



details:   https://anonhg.NetBSD.org/src/rev/6dea8c79ca49
branches:  trunk
changeset: 570164:6dea8c79ca49
user:      chris <chris%NetBSD.org@localhost>
date:      Sun Sep 26 11:57:53 2004 +0000

description:
Fix for cd disklabel issues on arm machines.

Because we no longer return an error message when no disklabel was found
the scsipi/cd.c code took the label we generated.  The problem is that the
readdisklabel code was clearing the partition information, which included
the default partition information setup by the cd.c code.  Previously when
no disklabel was found we returned an error, which caused the cd.c code to
generate a new default label which included an a partition.

According to the man page for readdisklabel:
Unspecified fields in lp should be set to zero

Therefore we have no reason to clear the partition info, as it's already
clear or contains useful default partition info.

This means if we don't find a label on disk, the default label is left as
is.  I would expect the driver to have setup a much more sensible default
label than we could fake at this level.

Also don't hard code the number of partitions to the maximum.  This better
matches other platforms (i386)

diffstat:

 sys/arch/arm/arm/disksubr.c |  13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diffs (34 lines):

diff -r 28b691de3308 -r 6dea8c79ca49 sys/arch/arm/arm/disksubr.c
--- a/sys/arch/arm/arm/disksubr.c       Sun Sep 26 09:00:37 2004 +0000
+++ b/sys/arch/arm/arm/disksubr.c       Sun Sep 26 11:57:53 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disksubr.c,v 1.11 2004/09/25 18:54:36 chris Exp $      */
+/*     $NetBSD: disksubr.c,v 1.12 2004/09/26 11:57:53 chris Exp $      */
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.11 2004/09/25 18:54:36 chris Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.12 2004/09/26 11:57:53 chris Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -144,13 +144,8 @@
        if (lp->d_secperunit == 0)
                lp->d_secperunit = 0x1fffffff;
 
-       lp->d_npartitions = MAXPARTITIONS;
-       for (i = 0; i < MAXPARTITIONS; i++) {
-               if (i == RAW_PART) continue;
-               lp->d_partitions[i].p_offset = 0;
-               lp->d_partitions[i].p_fstype = FS_UNUSED;
-               lp->d_partitions[i].p_size = 0;
-       }
+       if (lp->d_npartitions < RAW_PART + 1)
+             lp->d_npartitions = RAW_PART + 1;
 
        if (lp->d_partitions[RAW_PART].p_size == 0) {
                lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED; 



Home | Main Index | Thread Index | Old Index