swapon - Implement encrypted swap
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 16 May 2015 20:45:03 +0000 (13:45 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 16 May 2015 20:45:03 +0000 (13:45 -0700)
commit58b7380e3b94ae164042d357c09ef8b67419792a
tree8eb9d1021353e48fb7d2e1308410105318168427
parent531566e66397de31692200b6ce1f7ba09d924593
swapon - Implement encrypted swap

Implement crypting of the swap device.  When enabled in this manner
/dev/urandom is used to generate a 256-bit random key and the base device
is automatically cryptsetup and mapped, making crypted swap trivial.

* Implement the 'crypt' fstab option, so swapon -a and swapoff -a work
  as expected for crypted swap.  Again, the base device (e.g. /dev/da0s1b)
  should be specified.  The option will automatically map it with cryptsetup
  and swap on the mapping.

  Also implement -c to crypt manual swapon/swapoff commands.  If used for
  swapon it must also be used for swapoff.  Again, specify the base device
  (e.g. /dev/da0s1b), not the /dev/mapper device, for both cases.

* Implement the 'trim' fstab option, allow trim to be specified in the fstab
  instead of requiring a rc.conf option.

* The trim option no longer exits with an error if the device does not
  support TRIM or TRIM is not enabled.
sbin/swapon/swapon.8
sbin/swapon/swapon.c