]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
portable: rename flag PORTABLE_FORCE -> PORTABLE_FORCE_ATTACH
authorLuca Boccassi <bluca@debian.org>
Tue, 11 Oct 2022 17:53:59 +0000 (18:53 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 12 Oct 2022 08:57:24 +0000 (09:57 +0100)
The name is used only internally, also it was just added.
Allows adding different types of force flags.

man/org.freedesktop.portable1.xml
src/portable/portable.c
src/portable/portable.h
src/portable/portablectl.c

index 0e926fe850fabff81fe250cb72a227fbe254776d..0f68537233c8d75c6fdb482248b3c1242a2e45ac 100644 (file)
@@ -307,13 +307,13 @@ node /org/freedesktop/portable1 {
       <para>The <function>AttachImageWithExtensions()</function>,
       <function>DetachImageWithExtensions()</function> and
       <function>ReattachImageWithExtensions()</function> methods take in options as flags instead of
-      booleans to allow for extendability. <varname>SD_SYSTEMD_PORTABLE_FORCE</varname> will cause
+      booleans to allow for extendability. <varname>SD_SYSTEMD_PORTABLE_FORCE_ATTACH</varname> 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:</para>
 
       <programlisting>
-#define SD_SYSTEMD_PORTABLE_RUNTIME  (UINT64_C(1) &lt;&lt; 0)
-#define SD_SYSTEMD_PORTABLE_FORCE    (UINT64_C(1) &lt;&lt; 1)
+#define SD_SYSTEMD_PORTABLE_RUNTIME         (UINT64_C(1) &lt;&lt; 0)
+#define SD_SYSTEMD_PORTABLE_FORCE_ATTACH    (UINT64_C(1) &lt;&lt; 1)
       </programlisting>
     </refsect2>
 
index 7172701ca29a4aa1095702b1a0bd15be149a089e..79bda5cf0bd2a7c6da177d13cfa39f38a80e809e 100644 (file)
@@ -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;
index dc2f8781b7728e467d3d3d8a5564cb7d61c17390..30895b18f9b4c2028ffacae801f2cfca606affbe 100644 (file)
@@ -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;
index 7e3627d1dafebf3bf6a183d11592a03bd90e276d..94a3970f87e1515d1c829764929626ead622ee44 100644 (file)
@@ -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);
         }