Add a method to remove a port from the clock's polling array.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-03-21 13:08:09 +01:00
parent 2ff091b14b
commit 39b10a5a16
2 changed files with 22 additions and 0 deletions

14
clock.c
View File

@ -368,6 +368,20 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx,
pr_debug("path delay %10lld %10lld", c->path_delay, pd);
}
void clock_remove_fda(struct clock *c, struct port *p, struct fdarray fda)
{
int i, j, k;
for (i = 0; i < c->nports; i++) {
if (p == c->port[i])
break;
}
for (j = 0; j < fda.cnt; j++) {
k = N_POLLFD * i + j;
c->pollfd[k].fd = -1;
c->pollfd[k].events = 0;
}
}
int clock_slave_only(struct clock *c)
{
return c->dds.slaveOnly;

View File

@ -135,6 +135,14 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx,
*/
int clock_poll(struct clock *c);
/**
* Remove a port's file descriptor array from its controlling clock.
* @param c The clock instance.
* @param p The port removing the array.
* @param fda The port's file decriptor array.
*/
void clock_remove_fda(struct clock *c, struct port *p, struct fdarray fda);
/**
* Obtain the slave-only flag from a clock's default data set.
* @param c The clock instance.