On Sat, Aug 12, 2017 at 04:41:23PM +0200, Richard Cochran wrote: > > Then after rtnl_link_status(fd, p->name, port_link_status, p); > > > > if (p->link_status == (LINK_UP | LINK_STATE_CHANGED)) > > return EV_FAULT_CLEARED; > > else if ((p->link_status == (LINK_DOWN | LINK_STATE_CHANGED)) || > > (p->link_status & TS_LABEL_CHANGED)) > > return EV_FAULT_DETECTED; > > else > > return EV_NONE; > > > > > > What do you think? > > Looks better to me, but why not place this code at the end of the > port_link_status() function?
Hmm... I saw your comments about let rtnl_link_status() return the EV_ value from port_link_status(). This seems no easy to handle. 1. We need to return both error code and enum fsm_event in rtnl_link_status(). 2. If We receive one rtnl message with multi RTM_NEWLINK info, the cb will be called more than once, then the return value will be replaced by new ones. for ( ; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len)) { if (cb) err = cb(ctx, link_up, slave_index); } return err; Thanks Hangbin ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel