summaryrefslogtreecommitdiffstats
path: root/libmount/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmount/src/utils.c')
-rw-r--r--libmount/src/utils.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 29f259ffe..7e028ee02 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -430,98 +430,6 @@ int mnt_match_fstype(const char *type, const char *pattern)
return match_fstype(type, pattern);
}
-
-/* Returns 1 if needle found or noneedle not found in haystack
- * Otherwise returns 0
- */
-static int check_option(const char *haystack, size_t len,
- const char *needle, size_t needle_len)
-{
- const char *p;
- int no = 0;
-
- if (needle_len >= 1 && *needle == '+') {
- needle++;
- needle_len--;
- } else if (needle_len >= 2 && !strncmp(needle, "no", 2)) {
- no = 1;
- needle += 2;
- needle_len -= 2;
- }
-
- for (p = haystack; p && p < haystack + len; p++) {
- char *sep = strchr(p, ',');
- size_t plen = sep ? (size_t) (sep - p) :
- len - (p - haystack);
-
- if (plen == needle_len && !strncmp(p, needle, plen))
- return !no; /* foo or nofoo was found */
- p += plen;
- }
-
- return no; /* foo or nofoo was not found */
-}
-
-/**
- * mnt_match_options:
- * @optstr: options string
- * @pattern: comma delimited list of options
- *
- * The "no" could be used for individual items in the @options list. The "no"
- * prefix does not have a global meaning.
- *
- * Unlike fs type matching, nonetdev,user and nonetdev,nouser have
- * DIFFERENT meanings; each option is matched explicitly as specified.
- *
- * The "no" prefix interpretation could be disabled by the "+" prefix, for example
- * "+noauto" matches if @optstr literally contains the "noauto" string.
- *
- * "xxx,yyy,zzz" : "nozzz" -> False
- *
- * "xxx,yyy,zzz" : "xxx,noeee" -> True
- *
- * "bar,zzz" : "nofoo" -> True
- *
- * "nofoo,bar" : "+nofoo" -> True
- *
- * "bar,zzz" : "+nofoo" -> False
- *
- *
- * Returns: 1 if pattern is matching, else 0. This function also returns 0
- * if @pattern is NULL and @optstr is non-NULL.
- */
-int mnt_match_options(const char *optstr, const char *pattern)
-{
- const char *p;
- size_t len, optstr_len = 0;
-
- if (!pattern && !optstr)
- return 1;
- if (!pattern)
- return 0;
-
- len = strlen(pattern);
- if (optstr)
- optstr_len = strlen(optstr);
-
- for (p = pattern; p < pattern + len; p++) {
- char *sep = strchr(p, ',');
- size_t plen = sep ? (size_t) (sep - p) :
- len - (p - pattern);
-
- if (!plen)
- continue; /* if two ',' appear in a row */
-
- if (!check_option(optstr, optstr_len, p, plen))
- return 0; /* any match failure means failure */
-
- p += plen;
- }
-
- /* no match failures in list means success */
- return 1;
-}
-
void mnt_free_filesystems(char **filesystems)
{
char **p;