From 3b12ce4209b76362fc40be5b9071785823702a5a Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 18 Feb 2013 19:25:50 +0100 Subject: [PATCH] rc.d/addswap: Load the vn(4) module if not already present. Reported-by: lentferj --- etc/rc.d/addswap | 11 +++++++++-- share/man/man5/rc.conf.5 | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/etc/rc.d/addswap b/etc/rc.d/addswap index a44dc1e967..80164ec353 100644 --- a/etc/rc.d/addswap +++ b/etc/rc.d/addswap @@ -3,7 +3,6 @@ # Add additional swap files # # $FreeBSD: src/etc/rc.d/addswap,v 1.2 2002/10/12 10:31:31 schweikh Exp $ -# $DragonFly: src/etc/rc.d/addswap,v 1.5 2007/08/10 18:28:27 swildner Exp $ # # PROVIDE: addswap @@ -22,7 +21,15 @@ addswap_start() [Nn][Oo] | '') ;; *) - if [ -w "${swapfile}" -a -c /dev/vn0 ]; then + if [ -w "${swapfile}" ]; then + # load vn kernel module if needed + if [ ! -c /dev/vn0 ]; then + if kldload vn; then + info 'vn module loaded.' + else + err 1 'vn module failed to load.' + fi + fi echo "Adding ${swapfile} as additional swap" vnconfig -e vn0 ${swapfile} swap fi diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index e2db07e550..ab9a38ca45 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.197 2003/07/28 13:56:00 mbr Exp $ .\" -.Dd December 7, 2012 +.Dd February 18, 2013 .Dt RC.CONF 5 .Os .Sh NAME @@ -125,6 +125,11 @@ If set to .Dq Li NO , no swapfile is installed, otherwise the value is used as the full pathname to a file to use for additional swap space. +The +.Xr vn 4 +driver is needed for a swapfile and will be loaded if it is not +already compiled into the kernel or loaded via +.Xr loader.conf 5 . .It Va apm_enable .Pq Vt bool If set to -- 2.41.0