public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - rgmanager: Clean up rg_queue.c and related warnings
@ 2009-06-22 13:33 Lon Hohberger
0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-06-22 13:33 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=beb86b1fdade86f7535987ca0690da0e29fca0ae
Commit: beb86b1fdade86f7535987ca0690da0e29fca0ae
Parent: 26965015ddb4055b46ec3b91aeede614d54b6728
Author: Lon Hohberger <lhh@redhat.com>
AuthorDate: Tue Jun 16 14:51:57 2009 -0400
Committer: Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Jun 22 09:32:03 2009 -0400
rgmanager: Clean up rg_queue.c and related warnings
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
rgmanager/include/resgroup.h | 24 ++++----
rgmanager/include/rg_queue.h | 6 +-
rgmanager/src/daemons/groups.c | 4 +-
rgmanager/src/daemons/main.c | 1 -
rgmanager/src/daemons/rg_queue.c | 4 +-
rgmanager/src/daemons/rg_state.c | 120 +++++++++++++------------------------
rgmanager/src/daemons/rg_thread.c | 8 ++-
7 files changed, 67 insertions(+), 100 deletions(-)
diff --git a/rgmanager/include/resgroup.h b/rgmanager/include/resgroup.h
index 99eed3e..1b882f3 100644
--- a/rgmanager/include/resgroup.h
+++ b/rgmanager/include/resgroup.h
@@ -144,27 +144,29 @@ const char *rg_flags_str(char *flags_string, size_t size, int val, char *separat
const char *agent_op_str(int val);
int eval_groups(int local, uint32_t nodeid, int nodeStatus);
-int group_migrate(char *groupname, int target);
+int group_migrate(const char *groupname, int target);
int rg_status(const char *resgroupname);
-int group_op(char *rgname, int op);
+int group_op(const char *rgname, int op);
void rg_init(void);
int init_resource_groups(int, int);
/* Basic service operations */
-int svc_start(char *svcName, int req);
-int svc_stop(char *svcName, int error);
-int svc_status(char *svcName);
-int svc_status_inquiry(char *svcName);
-int svc_disable(char *svcName);
-int svc_fail(char *svcName);
-int svc_freeze(char *svcName);
-int svc_unfreeze(char *svcName);
-int svc_migrate(char *svcName, int target);
+int svc_start(const char *svcName, int req);
+int svc_stop(const char *svcName, int error);
+int svc_status(const char *svcName);
+int svc_status_inquiry(const char *svcName);
+int svc_disable(const char *svcName);
+int svc_fail(const char *svcName);
+int svc_freeze(const char *svcName);
+int svc_unfreeze(const char *svcName);
+int svc_migrate(const char *svcName, int target);
+int svc_start_remote(const char *svcName, int request, uint32_t target);
int rt_enqueue_request(const char *resgroupname, int request,
msgctx_t *resp_ctx,
int max, uint32_t target, int arg0, int arg1);
+void dump_threads(FILE *fp);
void send_response(int ret, int node, request_t *req);
void send_ret(msgctx_t *ctx, char *name, int ret, int orig_request,
diff --git a/rgmanager/include/rg_queue.h b/rgmanager/include/rg_queue.h
index 6f26e40..e7ea29a 100644
--- a/rgmanager/include/rg_queue.h
+++ b/rgmanager/include/rg_queue.h
@@ -22,15 +22,15 @@ typedef struct _request {
uint32_t rr_arg2; /** Integer argument */
uint32_t rr_line; /** Line no */
msgctx_t * rr_resp_ctx; /** FD to send response */
- char *rr_file; /** Who made req */
+ const char *rr_file; /** Who made req */
time_t rr_when; /** time to execute */
} request_t;
int _rq_queue_request(request_t **queue, char *name, uint32_t request,
uint32_t err, uint32_t oldreq, msgctx_t *ctx, time_t when,
- uint32_t target, uint32_t arg0, uint32_t arg1, char *file,
- int line);
+ uint32_t target, uint32_t arg0, uint32_t arg1,
+ const char *file, int line);
#define rq_queue_request(queue, name, request, err, oldreq,\
fd, when, target, arg0, arg1) \
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index a0b7159..1d58041 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -943,7 +943,7 @@ out_unlock:
@return 0 on success, 1 on failure/error.
*/
int
-group_op(char *groupname, int op)
+group_op(const char *groupname, int op)
{
resource_t *res;
int ret = -1;
@@ -1003,7 +1003,7 @@ group_op(char *groupname, int op)
int
-group_migrate(char *groupname, int target)
+group_migrate(const char *groupname, int target)
{
resource_node_t *rn = NULL, *tmp;
resource_t *res;
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 5e32135..5dd5071 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -41,7 +41,6 @@ static uint8_t ALIGNED port = RG_PORT;
static char *rgmanager_lsname = (char *)"rgmanager"; /* XXX default */
static int status_poll_interval = DEFAULT_CHECK_INTERVAL;
-int next_node_id(cluster_member_list_t *membership, int me);
static void
segfault(int __attribute__ ((unused)) sig)
diff --git a/rgmanager/src/daemons/rg_queue.c b/rgmanager/src/daemons/rg_queue.c
index fe03f04..758f5e4 100644
--- a/rgmanager/src/daemons/rg_queue.c
+++ b/rgmanager/src/daemons/rg_queue.c
@@ -12,8 +12,8 @@
int
_rq_queue_request(request_t **queue, char *name, uint32_t request,
uint32_t err, uint32_t oldreq, msgctx_t *ctx, time_t when,
- uint32_t target, uint32_t arg0, uint32_t arg1, char *file,
- int line)
+ uint32_t target, uint32_t arg0, uint32_t arg1,
+ const char *file, int line)
{
request_t *req;
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 3e8c97b..f594198 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1,6 +1,9 @@
-//#define DEBUG
#include <assert.h>
#include <platform.h>
+#include <list.h>
+#include <time.h>
+#include <restart_counter.h>
+#include <reslist.h>
#include <message.h>
#include <members.h>
#ifdef OPENAIS
@@ -20,58 +23,20 @@
#include <res-ocf.h>
#include <event.h>
#include <groups.h>
+#include <fo_domain.h>
/* XXX - copied :( */
#define cn_svccount cn_address.cna_address[0] /* Theses are uint8_t size */
#define cn_svcexcl cn_address.cna_address[1]
-static int msvc_check_cluster(char *svcName);
-static inline int handle_started_status(char *svcName, int ret, rg_state_t *svcStatus);
-static inline int handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus);
+static int msvc_check_cluster(const char *svcName);
+static int handle_started_status(const char *svcName, int ret, rg_state_t *svcStatus);
+static int handle_migrate_status(const char *svcName, int ret, rg_state_t *svcStatus);
+static int _svc_stop_finish(const char *svcName, int failed, uint32_t newstate);
-int
-next_node_id(cluster_member_list_t *membership, int me)
-{
- int low = (int)(-1);
- int next = me, curr;
- int x;
-
- for (x = 0; x < membership->cml_count; x++) {
- curr = membership->cml_members[x].cn_nodeid;
- if (curr < low)
- low = curr;
-
- if ((curr > me) && ((next == me) || (curr < next)))
- next = curr;
- }
-
- /* I am highest ID; go to lowest */
- if (next == me)
- next = low;
-
- return next;
-}
-
-
-char *
-c_name(char *svcName)
-{
- char *ptr, *ret = svcName;
-
- ptr = strchr(svcName,':');
- if (!ptr)
- return ret;
- if ((int)(ptr - svcName) == 7 &&
- !memcmp(svcName, "service", 7)) /* strlen("service") */
- ret = ptr + 1;
-
- return ret;
-}
-
-
-void
-broadcast_event(char *svcName, uint32_t state, int owner, int last)
+static void
+broadcast_event(const char *svcName, uint32_t state, int owner, int last)
{
SmMessageSt msgp;
msgctx_t everyone;
@@ -97,8 +62,8 @@ broadcast_event(char *svcName, uint32_t state, int owner, int last)
}
-int
-svc_report_failure(char *svcName)
+static int
+svc_report_failure(const char *svcName)
{
struct dlm_lksb lockp;
rg_state_t svcStatus;
@@ -233,7 +198,7 @@ send_response(int ret, int nodeid, request_t *req)
int
-set_rg_state(char *name, rg_state_t *svcblk)
+set_rg_state(const char *name, rg_state_t *svcblk)
{
char res[256];
rg_state_t svcblk_store;
@@ -271,7 +236,7 @@ set_rg_state(char *name, rg_state_t *svcblk)
static int
-init_rg(char *name, rg_state_t *svcblk)
+init_rg(const char *name, rg_state_t *svcblk)
{
svcblk->rs_owner = 0;
svcblk->rs_last_owner = 0;
@@ -286,7 +251,7 @@ init_rg(char *name, rg_state_t *svcblk)
int
-get_rg_state(char *name, rg_state_t *svcblk)
+get_rg_state(const char *name, rg_state_t *svcblk)
{
char res[256];
int ret;
@@ -381,9 +346,8 @@ get_rg_state(char *name, rg_state_t *svcblk)
}
-int vf_read_local(char *, uint64_t *, void *, uint32_t *);
int
-get_rg_state_local(char *name, rg_state_t *svcblk)
+get_rg_state_local(const char *name, rg_state_t *svcblk)
{
char res[256];
int ret;
@@ -450,8 +414,8 @@ get_rg_state_local(char *name, rg_state_t *svcblk)
* 6 = DO NOT stop service, mark stopped and return
* RG_SUCCESS (0)
*/
-int
-svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
+static int
+svc_advise_stop(rg_state_t *svcStatus, const char *svcName, int req)
{
cluster_member_list_t *membership = member_list();
int ret = 0;
@@ -581,8 +545,8 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
* 4 = DO NOT start service, return RG_ERUN
* 5 = DO NOT start service, return RG_EFROZEN
*/
-int
-svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
+static int
+svc_advise_start(rg_state_t *svcStatus, const char *svcName, int req)
{
cluster_member_list_t *membership = member_list();
int ret = 0;
@@ -739,7 +703,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
* @return FAIL, 0
*/
int
-svc_start(char *svcName, int req)
+svc_start(const char *svcName, int req)
{
struct dlm_lksb lockp;
int ret;
@@ -842,7 +806,7 @@ svc_start(char *svcName, int req)
* Migrate a service to another node.
*/
int
-svc_migrate(char *svcName, int target)
+svc_migrate(const char *svcName, int target)
{
struct dlm_lksb lockp;
rg_state_t svcStatus;
@@ -989,8 +953,8 @@ svc_migrate(char *svcName, int target)
* Returns the node ID of the new owner, if any. -1 if no one in the
* cluster has seen the service.
*/
-int
-get_new_owner(char *svcName)
+static int
+get_new_owner(const char *svcName)
{
SmMessageSt msgp, response;
msgctx_t ctx;
@@ -1059,7 +1023,7 @@ out:
using the standard management tools for the service/virtual machine.
*/
static int
-msvc_check_cluster(char *svcName)
+msvc_check_cluster(const char *svcName)
{
struct dlm_lksb lockp;
int newowner;
@@ -1114,7 +1078,7 @@ msvc_check_cluster(char *svcName)
* @return RG_EFORWARD, RG_EFAIL, 0
*/
int
-svc_status(char *svcName)
+svc_status(const char *svcName)
{
struct dlm_lksb lockp;
rg_state_t svcStatus;
@@ -1165,8 +1129,8 @@ svc_status(char *svcName)
}
-static inline int
-handle_started_status(char *svcName, int ret,
+static int
+handle_started_status(const char *svcName, int ret,
rg_state_t __attribute__((unused)) *svcStatus)
{
int newowner;
@@ -1205,8 +1169,8 @@ handle_started_status(char *svcName, int ret,
}
-static inline int
-handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus)
+static int
+handle_migrate_status(const char *svcName, int ret, rg_state_t *svcStatus)
{
struct dlm_lksb lockp;
/* For service(s) migrating to the local node, ignore invalid
@@ -1239,7 +1203,7 @@ handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus)
int
-svc_status_inquiry(char *svcName)
+svc_status_inquiry(const char *svcName)
{
rg_state_t svcStatus;
@@ -1265,7 +1229,7 @@ svc_status_inquiry(char *svcName)
* @return FAIL, 0
*/
static int
-_svc_stop(char *svcName, int req, int recover, uint32_t newstate)
+_svc_stop(const char *svcName, int req, int recover, uint32_t newstate)
{
struct dlm_lksb lockp;
rg_state_t svcStatus;
@@ -1371,7 +1335,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate)
static int
-_svc_stop_finish(char *svcName, int failed, uint32_t newstate)
+_svc_stop_finish(const char *svcName, int failed, uint32_t newstate)
{
rg_state_t svcStatus;
struct dlm_lksb lockp;
@@ -1437,14 +1401,14 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate)
* @return FAIL, 0
*/
int
-svc_disable(char *svcName)
+svc_disable(const char *svcName)
{
return _svc_stop(svcName, RG_DISABLE, 0, RG_STATE_DISABLED);
}
int
-svc_stop(char *svcName, int req)
+svc_stop(const char *svcName, int req)
{
return _svc_stop(svcName, req, (req == RG_STOP_RECOVER),
RG_STATE_STOPPED);
@@ -1458,7 +1422,7 @@ svc_stop(char *svcName, int req)
* @return FAIL, 0
*/
int
-svc_fail(char *svcName)
+svc_fail(const char *svcName)
{
struct dlm_lksb lockp;
rg_state_t svcStatus;
@@ -1515,8 +1479,8 @@ svc_fail(char *svcName)
* @param svcName Service ID to flag/unflag as frozen.
* @return FAIL, 0
*/
-int
-_svc_freeze(char *svcName, int enabled)
+static int
+_svc_freeze(const char *svcName, int enabled)
{
struct dlm_lksb lockp;
rg_state_t svcStatus;
@@ -1569,13 +1533,13 @@ _svc_freeze(char *svcName, int enabled)
}
int
-svc_freeze(char *svcName)
+svc_freeze(const char *svcName)
{
return _svc_freeze(svcName, 1);
}
int
-svc_unfreeze(char *svcName)
+svc_unfreeze(const char *svcName)
{
return _svc_freeze(svcName, 0);
}
@@ -1585,7 +1549,7 @@ svc_unfreeze(char *svcName)
* Send a message to the target node to start the service.
*/
int
-svc_start_remote(char *svcName, int request, uint32_t target)
+svc_start_remote(const char *svcName, int request, uint32_t target)
{
SmMessageSt msg_relo;
int msg_ret;
diff --git a/rgmanager/src/daemons/rg_thread.c b/rgmanager/src/daemons/rg_thread.c
index 0ab513c..1aa64b3 100644
--- a/rgmanager/src/daemons/rg_thread.c
+++ b/rgmanager/src/daemons/rg_thread.c
@@ -1,3 +1,7 @@
+#include <time.h>
+#include <list.h>
+#include <restart_counter.h>
+#include <reslist.h>
#include <message.h>
#include <resgroup.h>
#include <rg_locks.h>
@@ -34,9 +38,7 @@ static pthread_mutex_t reslist_mutex = PTHREAD_MUTEX_INITIALIZER;
static resthread_t *find_resthread_byname(const char *resgroupname);
static int spawn_if_needed(const char *resgroupname);
-int rt_enqueue_request(const char *resgroupname, int request,
- msgctx_t *response_ctx, int max, uint32_t target,
- int arg0, int arg1);
+
int central_events_enabled(void);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-22 13:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 13:33 cluster: STABLE3 - rgmanager: Clean up rg_queue.c and related warnings Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).