aboutsummaryrefslogtreecommitdiffstats
path: root/nlplug-findfs.c
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2017-08-03 21:44:15 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2017-08-03 21:44:15 +0200
commit5cd586c09e381a530da9abdb86e5cff3e2bc6caa (patch)
tree6565f751437fc9f0e02d9faebb18b1321e4b3fb5 /nlplug-findfs.c
parent9d2040756a0b701c79140f14ce7c8d53d66a2d40 (diff)
downloadmkinitfs-5cd586c09e381a530da9abdb86e5cff3e2bc6caa.tar.bz2
mkinitfs-5cd586c09e381a530da9abdb86e5cff3e2bc6caa.tar.xz
init: add cryptdiscards option
When enabled allows the use of discard (TRIM) requests for the device. See cryptsetup(1) for more information.
Diffstat (limited to 'nlplug-findfs.c')
-rw-r--r--nlplug-findfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nlplug-findfs.c b/nlplug-findfs.c
index f23d0dd..be525cc 100644
--- a/nlplug-findfs.c
+++ b/nlplug-findfs.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <stdint.h>
#include <sys/eventfd.h>
#include <sys/signalfd.h>
@@ -317,6 +318,7 @@ struct cryptconf {
size_t payload_offset;
pthread_t tid;
pthread_mutex_t mutex;
+ uint32_t flags;
};
struct ueventconf {
@@ -605,7 +607,8 @@ static void *cryptsetup_thread(void *data)
pthread_mutex_lock(&c->crypt.mutex);
r = crypt_activate_by_passphrase(cd, c->crypt.data.name,
CRYPT_ANY_SLOT,
- pass, strlen(pass), 0);
+ pass, strlen(pass),
+ c->crypt.flags);
pthread_mutex_unlock(&c->crypt.mutex);
memset(pass, 0, sizeof(pass)); /* wipe pass after use */
@@ -1240,6 +1243,9 @@ int main(int argc, char *argv[])
case 'n':
not_found_is_ok = 1;
break;
+ case 'D':
+ conf.crypt.flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
+ break;
case 'd':
dodebug = 1;
break;