Subject: port-sparc/6853: disklabel(8) gives misleading error on sparc (and sun3?)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <briggs@backup.ninthwonder.com>
List: netbsd-bugs
Date: 01/20/1999 01:13:45
>Number: 6853
>Category: port-sparc
>Synopsis: disklabel(8) gives misleading error on sparc (and sun3?)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-sparc-maintainer (NetBSD/sparc Portmaster)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Jan 19 17:20:01 1999
>Last-Modified:
>Originator: Allen Briggs
>Organization:
Ninth Wonder, LLC
>Release: all known
>Environment:
sparc, probably sparc64, and possibly sun3
>Description:
The sparc kernel will fail a disklabel write if the partitions
listed in the disklabel are not cylinder-aligned. When it does
so, the error printed by the disklabel command is
Label magic number or checksum is wrong!
(disklabel or kernel is out of date?)
which is misleading.
This causes headaches for clueful and clueless people alike. A
better error message would help save people (if not individuals)
hours of annoyance and frustration.
>How-To-Repeat:
Create a partition map on a sparc that does not have cylinder-aligned
partitions. Try to write it to the disklabel.
>Fix:
The following patch assumes that the sun3 and sparc64 ports have
the same problem. It simply enables some notdef'ed code to print
a warning if the partition offset or size is not evenly divisible
by secpercyl if the source is compiled with
-DSTRICT_CYLINDER_ALIGNMENT. It also adds the feature that if
the warning is printed, the label check will fail.
It then enables that define for sun3, sparc, and sparc64 ports.
Index: disklabel.c
===================================================================
RCS file: /cvsroot/src/sbin/disklabel/disklabel.c,v
retrieving revision 1.60
diff -c -r1.60 disklabel.c
*** disklabel.c 1998/11/12 16:19:48 1.60
--- disklabel.c 1999/01/20 00:57:16
***************
*** 1722,1736 ****
if (pp->p_size == 0 && pp->p_offset != 0)
warnx("warning, partition %c: size 0, but offset %d",
part, pp->p_offset);
! #ifdef notdef
! if (pp->p_size % lp->d_secpercyl)
warnx("warning, partition %c:"
" size %% cylinder-size != 0",
part);
! if (pp->p_offset % lp->d_secpercyl)
warnx("warning, partition %c:"
" offset %% cylinder-size != 0",
part);
#endif
if (pp->p_offset > lp->d_secperunit) {
warnx("partition %c: offset past end of unit", part);
--- 1722,1740 ----
if (pp->p_size == 0 && pp->p_offset != 0)
warnx("warning, partition %c: size 0, but offset %d",
part, pp->p_offset);
! #ifdef STRICT_CYLINDER_ALIGNMENT
! if (pp->p_size % lp->d_secpercyl) {
warnx("warning, partition %c:"
" size %% cylinder-size != 0",
part);
! errors++;
! }
! if (pp->p_offset % lp->d_secpercyl) {
warnx("warning, partition %c:"
" offset %% cylinder-size != 0",
part);
+ errors++;
+ }
#endif
if (pp->p_offset > lp->d_secperunit) {
warnx("partition %c: offset past end of unit", part);
Index: Makefile
===================================================================
RCS file: /cvsroot/src/sbin/disklabel/Makefile,v
retrieving revision 1.30
diff -c -r1.30 Makefile
*** Makefile 1998/03/02 16:26:47 1.30
--- Makefile 1999/01/20 00:57:07
***************
*** 17,20 ****
--- 17,26 ----
CPPFLAGS+= -DNUMBOOT=1
.endif
+ # recognize old partition ID for a while
+ .if (${MACHINE} == "sparc") || (${MACHINE} == "sparc64") \
+ || (${MACHINE} == "sun3")
+ CPPFLAGS+= -DSTRICT_CYLINDER_ALIGNMENT
+ .endif
+
.include <bsd.prog.mk>
>Audit-Trail:
>Unformatted: