summaryrefslogtreecommitdiff
path: root/src/dissect/dissect.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-11 20:09:04 +0100
committerGitHub <noreply@github.com>2016-12-11 20:09:04 +0100
commit280b29ac84baee304c180fe64f820db56cd5b2b3 (patch)
treec38ba89f5f6f96f16892de6e72fed6820d56ee28 /src/dissect/dissect.c
parentcb8ac9646f2c5cf3c06b7c7538eaf64334e9a997 (diff)
parent0b6b2df80d5f7b394cd032967b8796d96a8d0fcf (diff)
Merge pull request #4861 from keszybz/dissect-tweaks
A prettification of the dissect code, mkosi and TODO updates
Diffstat (limited to 'src/dissect/dissect.c')
-rw-r--r--src/dissect/dissect.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index e3c96b7407..f2f1e135ec 100644
--- a/src/dissect/dissect.c
+++ b/src/dissect/dissect.c
@@ -95,21 +95,25 @@ static int parse_argv(int argc, char *argv[]) {
arg_flags |= DISSECT_IMAGE_READ_ONLY;
break;
- case ARG_DISCARD:
+ case ARG_DISCARD: {
+ DissectImageFlags flags;
+
if (streq(optarg, "disabled"))
- arg_flags &= ~(DISSECT_IMAGE_DISCARD_ON_LOOP|DISSECT_IMAGE_DISCARD|DISSECT_IMAGE_DISCARD_ON_CRYPTO);
+ flags = 0;
else if (streq(optarg, "loop"))
- arg_flags = (arg_flags & ~(DISSECT_IMAGE_DISCARD|DISSECT_IMAGE_DISCARD_ON_CRYPTO)) | DISSECT_IMAGE_DISCARD_ON_LOOP;
+ flags = DISSECT_IMAGE_DISCARD_ON_LOOP;
else if (streq(optarg, "all"))
- arg_flags = (arg_flags & ~(DISSECT_IMAGE_DISCARD_ON_CRYPTO)) | DISSECT_IMAGE_DISCARD_ON_LOOP | DISSECT_IMAGE_DISCARD;
+ flags = DISSECT_IMAGE_DISCARD_ON_LOOP | DISSECT_IMAGE_DISCARD;
else if (streq(optarg, "crypt"))
- arg_flags |= DISSECT_IMAGE_DISCARD_ON_LOOP | DISSECT_IMAGE_DISCARD | DISSECT_IMAGE_DISCARD_ON_CRYPTO;
+ flags = DISSECT_IMAGE_DISCARD_ANY;
else {
log_error("Unknown --discard= parameter: %s", optarg);
return -EINVAL;
}
+ arg_flags = (arg_flags & ~DISSECT_IMAGE_DISCARD_ANY) | flags;
break;
+ }
case ARG_ROOT_HASH: {
void *p;