Subject: Re: kern/22774: there is no way to swapctl -a to a wrongly typed
To: Roland Dowdeswell <elric@imrryr.org>
From: Todd Vierling <tv@duh.org>
List: netbsd-bugs
Date: 09/14/2003 10:37:07
As to prepopulating the "b" partition, here's a diff.  It doesn't munge the
default disklabel as returned by the DEFLABEL ioctl, only the in-core
disklabel used when no label at all is present.

Index: dksubr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/dksubr.c,v
retrieving revision 1.4
diff -u -r1.4 dksubr.c
--- dksubr.c	2002/12/17 01:55:44	1.4
+++ dksubr.c	2003/09/14 14:24:07
@@ -480,7 +480,14 @@
 {
 	struct	disklabel *lp = dksc->sc_dkdev.dk_label;

+	/* change raw partition type to 4.2BSD */
 	lp->d_partitions[RAW_PART].p_fstype = FS_BSDFFS;
+
+	/* set fictitious swap partition "b" as whole disk */
+	lp->d_partitions[1].p_offset = 0;
+	lp->d_partitions[1].p_size = dksc->sc_size;
+	lp->d_partitions[1].p_fstype = FS_SWAP;
+
 	strncpy(lp->d_packname, "default label", sizeof(lp->d_packname));
 	lp->d_checksum = dkcksum(lp);
 }

-- 
-- Todd Vierling <tv@duh.org> <tv@pobox.com>