From: Michael Vogt Date: Fri, 20 Feb 2026 10:20:02 +0000 (+0100) Subject: machine: switch CleanPool to SD_VARLINK_REQUIRES_MORE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8471eca549b2d4a27a0ddac9516748fbbfd52630;p=thirdparty%2Fsystemd.git machine: switch CleanPool to SD_VARLINK_REQUIRES_MORE 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!). --- diff --git a/src/machine/image-varlink.c b/src/machine/image-varlink.c index bf9826c6812..e82f474bc64 100644 --- a/src/machine/image-varlink.c +++ b/src/machine/image-varlink.c @@ -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, diff --git a/src/shared/varlink-io.systemd.MachineImage.c b/src/shared/varlink-io.systemd.MachineImage.c index 00acdc1cfc8..2642852e034 100644 --- a/src/shared/varlink-io.systemd.MachineImage.c +++ b/src/shared/varlink-io.systemd.MachineImage.c @@ -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),