summaryrefslogtreecommitdiffstats
path: root/src/home
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-05-05 15:12:55 +0200
committerLennart Poettering <lennart@poettering.net>2020-05-07 16:13:07 +0200
commitcba116991d79937c74330602c6bfe13e320dbc5d (patch)
tree322f00f0daf97af336579d7f97196885e4d3af24 /src/home
parentuser-record: add new field for requesting LUKS discard on logout (diff)
downloadsystemd-cba116991d79937c74330602c6bfe13e320dbc5d.tar.xz
systemd-cba116991d79937c74330602c6bfe13e320dbc5d.zip
homectl: add option for controlling new luksOfflineDiscard user record field
Diffstat (limited to 'src/home')
-rw-r--r--src/home/homectl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/home/homectl.c b/src/home/homectl.c
index c98bf8b540..168a7c19c1 100644
--- a/src/home/homectl.c
+++ b/src/home/homectl.c
@@ -2232,6 +2232,9 @@ static int help(int argc, char *argv[], void *userdata) {
" --fs-type=TYPE File system type to use in case of luks\n"
" storage (ext4, xfs, btrfs)\n"
" --luks-discard=BOOL Whether to use 'discard' feature of file system\n"
+ " when activated (mounted)\n"
+ " --luks-offline-discard=BOOL\n"
+ " Whether to trim file on logout\n"
" --luks-cipher=CIPHER Cipher to use for LUKS encryption\n"
" --luks-cipher-mode=MODE Cipher mode to use for LUKS encryption\n"
" --luks-volume-key-size=BITS\n"
@@ -2285,6 +2288,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_IMAGE_PATH,
ARG_UMASK,
ARG_LUKS_DISCARD,
+ ARG_LUKS_OFFLINE_DISCARD,
ARG_JSON,
ARG_SETENV,
ARG_TIMEZONE,
@@ -2378,6 +2382,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "image-path", required_argument, NULL, ARG_IMAGE_PATH },
{ "fs-type", required_argument, NULL, ARG_FS_TYPE },
{ "luks-discard", required_argument, NULL, ARG_LUKS_DISCARD },
+ { "luks-offline-discard", required_argument, NULL, ARG_LUKS_OFFLINE_DISCARD },
{ "luks-cipher", required_argument, NULL, ARG_LUKS_CIPHER },
{ "luks-cipher-mode", required_argument, NULL, ARG_LUKS_CIPHER_MODE },
{ "luks-volume-key-size", required_argument, NULL, ARG_LUKS_VOLUME_KEY_SIZE },
@@ -2947,6 +2952,25 @@ static int parse_argv(int argc, char *argv[]) {
break;
+ case ARG_LUKS_OFFLINE_DISCARD:
+ if (isempty(optarg)) {
+ r = drop_from_identity("luksOfflineDiscard");
+ if (r < 0)
+ return r;
+
+ break;
+ }
+
+ r = parse_boolean(optarg);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse --luks-offline-discard= parameter: %s", optarg);
+
+ r = json_variant_set_field_boolean(&arg_identity_extra, "luksOfflineDiscard", r);
+ if (r < 0)
+ return log_error_errno(r, "Failed to set offline discard field: %m");
+
+ break;
+
case ARG_LUKS_VOLUME_KEY_SIZE:
case ARG_LUKS_PBKDF_PARALLEL_THREADS:
case ARG_RATE_LIMIT_BURST: {