Small cman cleanup patches
Hi guys,
3 patches to do some very small cleanup in cman/daemon/cmanccs.c.
Please apply or ACK and I will apply.
Thanks
Fabio
PS I know Patrick is away but they are all pretty safe changes.
PATCH 1/3 Clean up duplicate ccs query paths.
From: Fabio M. Di Nitto <[email protected]>
Signed-off-by Fabio M. Di Nitto <[email protected]>
---
:100644 100644 33b5dd7... 0de3d0c... M cman/daemon/cmanccs.c
cman/daemon/cmanccs.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
cman/daemon/cmanccs.c +1 -2
@@ -45,7 +45,6 @@#define PORT_PATH "/cluster/cman/@port"#define KEY_PATH "/cluster/cman/@keyfile" -#define NODEI_NAME_PATH "/cluster/clusternodes/clusternode[%d]/@name"#define NODE_NAME_PATH_BYNAME "/cluster/clusternodes/clusternode[@name=\"%s\"]/@name"#define NODE_NAME_PATH_BYNUM "/cluster/clusternodes/clusternode[%d]/@name"#define NODE_VOTES_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@votes"
@@ -500,7 +499,7 @@ static int get_ccs_join_info(void)for (i =1 ; ; i++) { name =NULL ;memset (path,0 ,MAX_PATH_LEN ); -sprintf (path,NODEI_NAME_PATH , i); +sprintf (path,NODE_NAME_PATH_BYNUM , i); error =ccs_get (cd, path, &name);if (error || !name)
Signature · 1 line
1.5.2.5
PATCH 2/3 Use right vars to print debugging info
From: Fabio M. Di Nitto <[email protected]>
Signed-off-by Fabio M. Di Nitto <[email protected]>
---
:100644 100644 0de3d0c... 6abc618... M cman/daemon/cmanccs.c
cman/daemon/cmanccs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cman/daemon/cmanccs.c +1 -1
@@ -577,7 +577,7 @@ static int get_ccs_join_info(void)if (!error) {int votestmp =atoi (str);if (votestmp <0 || votestmp >255 ) { -log_printf (LOG_ERR ,"invalid votes value %d" , votes); +log_printf (LOG_ERR ,"invalid votes value %d" , votestmp);write_cman_pipe ("Found invalid votes for node in CCS" );return -EINVAL ; }
Signature · 1 line
1.5.2.5
PATCH 3/3 Use standard path var and memset it before each query
From: Fabio M. Di Nitto <[email protected]>
Signed-off-by Fabio M. Di Nitto <[email protected]>
---
:100644 100644 6abc618... 30bf039... M cman/daemon/cmanccs.c
cman/daemon/cmanccs.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)
cman/daemon/cmanccs.c +10 -8
@@ -130,24 +130,26 @@ int read_ccs_nodes(unsigned int *config_version, int check_nodeids) two_node =0 ;for (i=1 ;;i++) { -char nodekey[256 ]; -char key[256 ]; +char path[MAX_PATH_LEN ];int votes=0 , nodeid=0 ; -sprintf (nodekey,NODE_NAME_PATH_BYNUM , i); - error =ccs_get (ctree, nodekey, &nodename); +memset (path,0 ,MAX_PATH_LEN ); +sprintf (path,NODE_NAME_PATH_BYNUM , i); + error =ccs_get (ctree, path, &nodename);if (error)break ; -sprintf (key,NODE_VOTES_PATH , nodename); -if (!ccs_get (ctree, key, &str)) { +memset (path,0 ,MAX_PATH_LEN ); +sprintf (path,NODE_VOTES_PATH , nodename); +if (!ccs_get (ctree, path, &str)) { votes =atoi (str);free (str); }else votes =1 ; -sprintf (key,NODE_NODEID_PATH , nodename); -if (!ccs_get (ctree, key, &str)) { +memset (path,0 ,MAX_PATH_LEN ); +sprintf (path,NODE_NODEID_PATH , nodename); +if (!ccs_get (ctree, path, &str)) { nodeid =atoi (str);free (str);
Signature · 1 line
1.5.2.5