return flags;
}
-static char* subvolume_flags_to_string(SubvolumeFlags flags) {
- const char *l[CONST_LOG2U(_SUBVOLUME_FLAGS_MASK + 1) + 1]; /* one string per known flag at most */
- size_t m = 0;
-
- if (FLAGS_SET(flags, SUBVOLUME_RO))
- l[m++] = "ro";
-
- assert(m < ELEMENTSOF(l));
- l[m] = NULL;
-
- return strv_join((char**) l, ",");
-}
-
typedef struct Subvolume {
char *path;
SubvolumeFlags flags;
assert(l);
ORDERED_HASHMAP_FOREACH(subvolume, subvolumes) {
- _cleanup_free_ char *s = NULL, *f = NULL;
-
- s = strdup(subvolume->path);
- if (!s)
- return log_oom();
+ _cleanup_free_ char *s = NULL;
- f = subvolume_flags_to_string(subvolume->flags);
- if (!f)
+ if (streq_ptr(subvolume->path, default_subvolume) && !strextend(&s, "default"))
return log_oom();
- if (streq_ptr(subvolume->path, default_subvolume) &&
- !strextend_with_separator(&f, ",", "default"))
+ if (FLAGS_SET(subvolume->flags, SUBVOLUME_RO) && !strextend_with_separator(&s, "-", "ro"))
return log_oom();
- if (!isempty(f) && !strextend_with_separator(&s, ":", f))
+ if (!strextend_with_separator(&s, ":", subvolume->path))
return log_oom();
r = strv_extend_many(l, "--subvol", s);