shared/bus-unit-util: add helper for unit deps
This commit is contained in:
@@ -2271,6 +2271,13 @@ static int bus_try_append_condition(sd_bus_message *m, const char *field, const
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bus_try_append_unit_dependency(sd_bus_message *m, const char *field, const char *eq) {
|
||||
if (unit_dependency_from_string(field) < 0)
|
||||
return 0;
|
||||
|
||||
return bus_append_strv(m, field, eq);
|
||||
}
|
||||
|
||||
static int bus_append_cgroup_property(sd_bus_message *m, const char *field, const char *eq) {
|
||||
if (STR_IN_SET(field, "DevicePolicy",
|
||||
"Slice",
|
||||
@@ -2923,6 +2930,8 @@ static int bus_append_timer_property(sd_bus_message *m, const char *field, const
|
||||
}
|
||||
|
||||
static int bus_append_unit_property(sd_bus_message *m, const char *field, const char *eq) {
|
||||
int r;
|
||||
|
||||
if (STR_IN_SET(field, "Description",
|
||||
"SourcePath",
|
||||
"OnFailureJobMode",
|
||||
@@ -2956,13 +2965,16 @@ static int bus_append_unit_property(sd_bus_message *m, const char *field, const
|
||||
"FailureActionExitStatus"))
|
||||
return bus_append_action_exit_status(m, field, eq);
|
||||
|
||||
if (unit_dependency_from_string(field) >= 0 ||
|
||||
STR_IN_SET(field, "Documentation",
|
||||
if (STR_IN_SET(field, "Documentation",
|
||||
"RequiresMountsFor",
|
||||
"WantsMountsFor",
|
||||
"Markers"))
|
||||
return bus_append_strv(m, field, eq);
|
||||
|
||||
r = bus_try_append_unit_dependency(m, field, eq);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
return bus_try_append_condition(m, field, eq);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user