clock: keep ports in specified order.
When adding a new port, put it at the end of the list instead of head.
This restores the order of received management messages as was before
commit 08575133
.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
parent
594f59c50d
commit
50d5c63e16
7
clock.c
7
clock.c
|
@ -756,7 +756,7 @@ static int clock_add_port(struct clock *c, int phc_index,
|
|||
enum timestamp_type timestamping,
|
||||
struct interface *iface)
|
||||
{
|
||||
struct port *p;
|
||||
struct port *p, *piter, *lastp = NULL;
|
||||
|
||||
if (clock_resize_pollfd(c, c->nports + 1))
|
||||
return -1;
|
||||
|
@ -766,6 +766,11 @@ static int clock_add_port(struct clock *c, int phc_index,
|
|||
/* No need to shrink pollfd */
|
||||
return -1;
|
||||
}
|
||||
LIST_FOREACH(piter, &c->ports, list)
|
||||
lastp = piter;
|
||||
if (lastp)
|
||||
LIST_INSERT_AFTER(lastp, p, list);
|
||||
else
|
||||
LIST_INSERT_HEAD(&c->ports, p, list);
|
||||
c->nports++;
|
||||
clock_fda_changed(c);
|
||||
|
|
Loading…
Reference in New Issue