core/varlink-manager: move varlink_unit_queue_job_one() to varlink-unit

It's quite likely that we'll introduce StartUnit() and alike
for varlink in the future, so the job enqueuing interface
should be generic. On top of that, the errors really belong
to Unit rather than Manager.
This commit is contained in:
Mike Yuan
2026-01-24 00:48:02 +01:00
parent 339fa01d21
commit 7228da61b9
6 changed files with 69 additions and 60 deletions
-8
View File
@@ -188,10 +188,6 @@ static SD_VARLINK_DEFINE_METHOD(
static SD_VARLINK_DEFINE_ERROR(RateLimitReached);
static SD_VARLINK_DEFINE_ERROR(OnlyByDependency);
static SD_VARLINK_DEFINE_ERROR(BusShuttingDown);
SD_VARLINK_DEFINE_INTERFACE(
io_systemd_Manager,
"io.systemd.Manager",
@@ -203,10 +199,6 @@ SD_VARLINK_DEFINE_INTERFACE(
SD_VARLINK_SYMBOL_COMMENT("Enqueue all marked jobs"),
&vl_method_EnqueueMarkedJobs,
&vl_error_RateLimitReached,
SD_VARLINK_SYMBOL_COMMENT("Unit operation may be requested by dependency only"),
&vl_error_OnlyByDependency,
SD_VARLINK_SYMBOL_COMMENT("Operation refused, the bus is shutting down"),
&vl_error_BusShuttingDown,
&vl_type_ManagerContext,
&vl_type_ManagerRuntime,
&vl_type_Timestamp,
+12 -5
View File
@@ -1003,10 +1003,6 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
SD_VARLINK_FIELD_COMMENT("The cgroup runtime of the unit"),
SD_VARLINK_DEFINE_FIELD_BY_TYPE(CGroup, CGroupRuntime, SD_VARLINK_NULLABLE));
static SD_VARLINK_DEFINE_ERROR(
NoSuchUnit,
SD_VARLINK_DEFINE_FIELD(parameter, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
static SD_VARLINK_DEFINE_METHOD_FULL(
List,
SD_VARLINK_SUPPORTS_MORE,
@@ -1023,6 +1019,13 @@ static SD_VARLINK_DEFINE_METHOD_FULL(
SD_VARLINK_FIELD_COMMENT("Runtime information of the unit"),
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(runtime, UnitRuntime, 0));
static SD_VARLINK_DEFINE_ERROR(
NoSuchUnit,
SD_VARLINK_DEFINE_FIELD(parameter, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
static SD_VARLINK_DEFINE_ERROR(OnlyByDependency);
static SD_VARLINK_DEFINE_ERROR(DBusShuttingDown);
SD_VARLINK_DEFINE_INTERFACE(
io_systemd_Unit,
"io.systemd.Unit",
@@ -1087,4 +1090,8 @@ SD_VARLINK_DEFINE_INTERFACE(
/* Errors */
SD_VARLINK_SYMBOL_COMMENT("No matching unit found"),
&vl_error_NoSuchUnit);
&vl_error_NoSuchUnit,
SD_VARLINK_SYMBOL_COMMENT("Job for the unit may only be enqueued by dependencies"),
&vl_error_OnlyByDependency,
SD_VARLINK_SYMBOL_COMMENT("A unit that requires D-Bus cannot be started as D-Bus is shutting down"),
&vl_error_DBusShuttingDown);