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 When reading the disklabel if we fail to fi...



details:   https://anonhg.NetBSD.org/src/rev/d908915d2587
branches:  trunk
changeset: 570140:d908915d2587
user:      chris <chris%NetBSD.org@localhost>
date:      Sat Sep 25 18:24:55 2004 +0000

description:
When reading the disklabel if we fail to find one, return an error.

This should fix PR's 26564 and 26809.

This allows CD installs on cats to work, as a cdxa partition is now
faked, so sysinst can mount it.

This does go against changes made for PR 21408, as it will cause the error
cd0: no disk label
to appear when running disklabel cd0.

Really readdisklabel's API should be updated to allow better error returns,
such that the driver can choose to fake the label, if readdisklabel didn't
find one.

diffstat:

 sys/arch/arm/arm/disksubr.c |  24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r b9d6ab8a77fd -r d908915d2587 sys/arch/arm/arm/disksubr.c
--- a/sys/arch/arm/arm/disksubr.c       Sat Sep 25 16:44:30 2004 +0000
+++ b/sys/arch/arm/arm/disksubr.c       Sat Sep 25 18:24:55 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disksubr.c,v 1.9 2003/08/07 16:26:51 agc Exp $ */
+/*     $NetBSD: disksubr.c,v 1.10 2004/09/25 18:24:55 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.9 2003/08/07 16:26:51 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.10 2004/09/25 18:24:55 chris Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -217,8 +217,26 @@
                        break;
                }
        }
+       if (found == 0) {
+               /* 
+                * we must return an error, when we don't find a disklabel,
+                * so that the driver above can fake a sensible label.
+                * Really readdisklabel should be able to return a value
+                * indicating we faked the label, and the driver can then
+                * decide to take the one we faked, or fake a new one.
+                * 
+                * Faking a label at this level could generate the wrong
+                * label, as we don't know correct FS we should use.
+                * 
+                * By returning an error, we allow cd's to get the
+                * correct faked label.
+                *
+                * Note this does go against PR kern/21408.
+                */
+               msg = "no disk label";
+       }
 
-       if (msg != NULL || found == 0)
+       if (msg != NULL)
                goto done;
 
        /* obtain bad sector table if requested and present */



Home | Main Index | Thread Index | Old Index