]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine: switch CleanPool to SD_VARLINK_REQUIRES_MORE
authorMichael Vogt <michael@amutable.com>
Fri, 20 Feb 2026 10:20:02 +0000 (11:20 +0100)
committerMike Yuan <me@yhndnzj.com>
Fri, 20 Feb 2026 17:01:08 +0000 (18:01 +0100)
The CleanPool requires --more to be set and checks that in
`vl_method_clean_pool`. By switching to SD_VARLINK_REQUIRES_MORE
this will automatically be handled and is more clear to
the varlink users.

Based on the comment from Lennart in
https://github.com/systemd/systemd/pull/40650#discussion_r2832378002
and the work done by Mike in 09388a6b9e4 (thanks!).

src/machine/image-varlink.c
src/shared/varlink-io.systemd.MachineImage.c

index bf9826c6812b4d2eb0f6e950ff65bcf232436d2e..e82f474bc649fbe6a0f59857ba1717cf66581134 100644 (file)
@@ -392,6 +392,7 @@ int vl_method_clean_pool(sd_varlink *link, sd_json_variant *parameters, sd_varli
 
         assert(link);
         assert(parameters);
+        assert(FLAGS_SET(flags, SD_VARLINK_METHOD_MORE));
 
         if (manager->n_operations >= OPERATIONS_MAX)
                 return sd_varlink_error(link, "io.systemd.MachineImage.TooManyOperations", NULL);
@@ -400,9 +401,6 @@ int vl_method_clean_pool(sd_varlink *link, sd_json_variant *parameters, sd_varli
         if (r != 0)
                 return r;
 
-        if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
-                return sd_varlink_error(link, SD_VARLINK_ERROR_EXPECTED_MORE, NULL);
-
         if (manager->runtime_scope != RUNTIME_SCOPE_USER) {
                 r = varlink_verify_polkit_async(
                                 link,
index 00acdc1cfc81e2b748f47243138422eb5034f293..2642852e03496da1cfda2362943fed858092f4e7 100644 (file)
@@ -95,7 +95,7 @@ static SD_VARLINK_DEFINE_ENUM_TYPE(
 
 static SD_VARLINK_DEFINE_METHOD_FULL(
                 CleanPool,
-                SD_VARLINK_SUPPORTS_MORE,
+                SD_VARLINK_REQUIRES_MORE,
                 VARLINK_DEFINE_POLKIT_INPUT,
                 SD_VARLINK_FIELD_COMMENT("Allows removing all or only hidden images"),
                 SD_VARLINK_DEFINE_INPUT_BY_TYPE(mode, CleanPoolMode, 0),