[PATCH 11/25] votequorum: remove last instance of state and rename it to cast_vote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

also align naming of vote to cast_vote for info calls

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
:100644 100644 c4bb158... 4be0627... M	exec/votequorum.c
:100644 100644 e60a8cb... 6e9eb55... M	include/corosync/ipc_votequorum.h
:100644 100644 792f81d... d7b5eea... M	include/corosync/votequorum.h
:100644 100644 d4c9208... e36d114... M	lib/votequorum.c
:100644 100644 f626a59... f13d1dc... M	man/votequorum_qdevice_poll.3.in
:100644 100644 affbcec... a66e25b... M	test/testvotequorum2.c
:100644 100644 0aea2f0... d237433... M	tools/corosync-quorumtool.c
 exec/votequorum.c                 |    4 ++--
 include/corosync/ipc_votequorum.h |    4 ++--
 include/corosync/votequorum.h     |    4 ++--
 lib/votequorum.c                  |    6 +++---
 man/votequorum_qdevice_poll.3.in  |    4 ++--
 test/testvotequorum2.c            |   12 ++++++++----
 tools/corosync-quorumtool.c       |    4 +++-
 7 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/exec/votequorum.c b/exec/votequorum.c
index c4bb158..4be0627 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -2321,7 +2321,7 @@ static void message_handler_req_lib_votequorum_qdevice_poll (void *conn,
 
 		us->flags |= NODE_FLAGS_QDEVICE_ALIVE;
 
-		if (req_lib_votequorum_qdevice_poll->state) {
+		if (req_lib_votequorum_qdevice_poll->cast_vote) {
 			us->flags |= NODE_FLAGS_QDEVICE_CAST_VOTE;
 		} else {
 			us->flags &= ~NODE_FLAGS_QDEVICE_CAST_VOTE;
@@ -2377,7 +2377,7 @@ static void message_handler_req_lib_votequorum_qdevice_getinfo (void *conn,
 						nodeid, alive_status, vote_status);
 		res_lib_votequorum_qdevice_getinfo.votes = qdevice->votes;
 		res_lib_votequorum_qdevice_getinfo.alive = alive_status;
-		res_lib_votequorum_qdevice_getinfo.vote = vote_status;
+		res_lib_votequorum_qdevice_getinfo.cast_vote = vote_status;
 		strcpy(res_lib_votequorum_qdevice_getinfo.name, qdevice_name);
 	} else {
 		error = CS_ERR_NOT_EXIST;
diff --git a/include/corosync/ipc_votequorum.h b/include/corosync/ipc_votequorum.h
index e60a8cb..6e9eb55 100644
--- a/include/corosync/ipc_votequorum.h
+++ b/include/corosync/ipc_votequorum.h
@@ -79,7 +79,7 @@ struct req_lib_votequorum_qdevice_update {
 struct req_lib_votequorum_qdevice_poll {
 	struct qb_ipc_request_header header __attribute__((aligned(8)));
 	char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
-	int state;
+	int cast_vote;
 };
 
 struct req_lib_votequorum_qdevice_getinfo {
@@ -143,7 +143,7 @@ struct res_lib_votequorum_qdevice_getinfo {
 	struct qb_ipc_response_header header __attribute__((aligned(8)));
 	unsigned int votes;
 	unsigned int alive;
-	unsigned int vote;
+	unsigned int cast_vote;
 	char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
 };
 
diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h
index 792f81d..d7b5eea 100644
--- a/include/corosync/votequorum.h
+++ b/include/corosync/votequorum.h
@@ -75,7 +75,7 @@ struct votequorum_info {
 struct votequorum_qdevice_info {
 	unsigned int votes;
 	unsigned int alive;
-	unsigned int vote;
+	unsigned int cast_vote;
 	char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
 };
 
@@ -208,7 +208,7 @@ cs_error_t votequorum_qdevice_update (
 cs_error_t votequorum_qdevice_poll (
 	votequorum_handle_t handle,
 	const char *name,
-	unsigned int state);
+	unsigned int cast_vote);
 
 /**
  * Get quorum device information
diff --git a/lib/votequorum.c b/lib/votequorum.c
index d4c9208..e36d114 100644
--- a/lib/votequorum.c
+++ b/lib/votequorum.c
@@ -599,7 +599,7 @@ error_exit:
 cs_error_t votequorum_qdevice_poll (
 	votequorum_handle_t handle,
 	const char *name,
-	unsigned int state)
+	unsigned int cast_vote)
 {
 	cs_error_t error;
 	struct votequorum_inst *votequorum_inst;
@@ -619,7 +619,7 @@ cs_error_t votequorum_qdevice_poll (
 	req_lib_votequorum_qdevice_poll.header.size = sizeof (struct req_lib_votequorum_qdevice_poll);
 	req_lib_votequorum_qdevice_poll.header.id = MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL;
 	strcpy(req_lib_votequorum_qdevice_poll.name, name);
-	req_lib_votequorum_qdevice_poll.state = state;
+	req_lib_votequorum_qdevice_poll.cast_vote = cast_vote;
 
 	iov.iov_base = (char *)&req_lib_votequorum_qdevice_poll;
 	iov.iov_len = sizeof (struct req_lib_votequorum_qdevice_poll);
@@ -726,7 +726,7 @@ cs_error_t votequorum_qdevice_getinfo (
 
 	qinfo->votes = res_lib_votequorum_qdevice_getinfo.votes;
 	qinfo->alive = res_lib_votequorum_qdevice_getinfo.alive;
-	qinfo->vote = res_lib_votequorum_qdevice_getinfo.vote;
+	qinfo->cast_vote = res_lib_votequorum_qdevice_getinfo.cast_vote;
 	strcpy(qinfo->name, res_lib_votequorum_qdevice_getinfo.name);
 
 
diff --git a/man/votequorum_qdevice_poll.3.in b/man/votequorum_qdevice_poll.3.in
index f626a59..f13d1dc 100644
--- a/man/votequorum_qdevice_poll.3.in
+++ b/man/votequorum_qdevice_poll.3.in
@@ -37,13 +37,13 @@ votequorum_qdevice_poll \- Tells votequorum the result of the quorum device poll
 .SH SYNOPSIS
 .B #include <corosync/votequorum.h>
 .sp
-.BI "int votequorum_qdevice_poll(votequorum_handle_t " handle ", unsigned int " state ");"
+.BI "int votequorum_qdevice_poll(votequorum_handle_t " handle ", unsigned int " cast_vote ");"
 .SH DESCRIPTION
 The
 .B votequorum_qdevice_poll
 is called by the quorum device subsystem (not provided as part of votequorum) to tell
 the voting system if the quorum device is present/active or not. If
-.B state
+.B cast_vote
 is 1 then the votes for the device are included in the quorum calculation, otherwise not.
 This routine should be called at regular intervals to ensure that the device status
 is always known to votequorum. If
diff --git a/test/testvotequorum2.c b/test/testvotequorum2.c
index affbcec..a66e25b 100644
--- a/test/testvotequorum2.c
+++ b/test/testvotequorum2.c
@@ -53,9 +53,9 @@ static void print_info(int ok_to_fail)
 		fprintf(stderr, "votequorum_qdevice_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED");
 	else {
 		printf("qdevice votes  %d\n", qinfo.votes);
-		printf("alive        %d\n", qinfo.alive);
-		printf("vote         %d\n", qinfo.vote);
-		printf("name         %s\n", qinfo.name);
+		printf("alive          %d\n", qinfo.alive);
+		printf("cast vote      %d\n", qinfo.cast_vote);
+		printf("name           %s\n", qinfo.name);
 		printf("\n");
 	}
 }
@@ -63,6 +63,7 @@ static void print_info(int ok_to_fail)
 int main(int argc, char *argv[])
 {
 	int ret = 0;
+	int cast_vote = 1;
 	int pollcount=0, polltime=1;
 	int err;
 
@@ -79,6 +80,9 @@ int main(int argc, char *argv[])
 	if (argc >= 3 && atoi(argv[2])) {
 		polltime = atoi(argv[2]);
 	}
+	if (argc >= 4) {
+		cast_vote = atoi(argv[3]);
+	}
 
 	if (argc >= 2) {
 		if ( (err=votequorum_qdevice_register(handle, "QDEVICE")) != CS_OK) {
@@ -89,7 +93,7 @@ int main(int argc, char *argv[])
 
 		while (pollcount--) {
 			print_info(0);
-			if ((err=votequorum_qdevice_poll(handle, "QDEVICE", 1)) != CS_OK) {
+			if ((err=votequorum_qdevice_poll(handle, "QDEVICE", cast_vote)) != CS_OK) {
 				fprintf(stderr, "qdevice poll FAILED: %d\n", err);
 				ret = -1;
 				goto out;
diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c
index 0aea2f0..d237433 100644
--- a/tools/corosync-quorumtool.c
+++ b/tools/corosync-quorumtool.c
@@ -354,7 +354,9 @@ static void display_nodes_data(uint32_t nodeid, nodeid_format_t nodeid_format, n
 				printf("0x%08x ", VOTEQUORUM_NODEID_QDEVICE);
 			}
 			print_uint32_padded(qinfo.votes);
-			printf("%s (%s/%s)\n", qinfo.name, qinfo.alive?"Alive":"Not alive", qinfo.vote?"Voting":"Not voting");
+			printf("%s (%s/%s)\n", qinfo.name,
+			       qinfo.alive?"Alive":"Not alive",
+			       qinfo.cast_vote?"Voting":"Not voting");
 		}
 	}
 }
-- 
1.7.7.6

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux