git: swapon - Implement encrypted swap

Matthew Dillon dillon at
Sat May 16 13:50:16 PDT 2015

commit 58b7380e3b94ae164042d357c09ef8b67419792a
Author: Matthew Dillon <dillon at>
Date:   Sat May 16 13:45:03 2015 -0700

    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.

Summary of changes:
 sbin/swapon/swapon.8 |  36 ++++++++++--
 sbin/swapon/swapon.c | 156 ++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 162 insertions(+), 30 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list