Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

link: rename configured to enabled

we need configured internally for other stuff

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information...
commit ce8c32c3e1a33fa3813fb032b0a890b1a335c07b 1 parent 321e7f7
@fabbione authored
View
8 kronosnetd/vty_cli_cmds.c
@@ -896,7 +896,7 @@ static int knet_cmd_no_link(struct knet_vty *vty)
knet_link_get_status(knet_iface->cfg_ring.knet_h, vty->host_id, vty->link_id, &status);
- if (status.configured) {
+ if (status.enabled) {
if (knet_link_enable(knet_iface->cfg_ring.knet_h, vty->host_id, vty->link_id, 0)) {
knet_vty_write(vty, "Error: unable to update switching cache%s", telnet_newline);
return -1;
@@ -933,7 +933,7 @@ static int knet_cmd_link(struct knet_vty *vty)
snprintf(dst_port, KNET_MAX_PORT_LEN, "%d", knet_iface->cfg_ring.base_port + knet_iface->cfg_eth.node_id);
knet_link_get_status(knet_iface->cfg_ring.knet_h, vty->host_id, vty->link_id, &status);
- if (!status.configured) {
+ if (!status.enabled) {
if (strtoaddr(src_ipaddr, src_port, (struct sockaddr *)&src_addr, sizeof(struct sockaddr_storage)) != 0) {
knet_vty_write(vty, "Error: unable to convert source ip addr to sockaddr!%s", telnet_newline);
err = -1;
@@ -1567,7 +1567,7 @@ static int knet_cmd_status(struct knet_vty *vty)
dynamic = knet_link_get_config(knet_iface->cfg_ring.knet_h, host_ids[j], i, &src_addr, &dst_addr);
knet_link_get_status(knet_iface->cfg_ring.knet_h, host_ids[j], i, &status);
- if (status.configured == 1) {
+ if (status.enabled == 1) {
if (dynamic) {
knet_vty_write(vty, " link %s dynamic (connected: %d)%s", status.src_ipaddr, status.connected, nl);
} else {
@@ -1665,7 +1665,7 @@ static int knet_cmd_print_conf(struct knet_vty *vty)
for (i = 0; i < KNET_MAX_LINK; i++) {
knet_link_get_status(knet_iface->cfg_ring.knet_h, host_ids[j], i, &status);
- if (status.configured == 1) {
+ if (status.enabled == 1) {
uint8_t priority;
unsigned int dynamic, precision;
time_t interval, timeout;
View
2  libknet/host.c
@@ -129,7 +129,7 @@ int knet_host_remove(knet_handle_t knet_h, uint16_t host_id)
*/
for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) {
- if (knet_h->host_index[host_id]->link[link_idx].status.configured) {
+ if (knet_h->host_index[host_id]->link[link_idx].status.enabled) {
err = -1;
savederrno = EBUSY;
log_err(knet_h, KNET_SUB_HOST, "Unable to remove host %u, links are still configured: %s",
View
11 libknet/libknet.h
@@ -489,7 +489,8 @@ int knet_link_get_config(knet_handle_t knet_h, uint16_t host_id, uint8_t link_id
struct sockaddr_storage *dst_addr);
-int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, int configured);
+int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id,
+ int enabled);
int knet_link_set_timeout(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, time_t interval, time_t timeout, unsigned int precision);
int knet_link_get_timeout(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, time_t *interval, time_t *timeout, unsigned int *precision);
@@ -502,10 +503,10 @@ struct knet_link_status {
char src_port[KNET_MAX_PORT_LEN];
char dst_ipaddr[KNET_MAX_HOST_LEN];
char dst_port[KNET_MAX_PORT_LEN];
- unsigned int configured:1; /* link is configured and ready to be used */
- unsigned int connected:1; /* link is enabled for data (local view) */
- unsigned int dynconnected:1; /* link has been activated by remote dynip */
- unsigned long long latency; /* average latency computed by fix/exp */
+ unsigned int enabled:1; /* link is configured and admin enabled for traffic */
+ unsigned int connected:1; /* link is connected for data (local view) */
+ unsigned int dynconnected:1; /* link has been activated by remote dynip */
+ unsigned long long latency; /* average latency computed by fix/exp */
struct timespec pong_last;
};
View
28 libknet/link.c
@@ -23,25 +23,25 @@
#include "host.h"
int _link_updown(knet_handle_t knet_h, uint16_t node_id,
- struct knet_link *lnk, int configured, int connected)
+ struct knet_link *lnk, int enabled, int connected)
{
- unsigned int old_configured = lnk->status.configured;
+ unsigned int old_enabled = lnk->status.enabled;
unsigned int old_connected = lnk->status.connected;
- if ((lnk->status.configured == configured) && (lnk->status.connected == connected))
+ if ((lnk->status.enabled == enabled) && (lnk->status.connected == connected))
return 0;
- lnk->status.configured = configured;
+ lnk->status.enabled = enabled;
lnk->status.connected = connected;
if (_dst_cache_update(knet_h, node_id)) {
log_debug(knet_h, KNET_SUB_LINK,
- "Unable to update link status (host: %s link: %s configured: %u connected: %u)",
+ "Unable to update link status (host: %s link: %s enabled: %u connected: %u)",
knet_h->host_index[node_id]->name,
lnk->status.dst_ipaddr,
- lnk->status.configured,
+ lnk->status.enabled,
lnk->status.connected);
- lnk->status.configured = old_configured;
+ lnk->status.enabled = old_enabled;
lnk->status.connected = old_connected;
return -1;
}
@@ -52,7 +52,7 @@ int _link_updown(knet_handle_t knet_h, uint16_t node_id,
return 0;
}
-int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, int configured)
+int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, int enabled)
{
int err;
struct knet_link *lnk;
@@ -62,10 +62,10 @@ int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, in
lnk = &knet_h->host_index[node_id]->link[link_id];
- if (lnk->status.configured == configured)
+ if (lnk->status.enabled == enabled)
return 0;
- if (configured) {
+ if (enabled) {
if (_listener_add(knet_h, lnk) < 0) {
log_err(knet_h, KNET_SUB_LINK, "Unable to setup listener for this link");
return -1;
@@ -74,7 +74,7 @@ int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, in
knet_h->host_index[node_id]->name, lnk->status.dst_ipaddr);
}
- if (!configured) {
+ if (!enabled) {
struct knet_hinfo_data knet_hinfo_data;
knet_hinfo_data.khd_type = KNET_HOST_INFO_LINK_UP_DOWN;
@@ -86,9 +86,9 @@ int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, in
_send_host_info(knet_h, &knet_hinfo_data, sizeof(struct knet_hinfo_data));
}
- err = _link_updown(knet_h, node_id, lnk, configured, lnk->status.connected);
+ err = _link_updown(knet_h, node_id, lnk, enabled, lnk->status.connected);
- if ((configured) && (!err))
+ if ((enabled) && (!err))
return 0;
if (err)
@@ -99,7 +99,7 @@ int knet_link_enable(knet_handle_t knet_h, uint16_t node_id, uint8_t link_id, in
if ((err) && (err != EBUSY)) {
log_err(knet_h, KNET_SUB_LINK, "Unable to remove listener for this link");
if (_link_updown(knet_h, node_id, lnk, 1, lnk->status.connected))
- lnk->status.configured = 1;
+ lnk->status.enabled = 1;
log_debug(knet_h, KNET_SUB_LINK, "host: %s link: %s is NOT disabled",
knet_h->host_index[node_id]->name, lnk->status.dst_ipaddr);
return -1;
View
2  libknet/listener.c
@@ -140,7 +140,7 @@ int _listener_remove(knet_handle_t knet_h, struct knet_link *lnk)
/* checking if listener is in use */
for (host = knet_h->host_head; host != NULL; host = host->next) {
for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) {
- if (host->link[link_idx].status.configured != 1)
+ if (host->link[link_idx].status.enabled != 1)
continue;
if (host->link[link_idx].listener_sock == lnk->listener_sock) {
View
4 libknet/ping_test.c
@@ -174,7 +174,7 @@ static int print_link(knet_handle_t khandle, uint16_t host_id)
if (knet_link_get_status(knet_h, host_id, i, &status) < 0)
return -1;
- if (status.configured != 1) continue;
+ if (status.enabled != 1) continue;
printf("host %u, link %u latency is %llu us, status: %s\n",
host_id, i, status.latency,
@@ -201,7 +201,7 @@ static void sigint_handler(int signum)
for (j = 0; j < KNET_MAX_LINK; j++) {
if (knet_link_get_status(knet_h, host_ids[i], j, &status))
printf("Unable to get link data: %s\n",strerror(errno));
- if (status.configured != 1) continue;
+ if (status.enabled != 1) continue;
if (knet_link_enable(knet_h, host_ids[i], j, 0))
printf("Unable to remove link: %s\n",strerror(errno));
View
8 libknet/threads.c
@@ -355,7 +355,7 @@ static void _handle_recv_from_links(knet_handle_t knet_h, int sockfd)
if (!src_link->status.connected) {
log_info(knet_h, KNET_SUB_LINK, "host: %s link: %s is up",
src_host->name, src_link->status.dst_ipaddr);
- _link_updown(knet_h, src_host->host_id, src_link, src_link->status.configured, 1);
+ _link_updown(knet_h, src_host->host_id, src_link, src_link->status.enabled, 1);
}
}
@@ -456,7 +456,7 @@ static void _handle_dst_link_updates(knet_handle_t knet_h)
dst_host->active_link_entries = 0;
for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) {
- if (dst_host->link[link_idx].status.configured != 1) /* link is not configured */
+ if (dst_host->link[link_idx].status.enabled != 1) /* link is not enabled */
continue;
if (dst_host->link[link_idx].remoteconnected) /* track if remote is connected */
host_has_remote = 1;
@@ -587,7 +587,7 @@ static void _handle_check_each(knet_handle_t knet_h, struct knet_host *dst_host,
if (diff_ping >= (dst_link->pong_timeout * 1000llu)) {
log_info(knet_h, KNET_SUB_LINK, "host: %s link: %s is down",
dst_host->name, dst_link->status.dst_ipaddr);
- _link_updown(knet_h, dst_host->host_id, dst_link, dst_link->status.configured, 0);
+ _link_updown(knet_h, dst_host->host_id, dst_link, dst_link->status.enabled, 0);
}
}
}
@@ -613,7 +613,7 @@ void *_handle_heartbt_thread(void *data)
for (dst_host = knet_h->host_head; dst_host != NULL; dst_host = dst_host->next) {
for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) {
- if ((dst_host->link[link_idx].status.configured != 1) ||
+ if ((dst_host->link[link_idx].status.enabled != 1) ||
((dst_host->link[link_idx].dynamic == KNET_LINK_DYNIP) &&
(dst_host->link[link_idx].status.dynconnected != 1)))
continue;
Please sign in to comment.
Something went wrong with that request. Please try again.