From 5cdb5c17d331cd3656d99d92a15cbc705e95f25d Mon Sep 17 00:00:00 2001 From: Ivan Kruglov Date: Tue, 8 Oct 2024 18:50:47 +0200 Subject: [PATCH] machine: complete description of io.systemd.Machine.{List, Terminate, Kill, Unregister} methods --- src/shared/varlink-io.systemd.Machine.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/shared/varlink-io.systemd.Machine.c b/src/shared/varlink-io.systemd.Machine.c index 17e0d79ec49..3beab59e208 100644 --- a/src/shared/varlink-io.systemd.Machine.c +++ b/src/shared/varlink-io.systemd.Machine.c @@ -5,6 +5,13 @@ #include "bus-polkit.h" #include "varlink-io.systemd.Machine.h" +#define VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS \ + SD_VARLINK_FIELD_COMMENT("If non-null the name of a machine."), \ + SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), \ + SD_VARLINK_FIELD_COMMENT("If non-null the PID of a machine. Special value 0 means to take pid of the machine the caller is part of."), \ + SD_VARLINK_DEFINE_INPUT(pid, SD_VARLINK_INT, SD_VARLINK_NULLABLE), \ + VARLINK_DEFINE_POLKIT_INPUT + static SD_VARLINK_DEFINE_METHOD( Register, SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0), @@ -30,18 +37,15 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE( static SD_VARLINK_DEFINE_METHOD( Unregister, - SD_VARLINK_FIELD_COMMENT("The name of a machine to unregister."), - SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0)); + VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS); static SD_VARLINK_DEFINE_METHOD( Terminate, - SD_VARLINK_FIELD_COMMENT("The name of a machine to terminate."), - SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0)); + VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS); static SD_VARLINK_DEFINE_METHOD( Kill, - SD_VARLINK_FIELD_COMMENT("The name of a machine to send signal to."), - SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0), + VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS, SD_VARLINK_FIELD_COMMENT("Identifier that specifies what precisely to send the signal to (either 'leader' or 'all')."), SD_VARLINK_DEFINE_INPUT(whom, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), SD_VARLINK_FIELD_COMMENT("Numeric UNIX signal integer."), @@ -50,10 +54,7 @@ static SD_VARLINK_DEFINE_METHOD( static SD_VARLINK_DEFINE_METHOD_FULL( List, SD_VARLINK_SUPPORTS_MORE, - SD_VARLINK_FIELD_COMMENT("If non-null the name of a running machine to report details on. If both 'name' and 'pid' are null/unspecified enumerates all running machines."), - SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), - SD_VARLINK_FIELD_COMMENT("If non-null the PID of a running machine to report details on."), - SD_VARLINK_DEFINE_INPUT(pid, SD_VARLINK_INT, SD_VARLINK_NULLABLE), + VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS, SD_VARLINK_FIELD_COMMENT("Name of the machine"), SD_VARLINK_DEFINE_OUTPUT(name, SD_VARLINK_STRING, 0), SD_VARLINK_FIELD_COMMENT("128bit ID identifying this machine, formatted in hexadecimal"), -- 2.47.3