summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-10 23:06:52 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 23:41:41 -0500
commita6dba97829e345772fae7c1d859e9fe0570ac42b (patch)
tree9454bcde6674fb1ba9ca5485e74d823a6f59638f /src
parentc5e04d51277994cca29234b33a6b8fc90a183cf3 (diff)
cryptsetup-generator: remove duplicated function
Diffstat (limited to 'src')
-rw-r--r--src/cryptsetup/cryptsetup-generator.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 3a866f36fc..3657890df4 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -30,6 +30,7 @@
#include "log.h"
#include "mkdir.h"
#include "path-util.h"
+#include "fstab-util.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
@@ -50,35 +51,6 @@ static Hashmap *arg_disks = NULL;
static char *arg_default_options = NULL;
static char *arg_default_keyfile = NULL;
-static bool has_option(const char *haystack, const char *needle) {
- const char *f = haystack;
- size_t l;
-
- assert(needle);
-
- if (!haystack)
- return false;
-
- l = strlen(needle);
-
- while ((f = strstr(f, needle))) {
-
- if (f > haystack && f[-1] != ',') {
- f++;
- continue;
- }
-
- if (f[l] != 0 && f[l] != ',') {
- f++;
- continue;
- }
-
- return true;
- }
-
- return false;
-}
-
static int create_disk(
const char *name,
const char *device,
@@ -95,10 +67,10 @@ static int create_disk(
assert(name);
assert(device);
- noauto = has_option(options, "noauto");
- nofail = has_option(options, "nofail");
- tmp = has_option(options, "tmp");
- swap = has_option(options, "swap");
+ noauto = fstab_test_option(options, "noauto\0");
+ nofail = fstab_test_option(options, "nofail\0");
+ tmp = fstab_test_option(options, "tmp\0");
+ swap = fstab_test_option(options, "swap\0");
if (tmp && swap) {
log_error("Device '%s' cannot be both 'tmp' and 'swap'. Ignoring.", name);