From: Luca Boccassi Date: Tue, 11 Oct 2022 17:53:59 +0000 (+0100) Subject: portable: rename flag PORTABLE_FORCE -> PORTABLE_FORCE_ATTACH X-Git-Tag: v252-rc2~54^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aad813bf170c7d901fcf1b664303e0204642ac61;p=thirdparty%2Fsystemd.git portable: rename flag PORTABLE_FORCE -> PORTABLE_FORCE_ATTACH The name is used only internally, also it was just added. Allows adding different types of force flags. --- diff --git a/man/org.freedesktop.portable1.xml b/man/org.freedesktop.portable1.xml index 0e926fe850f..0f68537233c 100644 --- a/man/org.freedesktop.portable1.xml +++ b/man/org.freedesktop.portable1.xml @@ -307,13 +307,13 @@ node /org/freedesktop/portable1 { The AttachImageWithExtensions(), DetachImageWithExtensions() and ReattachImageWithExtensions() methods take in options as flags instead of - booleans to allow for extendability. SD_SYSTEMD_PORTABLE_FORCE will cause + booleans to allow for extendability. SD_SYSTEMD_PORTABLE_FORCE_ATTACH will cause safety checks that ensure the units are not running while the new image is attached or detached to be skipped. They are defined as follows: -#define SD_SYSTEMD_PORTABLE_RUNTIME (UINT64_C(1) << 0) -#define SD_SYSTEMD_PORTABLE_FORCE (UINT64_C(1) << 1) +#define SD_SYSTEMD_PORTABLE_RUNTIME (UINT64_C(1) << 0) +#define SD_SYSTEMD_PORTABLE_FORCE_ATTACH (UINT64_C(1) << 1) diff --git a/src/portable/portable.c b/src/portable/portable.c index 7172701ca29..79bda5cf0bd 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -1357,7 +1357,7 @@ int portable_attach( if (r < 0) return r; - if (!FLAGS_SET(flags, PORTABLE_REATTACH) && !FLAGS_SET(flags, PORTABLE_FORCE)) + if (!FLAGS_SET(flags, PORTABLE_REATTACH) && !FLAGS_SET(flags, PORTABLE_FORCE_ATTACH)) HASHMAP_FOREACH(item, unit_files) { r = unit_file_exists(LOOKUP_SCOPE_SYSTEM, &paths, item->name); if (r < 0) @@ -1600,7 +1600,7 @@ int portable_detach( if (r == 0) continue; - if (!FLAGS_SET(flags, PORTABLE_REATTACH) && !FLAGS_SET(flags, PORTABLE_FORCE)) { + if (!FLAGS_SET(flags, PORTABLE_REATTACH) && !FLAGS_SET(flags, PORTABLE_FORCE_ATTACH)) { r = unit_file_is_active(bus, unit_name, error); if (r < 0) return r; diff --git a/src/portable/portable.h b/src/portable/portable.h index dc2f8781b77..30895b18f9b 100644 --- a/src/portable/portable.h +++ b/src/portable/portable.h @@ -22,11 +22,11 @@ typedef struct PortableMetadata { typedef enum PortableFlags { PORTABLE_RUNTIME = 1 << 0, /* Public API via DBUS, do not change */ - PORTABLE_FORCE = 1 << 1, /* Public API via DBUS, do not change */ + PORTABLE_FORCE_ATTACH = 1 << 1, /* Public API via DBUS, do not change */ PORTABLE_PREFER_COPY = 1 << 2, PORTABLE_PREFER_SYMLINK = 1 << 3, PORTABLE_REATTACH = 1 << 4, - _PORTABLE_MASK_PUBLIC = PORTABLE_RUNTIME | PORTABLE_FORCE, + _PORTABLE_MASK_PUBLIC = PORTABLE_RUNTIME | PORTABLE_FORCE_ATTACH, _PORTABLE_TYPE_MAX, _PORTABLE_TYPE_INVALID = -EINVAL, } PortableFlags; diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 7e3627d1daf..94a3970f87e 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -869,7 +869,7 @@ static int attach_reattach_image(int argc, char *argv[], const char *method) { return bus_log_create_error(r); if (STR_IN_SET(method, "AttachImageWithExtensions", "ReattachImageWithExtensions")) { - uint64_t flags = (arg_runtime ? PORTABLE_RUNTIME : 0) | (arg_force ? PORTABLE_FORCE : 0); + uint64_t flags = (arg_runtime ? PORTABLE_RUNTIME : 0) | (arg_force ? PORTABLE_FORCE_ATTACH : 0); r = sd_bus_message_append(m, "st", arg_copy_mode, flags); } else @@ -941,7 +941,7 @@ static int detach_image(int argc, char *argv[], void *userdata) { if (strv_isempty(arg_extension_images)) r = sd_bus_message_append(m, "b", arg_runtime); else { - uint64_t flags = (arg_runtime ? PORTABLE_RUNTIME : 0) | (arg_force ? PORTABLE_FORCE : 0); + uint64_t flags = (arg_runtime ? PORTABLE_RUNTIME : 0) | (arg_force ? PORTABLE_FORCE_ATTACH : 0); r = sd_bus_message_append(m, "t", flags); }