On Mon, Jul 03, 2017 at 04:24:30PM -0400, Rob Pierce wrote:
> ifstated monitors interface state and the return state of invoked commands,
> and takes action accordingly, all of which is managed with the help of a
> finite state machine. That makes for a lot of "state" references in the code.
> 
> The following diff renames variables to make a distinction between link status
> and command execution status (now referenced as "status"), and the various 
> states
> within the state machine (referred to as "state").
> 
> As an example of the current confusion, the link_states() function in parse.y
> actually links states within the finite state machine (as oppose to having
> anything to do with interface link states).
> 
> This diff helps to make my head hurt less.
> 
> For your consideration.
> 
> Regards,
> 
> Rob

Ok, that was overkill. I would be happy with the following diff instead.

Rob

Index: ifstated.c
===================================================================
RCS file: /cvs/src/usr.sbin/ifstated/ifstated.c,v
retrieving revision 1.49
diff -u -p -r1.49 ifstated.c
--- ifstated.c  3 Jul 2017 18:45:34 -0000       1.49
+++ ifstated.c  4 Jul 2017 11:31:08 -0000
@@ -64,7 +64,7 @@ void          check_external_status(struct ifsd_
 void           external_evtimer_setup(struct ifsd_state *, int);
 void           scan_ifstate(int, int, int);
 int            scan_ifstate_single(int, int, struct ifsd_state *);
-void           fetch_state(void);
+void           fetch_ifstate(void);
 __dead void    usage(void);
 void           adjust_expressions(struct ifsd_expression_list *, int);
 void           adjust_external_expressions(struct ifsd_state *);
@@ -208,7 +208,7 @@ load_config(void)
                clear_config(conf);
        conf = newconf;
        conf->initstate.entered = time(NULL);
-       fetch_state();
+       fetch_ifstate();
        external_evtimer_setup(&conf->initstate, IFSD_EVTIMER_ADD);
        adjust_external_expressions(&conf->initstate);
        eval_state(&conf->initstate);
@@ -597,7 +597,7 @@ do_action(struct ifsd_action *action)
  * Fetch the current link states.
  */
 void
-fetch_state(void)
+fetch_ifstate(void)
 {
        struct ifaddrs *ifap, *ifa;
        char *oname = NULL;

Reply via email to