From: Lennart Poettering Date: Fri, 11 Oct 2024 11:33:44 +0000 (+0200) Subject: Merge pull request #34703 from poettering/pidref-varlink X-Git-Tag: v257-rc1~258 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fef1773c08dd8be116fa4d92c5c2a174432be60;p=thirdparty%2Fsystemd.git Merge pull request #34703 from poettering/pidref-varlink Serialize "PidRef" in a reasonable way in Varlink interfaces --- 1fef1773c08dd8be116fa4d92c5c2a174432be60 diff --cc src/shared/varlink-io.systemd.Machine.c index 3beab59e208,ce802491236..7b2bb4969fa --- a/src/shared/varlink-io.systemd.Machine.c +++ b/src/shared/varlink-io.systemd.Machine.c @@@ -3,15 -3,9 +3,16 @@@ #include "sd-varlink-idl.h" #include "bus-polkit.h" + #include "varlink-idl-common.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), @@@ -28,16 -22,10 +29,9 @@@ SD_VARLINK_DEFINE_INPUT(allocateUnit, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE), VARLINK_DEFINE_POLKIT_INPUT); - static SD_VARLINK_DEFINE_STRUCT_TYPE( - Timestamp, - SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_REALTIME clock (wallclock)"), - SD_VARLINK_DEFINE_FIELD(realtime, SD_VARLINK_INT, SD_VARLINK_NULLABLE), - SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_MONOTONIC clock"), - SD_VARLINK_DEFINE_FIELD(monotonic, SD_VARLINK_INT, SD_VARLINK_NULLABLE)); - 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,