Skip to content

Commit

Permalink
Add a method to remove a port from the clock's polling array.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Mar 21, 2012
1 parent 2ff091b commit 39b10a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 39b10a5

Please sign in to comment.