In /etc/rc, there is a "swapfile" feature, to configure a file to use
swap device.  Here is a script for that.


# Add additional swapfile, if configured.
#
case ${swapfile} in
[Nn][Oo] | '')
        ;;
*)
        if [ -w "${swapfile}" -a -c /dev/mdctl ]; then
                echo "Adding ${swapfile} as additional swap"
                mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
        fi
        ;;
esac


In this shell script, checking that /dev/mdctl file is present as a
character device before configureing swap.  It seems there is no
problem, but it'll fail in some cases, such as:

* kernel doesn't have 'md' driver,
* loader doesn't load 'md' module, and
* /boot/${kernel}/md.ko is present.

If kernel doesn't know md, /dev/mdctl is not there, however, if md.ko
is available, mdconfig(8) loads the module, then configure md device
so "mdconfig && swapon" will success without any problem.

Are there any other reason to check the presense of /dev/mdctl?  If
not, can we remove /dev/mdctl testing?

-- -
Makoto `MAR' Matsushita

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to