From c0ffe8e4d53e4f4194c3079f64a62e4e5a2ec4a9 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 25 Sep 2004 18:24:55 +0000 Subject: [PATCH] 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. --- sys/arch/arm/arm/disksubr.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c index 7785db60a1b4..87da57bb2644 100644 --- a/sys/arch/arm/arm/disksubr.c +++ b/sys/arch/arm/arm/disksubr.c @@ -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 -__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 #include @@ -217,8 +217,26 @@ readdisklabel(dev, strat, lp, osdep) 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 */