cryptsetup: add helper for mangling "none" option strings

let's unify some code here, and let's do so in cryptsetup-util.h so that
we can later reuse this in integritysetup/veritysetup
This commit is contained in:
Lennart Poettering
2022-03-31 11:24:01 +02:00
parent dcbc38c916
commit 2fabbad898
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -86,3 +86,8 @@ static inline void sym_crypt_free(struct crypt_device* cd) {}
static inline void sym_crypt_freep(struct crypt_device** cd) {}
#endif
static inline const char *mangle_none(const char *s) {
/* A helper that turns cryptsetup/integritysetup/veritysetup "options" strings into NULL if they are effectively empty */
return isempty(s) || STR_IN_SET(s, "-", "none") ? NULL : s;
}