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:
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user