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 09388a6b9e (thanks!).
This commit is contained in:
Michael Vogt
2026-02-20 18:01:08 +01:00
committed by Mike Yuan
parent 699007a44f
commit 8471eca549
2 changed files with 2 additions and 4 deletions
+1 -3
View 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,
+1 -1
View 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),