From 0143ee9a2fecd082f41f460149f3baf23dd67345 Mon Sep 17 00:00:00 2001 From: Hideo Yamauchi Date: Fri, 7 Feb 2020 13:02:47 +0900 Subject: [PATCH] totemknet: Change the initial value of the status Signed-off-by: Hideo Yamauchi Reviewed-by: Jan Friesse --- exec/totemknet.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/exec/totemknet.c b/exec/totemknet.c index 9a5a87d9..50cd0279 100644 --- a/exec/totemknet.c +++ b/exec/totemknet.c @@ -479,6 +479,10 @@ static int node_compare(const void *aptr, const void *bptr) return a > b; } +#ifndef OWN_INDEX_NONE +#define OWN_INDEX_NONE -1 +#endif + int totemknet_ifaces_get (void *knet_context, char ***status, unsigned int *iface_count) @@ -499,6 +503,7 @@ int totemknet_ifaces_get (void *knet_context, * a count of interfaces. */ if (status) { + int own_idx = OWN_INDEX_NONE; res = knet_host_get_host_list(instance->knet_handle, host_list, &num_hosts); @@ -507,8 +512,18 @@ int totemknet_ifaces_get (void *knet_context, } qsort(host_list, num_hosts, sizeof(uint16_t), node_compare); + for (j=0; jour_nodeid) { + own_idx = j; + break; + } + } + for (i=0; ilink_status[i], 'n', CFG_INTERFACE_STATUS_MAX_LEN-1); + memset(instance->link_status[i], 'd', CFG_INTERFACE_STATUS_MAX_LEN-1); + if (own_idx != OWN_INDEX_NONE) { + instance->link_status[i][own_idx] = 'n'; + } instance->link_status[i][num_hosts] = '\0'; }