X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fpath.c;h=7a871246adfb7cd6990190ae114abdcf04c36ee0;hp=91de56f34ce44b5eff881a9428eedff1df9a20dd;hb=8e12a6aed3d99ac8c140cd56b560f5efeb1c4e1a;hpb=69dd2852bb2c433b517d89792adb4461a4178aa1 diff --git a/src/path.c b/src/path.c index 91de56f34..7a871246a 100644 --- a/src/path.c +++ b/src/path.c @@ -1,4 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8 -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ /*** This file is part of systemd. @@ -36,7 +36,7 @@ static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = { [PATH_DEAD] = UNIT_INACTIVE, [PATH_WAITING] = UNIT_ACTIVE, [PATH_RUNNING] = UNIT_ACTIVE, - [PATH_MAINTENANCE] = UNIT_MAINTENANCE + [PATH_FAILED] = UNIT_FAILED }; static void path_done(Unit *u) { @@ -145,12 +145,10 @@ static int path_load(Unit *u) { static void path_dump(Unit *u, FILE *f, const char *prefix) { Path *p = PATH(u); - const char *prefix2; - char *p2; PathSpec *s; - p2 = strappend(prefix, "\t"); - prefix2 = p2 ? p2 : prefix; + assert(p); + assert(f); fprintf(f, "%sPath State: %s\n" @@ -164,8 +162,6 @@ static void path_dump(Unit *u, FILE *f, const char *prefix) { prefix, path_type_to_string(s->type), s->path); - - free(p2); } static void path_unwatch_one(Path *p, PathSpec *s) { @@ -305,7 +301,7 @@ static void path_enter_dead(Path *p, bool success) { if (!success) p->failure = true; - path_set_state(p, p->failure ? PATH_MAINTENANCE : PATH_DEAD); + path_set_state(p, p->failure ? PATH_FAILED : PATH_DEAD); } static void path_enter_running(Path *p) { @@ -387,7 +383,7 @@ static int path_start(Unit *u) { Path *p = PATH(u); assert(p); - assert(p->state == PATH_DEAD || p->state == PATH_MAINTENANCE); + assert(p->state == PATH_DEAD || p->state == PATH_FAILED); if (p->unit->meta.load_state != UNIT_LOADED) return -ENOENT; @@ -560,12 +556,12 @@ fail: log_error("Failed find path unit: %s", strerror(-r)); } -static void path_reset_maintenance(Unit *u) { +static void path_reset_failed(Unit *u) { Path *p = PATH(u); assert(p); - if (p->state == PATH_MAINTENANCE) + if (p->state == PATH_FAILED) path_set_state(p, PATH_DEAD); p->failure = false; @@ -575,7 +571,7 @@ static const char* const path_state_table[_PATH_STATE_MAX] = { [PATH_DEAD] = "dead", [PATH_WAITING] = "waiting", [PATH_RUNNING] = "running", - [PATH_MAINTENANCE] = "maintenance" + [PATH_FAILED] = "failed" }; DEFINE_STRING_TABLE_LOOKUP(path_state, PathState); @@ -609,7 +605,8 @@ const UnitVTable path_vtable = { .fd_event = path_fd_event, - .reset_maintenance = path_reset_maintenance, + .reset_failed = path_reset_failed, + .bus_interface = "org.freedesktop.systemd1.Path", .bus_message_handler = bus_path_message_handler };