core: change mount options settings so that last defined wins
Currently mount options are handled in such a way that the first definition for a given partition wins, and documented as such. Change them so that they behave like other options, and the last specified wins. Applies to RootImageOptions=, MountImages= and ExtensionImages=. Switch from a linked list to an array indexed by the partition specifier to store them.
This commit is contained in:
+16
-15
@@ -1167,13 +1167,10 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
fprintf(f, "%sRootImage: %s\n", prefix, c->root_image);
|
||||
|
||||
if (c->root_image_options) {
|
||||
fprintf(f, "%sRootImageOptions:", prefix);
|
||||
LIST_FOREACH(mount_options, o, c->root_image_options)
|
||||
if (!isempty(o->options))
|
||||
fprintf(f, " %s:%s",
|
||||
partition_designator_to_string(o->partition_designator),
|
||||
o->options);
|
||||
fprintf(f, "\n");
|
||||
_cleanup_free_ char *opts_str = NULL;
|
||||
|
||||
if (mount_options_to_string(c->root_image_options, &opts_str) >= 0 && !isempty(opts_str))
|
||||
fprintf(f, "%sRootImageOptions: %s\n", prefix, opts_str);
|
||||
}
|
||||
|
||||
if (iovec_is_set(&c->root_hash)) {
|
||||
@@ -1580,10 +1577,12 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
mount->ignore_enoent ? "-": "",
|
||||
mount->source,
|
||||
mount->destination);
|
||||
LIST_FOREACH(mount_options, o, mount->mount_options)
|
||||
fprintf(f, ":%s:%s",
|
||||
partition_designator_to_string(o->partition_designator),
|
||||
strempty(o->options));
|
||||
if (mount->mount_options) {
|
||||
_cleanup_free_ char *opts = NULL;
|
||||
|
||||
if (mount_options_to_string(mount->mount_options, &opts) >= 0 && !isempty(opts))
|
||||
fprintf(f, " %s", opts);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
@@ -1591,10 +1590,12 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
fprintf(f, "%sExtensionImages: %s%s", prefix,
|
||||
mount->ignore_enoent ? "-": "",
|
||||
mount->source);
|
||||
LIST_FOREACH(mount_options, o, mount->mount_options)
|
||||
fprintf(f, ":%s:%s",
|
||||
partition_designator_to_string(o->partition_designator),
|
||||
strempty(o->options));
|
||||
if (mount->mount_options) {
|
||||
_cleanup_free_ char *opts = NULL;
|
||||
|
||||
if (mount_options_to_string(mount->mount_options, &opts) >= 0 && !isempty(opts))
|
||||
fprintf(f, " %s", opts);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user