typedef struct UnitCondition {
char *name;
+ char *param;
bool trigger;
bool negate;
- char *param;
int tristate;
- LIST_FIELDS(struct UnitCondition, condition);
+ LIST_FIELDS(struct UnitCondition, conditions);
} UnitCondition;
static void unit_condition_free(UnitCondition *c) {
usec_t condition_timestamp;
bool condition_result;
- LIST_HEAD(UnitCondition, condition);
+ LIST_HEAD(UnitCondition, conditions);
usec_t assert_timestamp;
bool assert_result;
ansi_highlight_yellow(), ansi_normal(),
s2, s1 ? "; " : "", strempty(s1));
- LIST_FOREACH(condition, c, i->condition) {
+ LIST_FOREACH(conditions, c, i->conditions)
if (c->tristate < 0)
n++;
- }
-
- LIST_FOREACH(condition, c, i->condition) {
- if (c->tristate >= 0)
- continue;
- printf(" %s %s=%s%s%s was not met\n",
- --n ? special_glyph(TREE_BRANCH) : special_glyph(TREE_RIGHT),
- c->name,
- c->trigger ? "|" : "",
- c->negate ? "!" : "",
- c->param);
- }
+ LIST_FOREACH(conditions, c, i->conditions)
+ if (c->tristate < 0)
+ printf(" %s %s=%s%s%s was not met\n",
+ --n ? special_glyph(TREE_BRANCH) : special_glyph(TREE_RIGHT),
+ c->name,
+ c->trigger ? "|" : "",
+ c->negate ? "!" : "",
+ c->param);
}
if (!i->assert_result && i->assert_timestamp > 0) {
while ((r = sd_bus_message_read(m, "(sbbsi)", &cond, &trigger, &negate, ¶m, &state)) > 0) {
UnitCondition *c;
- log_debug("%s %d %d %s %d", cond, trigger, negate, param, state);
+ log_debug("%s trigger=%d negate=%d %s →%d", cond, trigger, negate, param, state);
c = new0(UnitCondition, 1);
if (!c)
c->negate = negate;
c->tristate = state;
- LIST_PREPEND(condition, i->condition, c);
+ LIST_PREPEND(conditions, i->conditions, c);
}
if (r < 0)
return bus_log_parse_error(r);
strv_free(info.dropin_paths);
strv_free(info.listen);
- while ((c = info.condition)) {
- LIST_REMOVE(condition, info.condition, c);
+ while ((c = info.conditions)) {
+ LIST_REMOVE(conditions, info.conditions, c);
unit_condition_free(c);
}