]> git.proxmox.com Git - mirror_corosync.git/commitdiff
votequorum: remove last instance of state and rename it to cast_vote
authorFabio M. Di Nitto <fdinitto@redhat.com>
Wed, 4 Jul 2012 13:35:49 +0000 (15:35 +0200)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Tue, 7 Aug 2012 09:07:17 +0000 (11:07 +0200)
also align naming of vote to cast_vote for info calls

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
exec/votequorum.c
include/corosync/ipc_votequorum.h
include/corosync/votequorum.h
lib/votequorum.c
man/votequorum_qdevice_poll.3.in
test/testvotequorum2.c
tools/corosync-quorumtool.c

index c4bb15850b406bea15eec5a2c3d1fb66a9b5846a..4be06278f536f8dbdd4945bfb00890e0fc078930 100644 (file)
@@ -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;
index e60a8cbb1187abfc1f71e48382818c0c511c1423..6e9eb55f502ab21f5d0c5a94302fc78b58954d22 100644 (file)
@@ -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];
 };
 
index 792f81d7f1dc52d36f6aa48b69ed8aa79f8a26e6..d7b5eea3010f0161e5c35c2e50c3029e9becf19a 100644 (file)
@@ -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
index d4c9208cc0f58bd139c95c1e81aef74523f39ae7..e36d114677e3ecd105ae25c835b2f48bc7d19303 100644 (file)
@@ -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);
 
 
index f626a59ada67ce99c80fb68bd6183ffbde4ad75a..f13d1dc4167658da91a55c52fb1dc5ad028c93c1 100644 (file)
@@ -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
index affbcecc1210f58ae49cb4f4e1e16947341e8306..a66e25ba73011cb7120da84cf6f1cd097da2fa5a 100644 (file)
@@ -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;
index 0aea2f09ea4e804988a52a7b28e16074feafbf4d..d2374331ab95f9f23a785444a0e00fc12b33f07d 100644 (file)
@@ -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");
                }
        }
 }