Second diff to rename additional "always" variable in struct ifsd_config.
authorbenno <benno@openbsd.org>
Sun, 2 Jul 2017 15:28:26 +0000 (15:28 +0000)
committerbenno <benno@openbsd.org>
Sun, 2 Jul 2017 15:28:26 +0000 (15:28 +0000)
from Rob Pierce.
Requested by stsp@

usr.sbin/ifstated/ifstated.c
usr.sbin/ifstated/ifstated.h
usr.sbin/ifstated/parse.y

index 9cc672b..b87bdd1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ifstated.c,v 1.47 2017/07/02 14:28:45 benno Exp $     */
+/*     $OpenBSD: ifstated.c,v 1.48 2017/07/02 15:28:26 benno Exp $     */
 
 /*
  * Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
@@ -207,11 +207,11 @@ load_config(void)
        if (conf != NULL)
                clear_config(conf);
        conf = newconf;
-       conf->always.entered = time(NULL);
+       conf->initstate.entered = time(NULL);
        fetch_state();
-       external_evtimer_setup(&conf->always, IFSD_EVTIMER_ADD);
-       adjust_external_expressions(&conf->always);
-       eval_state(&conf->always);
+       external_evtimer_setup(&conf->initstate, IFSD_EVTIMER_ADD);
+       adjust_external_expressions(&conf->initstate);
+       eval_state(&conf->initstate);
        if (conf->curstate != NULL) {
                log_info("initial state: %s", conf->curstate->name);
                conf->curstate->entered = time(NULL);
@@ -250,7 +250,7 @@ rt_msg_handler(int fd, short event, void *arg)
 void
 sigchld_handler(int fd, short event, void *arg)
 {
-       check_external_status(&conf->always);
+       check_external_status(&conf->initstate);
        if (conf->curstate != NULL)
                check_external_status(conf->curstate);
 }
@@ -463,8 +463,8 @@ scan_ifstate(int ifindex, int s, int do_eval)
        struct ifsd_state *state;
        int cur_eval = 0;
 
-       if (scan_ifstate_single(ifindex, s, &conf->always) && do_eval)
-               eval_state(&conf->always);
+       if (scan_ifstate_single(ifindex, s, &conf->initstate) && do_eval)
+               eval_state(&conf->initstate);
        TAILQ_FOREACH(state, &conf->states, entries) {
                if (scan_ifstate_single(ifindex, s, state) &&
                    (do_eval && state == conf->curstate))
@@ -635,7 +635,7 @@ clear_config(struct ifsd_config *oconf)
 {
        struct ifsd_state *state;
 
-       external_evtimer_setup(&conf->always, IFSD_EVTIMER_DEL);
+       external_evtimer_setup(&conf->initstate, IFSD_EVTIMER_DEL);
        if (conf != NULL && conf->curstate != NULL)
                external_evtimer_setup(conf->curstate, IFSD_EVTIMER_DEL);
        while ((state = TAILQ_FIRST(&oconf->states)) != NULL) {
@@ -645,8 +645,8 @@ clear_config(struct ifsd_config *oconf)
                free(state->name);
                free(state);
        }
-       remove_action(oconf->always.init, &oconf->always);
-       remove_action(oconf->always.body, &oconf->always);
+       remove_action(oconf->initstate.init, &oconf->initstate);
+       remove_action(oconf->initstate.body, &oconf->initstate);
        free(oconf);
 }
 
index cd7020c..24c9e3c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ifstated.h,v 1.14 2017/07/02 14:30:35 benno Exp $     */
+/*     $OpenBSD: ifstated.h,v 1.15 2017/07/02 15:28:26 benno Exp $     */
 
 /*
  * Copyright (c) 2004 Ryan McBride
@@ -117,7 +117,7 @@ struct ifsd_state {
 TAILQ_HEAD(ifsd_state_list, ifsd_state);
 
 struct ifsd_config {
-       struct ifsd_state                always;
+       struct ifsd_state                initstate;
        struct ifsd_state_list           states;
        struct ifsd_state               *curstate;
        struct ifsd_state               *nextstate;
index e90b450..a321001 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.42 2017/07/02 14:27:30 benno Exp $        */
+/*     $OpenBSD: parse.y,v 1.43 2017/07/02 15:28:26 benno Exp $        */
 
 /*
  * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org>
@@ -242,12 +242,12 @@ init              : INIT {
                        if (curstate != NULL)
                                curaction = curstate->init;
                        else
-                               curaction = conf->always.init;
+                               curaction = conf->initstate.init;
                } action_block {
                        if (curstate != NULL)
                                curaction = curstate->body;
                        else
-                               curaction = conf->always.body;
+                               curaction = conf->initstate.body;
                }
                ;
 
@@ -343,7 +343,7 @@ state               : STATE string {
                } optnl '{' optnl stateopts_l '}' {
                        TAILQ_INSERT_TAIL(&conf->states, curstate, entries);
                        curstate = NULL;
-                       curaction = conf->always.body;
+                       curaction = conf->initstate.body;
                }
                ;
 
@@ -746,8 +746,8 @@ parse_config(char *filename, int opts)
 
        TAILQ_INIT(&conf->states);
 
-       init_state(&conf->always);
-       curaction = conf->always.body;
+       init_state(&conf->initstate);
+       curaction = conf->initstate.body;
        conf->opts = opts;
 
        yyparse();
@@ -943,7 +943,7 @@ new_ifstate(u_short ifindex, int s)
        if (curstate != NULL)
                state = curstate;
        else
-               state = &conf->always;
+               state = &conf->initstate;
 
        TAILQ_FOREACH(ifstate, &state->interface_states, entries)
                if (ifstate->ifindex == ifindex && ifstate->ifstate == s)
@@ -970,7 +970,7 @@ new_external(char *command, u_int32_t frequency)
        if (curstate != NULL)
                state = curstate;
        else
-               state = &conf->always;
+               state = &conf->initstate;
 
        TAILQ_FOREACH(external, &state->external_tests, entries)
                if (strcmp(external->command, command) == 0 &&