Merge pull request #10982 from donaldsharp/enum_watchfrr

Enum watchfrr
This commit is contained in:
Donatas Abraitis 2022-04-08 14:58:36 +03:00 committed by GitHub
commit b4bdcf45d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,14 +70,14 @@ struct thread_master *master;
static bool watch_only = false;
const char *pathspace;
typedef enum {
enum restart_phase {
PHASE_NONE = 0,
PHASE_INIT,
PHASE_STOPS_PENDING,
PHASE_WAITING_DOWN,
PHASE_ZEBRA_RESTART_PENDING,
PHASE_WAITING_ZEBRA_UP
} restart_phase_t;
};
static const char *const phase_str[] = {
"Idle",
@ -103,7 +103,7 @@ struct restart_info {
};
static struct global_state {
restart_phase_t phase;
enum restart_phase phase;
struct thread *t_phase_hanging;
struct thread *t_startup_timeout;
const char *vtydir;
@ -136,13 +136,13 @@ static struct global_state {
.stop_command = DEFAULT_STOP_CMD,
};
typedef enum {
enum daemon_state {
DAEMON_INIT,
DAEMON_DOWN,
DAEMON_CONNECTING,
DAEMON_UP,
DAEMON_UNRESPONSIVE
} daemon_state_t;
};
#define IS_UP(DMN) \
(((DMN)->state == DAEMON_UP) || ((DMN)->state == DAEMON_UNRESPONSIVE))
@ -153,7 +153,7 @@ static const char *const state_str[] = {
struct daemon {
const char *name;
daemon_state_t state;
enum daemon_state state;
int fd;
struct timeval echo_sent;
unsigned int connect_tries;
@ -848,7 +848,7 @@ static void phase_hanging(struct thread *t_hanging)
gs.phase = PHASE_NONE;
}
static void set_phase(restart_phase_t new_phase)
static void set_phase(enum restart_phase new_phase)
{
gs.phase = new_phase;
thread_cancel(&gs.t_phase_hanging);