swapon - Implement encrypted swap

Operating Systems / DragonFlyBSD - Matthew Dillon [apollo.backplane.com] - 16 May 2015 15:45 UTC

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.

58b7380 swapon - Implement encrypted swap
sbin/swapon/swapon.8 | 36 ++++++++++--
sbin/swapon/swapon.c | 156 +++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 162 insertions(+), 30 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share