Subject: Re: kern/22774: there is no way to swapctl -a to a wrongly typed partition
To: None <tv@pobox.com>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 09/13/2003 17:54:04
On Sat, 13 Sep 2003, tv@pobox.com wrote:
> # cgdconfig -s cgd0 /dev/wd1e aes-cbc 192 </dev/urandom
> # swapctl -a /dev/cgd0d
> swapctl: /dev/cgd0d: Device not configured
I know I sent a PR about this months ago, but I can't find it now.
Even a search for "dksubr" fails to find the PR.
Anyway, the appended patch to sys/dev/dksubr.c
allows swap to /dev/cgd0d to work.
--apb (Alan Barrett)
Index: sys/dev/dksubr.c
--- sys/dev/dksubr.c 14 Jul 2003 15:47:03 -0000 1.10
+++ sys/dev/dksubr.c 15 Jul 2003 12:54:59 -0000
@@ -224,6 +224,9 @@
return -1;
part = DISKPART(dev);
+ if (part == RAW_PART)
+ return dksc->sc_size;
+
is_open = dksc->sc_dkdev.dk_openmask & (1 << part);
if (!is_open && di->di_open(dev, 0, S_IFBLK, curproc))