Skip to content

Commit

Permalink
libknet: rename pipefd to dstpipefd
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Nov 8, 2012
1 parent b3b9b66 commit da577b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libknet/common.c
Expand Up @@ -47,7 +47,7 @@ int _dst_cache_update(knet_handle_t knet_h, uint16_t node_id)
int write_retry = 0;

try_again:
if (write(knet_h->pipefd[1], &node_id, sizeof(node_id)) != sizeof(node_id)) {
if (write(knet_h->dstpipefd[1], &node_id, sizeof(node_id)) != sizeof(node_id)) {
if ((write_retry < 10) && ((errno = EAGAIN) || (errno = EWOULDBLOCK))) {
write_retry++;
goto try_again;
Expand Down
24 changes: 12 additions & 12 deletions libknet/handle.c
Expand Up @@ -54,15 +54,15 @@ knet_handle_t knet_handle_new(const struct knet_handle_cfg *knet_handle_cfg)
}
}

if (pipe(knet_h->pipefd)) {
if (pipe(knet_h->dstpipefd)) {
log_err(knet_h, KNET_SUB_HANDLE, "Unable to initialize internal comm pipe");
goto exit_fail1;
}

if ((_fdset_cloexec(knet_h->pipefd[0])) ||
(_fdset_cloexec(knet_h->pipefd[1])) ||
(_fdset_nonblock(knet_h->pipefd[0])) ||
(_fdset_nonblock(knet_h->pipefd[1]))) {
if ((_fdset_cloexec(knet_h->dstpipefd[0])) ||
(_fdset_cloexec(knet_h->dstpipefd[1])) ||
(_fdset_nonblock(knet_h->dstpipefd[0])) ||
(_fdset_nonblock(knet_h->dstpipefd[1]))) {
log_err(knet_h, KNET_SUB_HANDLE, "Unable to set internal comm pipe sockopts");
goto exit_fail2;
}
Expand Down Expand Up @@ -133,10 +133,10 @@ knet_handle_t knet_handle_new(const struct knet_handle_cfg *knet_handle_cfg)
memset(&ev, 0, sizeof(struct epoll_event));

ev.events = EPOLLIN;
ev.data.fd = knet_h->pipefd[0];
ev.data.fd = knet_h->dstpipefd[0];

if (epoll_ctl(knet_h->dst_link_handler_epollfd,
EPOLL_CTL_ADD, knet_h->pipefd[0], &ev) != 0) {
EPOLL_CTL_ADD, knet_h->dstpipefd[0], &ev) != 0) {
log_err(knet_h, KNET_SUB_HANDLE, "Unable to add pipefd to epoll pool");
goto exit_fail6;
}
Expand Down Expand Up @@ -196,8 +196,8 @@ knet_handle_t knet_handle_new(const struct knet_handle_cfg *knet_handle_cfg)
free(knet_h->tap_to_links_buf);

exit_fail2:
close(knet_h->pipefd[0]);
close(knet_h->pipefd[1]);
close(knet_h->dstpipefd[0]);
close(knet_h->dstpipefd[1]);

exit_fail1:
free(knet_h);
Expand Down Expand Up @@ -247,8 +247,8 @@ int knet_handle_free(knet_handle_t knet_h)
close(knet_h->tap_to_links_epollfd);
close(knet_h->recv_from_links_epollfd);
close(knet_h->dst_link_handler_epollfd);
close(knet_h->pipefd[0]);
close(knet_h->pipefd[1]);
close(knet_h->dstpipefd[0]);
close(knet_h->dstpipefd[1]);

pthread_rwlock_destroy(&knet_h->list_rwlock);

Expand Down Expand Up @@ -728,7 +728,7 @@ static void _handle_dst_link_updates(knet_handle_t knet_h)
int link_idx;
int best_priority = -1;

if (read(knet_h->pipefd[0], &dst_host_id, sizeof(dst_host_id)) != sizeof(dst_host_id)) {
if (read(knet_h->dstpipefd[0], &dst_host_id, sizeof(dst_host_id)) != sizeof(dst_host_id)) {
log_debug(knet_h, KNET_SUB_SWITCH_T, "Short read on pipe");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion libknet/libknet-private.h
Expand Up @@ -33,7 +33,7 @@ struct knet_handle {
int sockfd;
int logfd;
uint8_t log_levels[KNET_MAX_SUBSYSTEMS];
int pipefd[2];
int dstpipefd[2];
int tap_to_links_epollfd;
int recv_from_links_epollfd;
int dst_link_handler_epollfd;
Expand Down

0 comments on commit da577b9

Please sign in to comment.