continue pulling previous thread: mostly constification

* exec/apidef.c (typedef_tpg_join, typedef_tpg_leave)
(typedef_tpg_groups_mcast, typedef_tpg_groups_send_ok):
* exec/sync.c (barrier_data_process, sync_barrier_send)
(sync_start_init, sync_service_init, sync_start_process)
(sync_service_process, sync_deliver_fn, sync_request_send)
(sync_request):
* exec/sync.h (name):
* exec/totemmrp.c (totemmrp_callback_token_create):
* exec/totemmrp.h (TOTEMMRP_H_DEFINED):
* exec/totempg.c (list, app_confchg_fn)
(callback_token_received_fn, totempg_callback_token_create)
(totempg_groups_mcast_joined, totempg_groups_joined_release)
(totempg_groups_mcast_groups):
* exec/totemsrp.c (callback_fn, totemsrp_confchg_fn)
(totemsrp_initialize, totemsrp_callback_token_create):
* exec/totemsrp.h (TOTEMSRP_H_DEFINED):
* exec/vsf_ykd.c (ykd_state_send_msg, ykd_attempt_send_msg)
(ykd_confchg_fn):
* include/corosync/engine/coroapi.h (timer_add_absolute)
(totem_ifaces_print, totem_ip_print, totem_callback_token_create)
(sync_request, plugin_interface_reference):
* include/corosync/totem/totempg.h (TOTEMPG_SAFE):
* services/cpg.c (cpg_confchg_fn):
* services/pload.c (msgs_sent, pload_service_engine)
(send_message, start_mcasting):
* services/votequorum.c (conn, quorum_confchg_fn):

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2030 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Jim Meyering 2009-04-08 06:44:59 +00:00
parent 3a32139cfc
commit 2eba2a6cb8
14 changed files with 101 additions and 86 deletions

View File

@ -59,10 +59,18 @@ LOGSYS_DECLARE_SUBSYS ("APIDEF", LOG_INFO);
/*
* Remove compile warnings about type name changes
*/
typedef int (*typedef_tpg_join) (hdb_handle_t, struct corosync_tpg_group *, int);
typedef int (*typedef_tpg_leave) (hdb_handle_t, struct corosync_tpg_group *, int);
typedef int (*typedef_tpg_groups_mcast) (hdb_handle_t, int, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int);
typedef int (*typedef_tpg_groups_send_ok) (hdb_handle_t, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int);
typedef int (*typedef_tpg_join) (hdb_handle_t,
const struct corosync_tpg_group *, size_t);
typedef int (*typedef_tpg_leave) (hdb_handle_t,
const struct corosync_tpg_group *, size_t);
typedef int (*typedef_tpg_groups_mcast) (hdb_handle_t, int,
const struct corosync_tpg_group *,
size_t groups_cnt,
struct iovec *, int);
typedef int (*typedef_tpg_groups_send_ok) (hdb_handle_t,
const struct corosync_tpg_group *,
size_t groups_cnt,
struct iovec *, int);
static inline void _corosync_public_exit_error (cs_fatal_error_t err,
const char *file,

View File

@ -94,13 +94,15 @@ static struct barrier_data barrier_data_process[PROCESSOR_COUNT_MAX];
static struct openais_vsf_iface_ver0 *vsf_iface;
static int sync_barrier_send (struct memb_ring_id *ring_id);
static int sync_barrier_send (const struct memb_ring_id *ring_id);
static int sync_start_process (enum totem_callback_token_type type, void *data);
static int sync_start_process (enum totem_callback_token_type type,
const void *data);
static void sync_service_init (struct memb_ring_id *ring_id);
static int sync_service_process (enum totem_callback_token_type type, void *data);
static int sync_service_process (enum totem_callback_token_type type,
const void *data);
static void sync_deliver_fn (
unsigned int nodeid,
@ -137,7 +139,7 @@ struct req_exec_sync_barrier_start {
/*
* Send a barrier data structure
*/
static int sync_barrier_send (struct memb_ring_id *ring_id)
static int sync_barrier_send (const struct memb_ring_id *ring_id)
{
struct req_exec_sync_barrier_start req_exec_sync_barrier_start;
struct iovec iovec;
@ -164,7 +166,7 @@ static void sync_start_init (const struct memb_ring_id *ring_id)
TOTEM_CALLBACK_TOKEN_SENT,
0, /* don't delete after callback */
sync_start_process,
(void *)ring_id);
ring_id);
}
static void sync_service_init (struct memb_ring_id *ring_id)
@ -180,13 +182,14 @@ static void sync_service_init (struct memb_ring_id *ring_id)
TOTEM_CALLBACK_TOKEN_SENT,
0, /* don't delete after callback */
sync_service_process,
(void *)ring_id);
ring_id);
}
static int sync_start_process (enum totem_callback_token_type type, void *data)
static int sync_start_process (enum totem_callback_token_type type,
const void *data)
{
int res;
struct memb_ring_id *ring_id = (struct memb_ring_id *)data;
const struct memb_ring_id *ring_id = data;
res = sync_barrier_send (ring_id);
if (res == 0) {
@ -220,10 +223,11 @@ static void sync_callbacks_load (void)
}
}
static int sync_service_process (enum totem_callback_token_type type, void *data)
static int sync_service_process (enum totem_callback_token_type type,
const void *data)
{
int res;
struct memb_ring_id *ring_id = (struct memb_ring_id *)data;
const struct memb_ring_id *ring_id = data;
/*

View File

@ -62,6 +62,6 @@ int sync_primary_designated (void);
*
* @return int 0 OK, error code otherwise
*/
extern int sync_request (char *name);
extern int sync_request (const char *name);
#endif /* SYNC_H_DEFINED */

View File

@ -176,8 +176,8 @@ int totemmrp_callback_token_create (
void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data)
int (*callback_fn) (enum totem_callback_token_type type, const void *),
const void *data)
{
return totemsrp_callback_token_create (totemsrp_handle_in, handle_out, type, delete, callback_fn, data);
}

View File

@ -90,8 +90,8 @@ extern int totemmrp_callback_token_create (
void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data);
int (*callback_fn) (enum totem_callback_token_type type, const void *),
const void *data);
extern void totemmrp_callback_token_destroy (
void *handle_out);

View File

@ -175,7 +175,7 @@ struct assembly {
static void assembly_deref (struct assembly *assembly);
static int callback_token_received_fn (enum totem_callback_token_type type,
void *data);
const void *data);
enum throw_away_mode_t {
THROW_AWAY_INACTIVE,
@ -306,10 +306,10 @@ static void assembly_deref (struct assembly *assembly)
static inline void app_confchg_fn (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id)
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id)
{
int i;
struct totempg_group_instance *instance;
@ -660,7 +660,7 @@ static void totempg_deliver_fn (
void *callback_token_received_handle;
int callback_token_received_fn (enum totem_callback_token_type type,
void *data)
const void *data)
{
struct totempg_mcast mcast;
struct iovec iovecs[3];
@ -962,8 +962,8 @@ int totempg_callback_token_create (
void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data)
int (*callback_fn) (enum totem_callback_token_type type, const void *),
const void *data)
{
unsigned int res;
pthread_mutex_lock (&callback_token_mutex);
@ -1125,7 +1125,7 @@ int totempg_groups_mcast_joined (
for (i = 0; i < instance->groups_cnt; i++) {
group_len[i + 1] = instance->groups[i].group_len;
iovec_mcast[i + 1].iov_len = instance->groups[i].group_len;
iovec_mcast[i + 1].iov_base = instance->groups[i].group;
iovec_mcast[i + 1].iov_base = (void *) instance->groups[i].group;
}
iovec_mcast[0].iov_len = (instance->groups_cnt + 1) * sizeof (unsigned short);
iovec_mcast[0].iov_base = group_len;
@ -1183,13 +1183,14 @@ error_exit:
}
void totempg_groups_joined_release (int msg_count)
int totempg_groups_joined_release (int msg_count)
{
pthread_mutex_lock (&totempg_mutex);
pthread_mutex_lock (&mcast_msg_mutex);
send_release (msg_count);
pthread_mutex_unlock (&mcast_msg_mutex);
pthread_mutex_unlock (&totempg_mutex);
return 0;
}
int totempg_groups_mcast_groups (
@ -1220,7 +1221,7 @@ int totempg_groups_mcast_groups (
for (i = 0; i < groups_cnt; i++) {
group_len[i + 1] = groups[i].group_len;
iovec_mcast[i + 1].iov_len = groups[i].group_len;
iovec_mcast[i + 1].iov_base = groups[i].group;
iovec_mcast[i + 1].iov_base = (void *) groups[i].group;
}
iovec_mcast[0].iov_len = (groups_cnt + 1) * sizeof (unsigned short);
iovec_mcast[0].iov_base = group_len;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2003-2006 MontaVista Software, Inc.
* Copyright (c) 2006-2008 Red Hat, Inc.
* Copyright (c) 2006-2009 Red Hat, Inc.
*
* All rights reserved.
*
@ -160,7 +160,7 @@ struct consensus_list_item {
struct token_callback_instance {
struct list_head list;
int (*callback_fn) (enum totem_callback_token_type type, void *);
int (*callback_fn) (enum totem_callback_token_type type, const void *);
enum totem_callback_token_type callback_type;
int delete;
void *data;
@ -463,10 +463,10 @@ struct totemsrp_instance {
void (*totemsrp_confchg_fn) (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id);
int global_seqno;
@ -699,10 +699,10 @@ int totemsrp_initialize (
void (*confchg_fn) (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id))
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id))
{
struct totemsrp_instance *instance;
unsigned int res;
@ -3005,8 +3005,8 @@ int totemsrp_callback_token_create (
void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data)
int (*callback_fn) (enum totem_callback_token_type type, const void *),
const void *data)
{
struct token_callback_instance *callback_handle;
struct totemsrp_instance *instance;
@ -3020,14 +3020,14 @@ int totemsrp_callback_token_create (
token_hold_cancel_send (instance);
callback_handle = (struct token_callback_instance *)malloc (sizeof (struct token_callback_instance));
callback_handle = malloc (sizeof (struct token_callback_instance));
if (callback_handle == 0) {
return (-1);
}
*handle_out = (void *)callback_handle;
list_init (&callback_handle->list);
callback_handle->callback_fn = callback_fn;
callback_handle->data = data;
callback_handle->data = (void *) data;
callback_handle->callback_type = type;
callback_handle->delete = delete;
switch (type) {
@ -4208,6 +4208,3 @@ void main_iface_change_fn (
void totemsrp_net_mtu_adjust (struct totem_config *totem_config) {
totem_config->net_mtu -= sizeof (struct mcast);
}

View File

@ -1,13 +1,13 @@
/*
* Copyright (c) 2003-2005 MontaVista Software, Inc.
* Copyright (c) 2006-2007 Red Hat, Inc.
* Copyright (c) 2006-2007, 2009 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@redhat.com)
*
* This software licensed under BSD license, the text of which follows:
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@ -58,10 +58,10 @@ int totemsrp_initialize (
int endian_conversion_required),
void (*confchg_fn) (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id));
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id));
void totemsrp_finalize (hdb_handle_t handle);
@ -84,8 +84,8 @@ int totemsrp_callback_token_create (
void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data);
int (*callback_fn) (enum totem_callback_token_type type, const void *),
const void *data);
void totemsrp_callback_token_destroy (
hdb_handle_t handle,

View File

@ -159,7 +159,8 @@ static void ykd_state_init (void)
ykd_state.last_primary.member_list_entries = 0;
}
static int ykd_state_send_msg (enum totem_callback_token_type type, void *context)
static int ykd_state_send_msg (enum totem_callback_token_type type,
const void *context)
{
struct iovec iovec[2];
struct ykd_header header;
@ -188,7 +189,8 @@ static void ykd_state_send (void)
NULL);
}
static int ykd_attempt_send_msg (enum totem_callback_token_type type, void *context)
static int ykd_attempt_send_msg (enum totem_callback_token_type type,
const void *context)
{
struct iovec iovec;
struct ykd_header header;
@ -450,10 +452,10 @@ static void ykd_deliver_fn (
int first_run = 1;
static void ykd_confchg_fn (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id)
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id)
{
int i;

View File

@ -373,7 +373,7 @@ struct corosync_api_v1 {
void *data,
void (*timer_fn) (void *data),
corosync_timer_handle_t *handle);
void (*timer_delete) (
corosync_timer_handle_t timer_handle);
@ -422,17 +422,18 @@ struct corosync_api_v1 {
char ***status,
unsigned int *iface_count);
char *(*totem_ifaces_print) (unsigned int nodeid);
const char *(*totem_ifaces_print) (unsigned int nodeid);
char *(*totem_ip_print) (struct totem_ip_address *addr);
const char *(*totem_ip_print) (const struct totem_ip_address *addr);
int (*totem_callback_token_create) (
void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data);
int (*callback_fn) (enum totem_callback_token_type type,
const void *),
const void *data);
/*
* Totem open process groups API for those service engines
@ -503,7 +504,7 @@ struct corosync_api_v1 {
int reserved_msgs);
int (*sync_request) (
char *service_name);
const char *service_name);
/*
* User plugin-callable functions for quorum
@ -521,7 +522,7 @@ struct corosync_api_v1 {
* Plugin loading and unloading
*/
int (*plugin_interface_reference) (
hdb_handle_t *handle,
hdb_handle_t *handle,
const char *iface_name,
int version,
void **interface,

View File

@ -67,8 +67,8 @@ extern void totempg_finalize (void);
extern int totempg_callback_token_create (void **handle_out,
enum totem_callback_token_type type,
int delete,
int (*callback_fn) (enum totem_callback_token_type type, void *),
void *data);
int (*callback_fn) (enum totem_callback_token_type type, const void *),
const void *data);
extern void totempg_callback_token_destroy (void *handle);
@ -115,7 +115,7 @@ extern int totempg_groups_joined_reserve (
const struct iovec *iovec,
int iov_len);
extern void totempg_groups_joined_release (
extern int totempg_groups_joined_release (
int msg_count);
extern int totempg_groups_mcast_groups (

View File

@ -661,7 +661,9 @@ static void cpg_confchg_fn (
for (i = 0; i < left_list_entries; i++) {
req_exec_cpg_downlist.nodeids[i] = left_list[i];
}
log_printf(LOG_LEVEL_DEBUG, "confchg, build downlist: %d nodes\n", left_list_entries);
log_printf(LOG_LEVEL_DEBUG,
"confchg, build downlist: %lu nodes\n",
(long unsigned int) left_list_entries);
}
}

View File

@ -6,7 +6,7 @@
* Author: Steven Dake (sdake@redhat.com)
*
* This software licensed under BSD license, the text of which follows:
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@ -109,7 +109,7 @@ static unsigned int msg_code = 1;
static unsigned int msgs_sent = 0;
static struct corosync_api_v1 *api;
struct req_exec_pload_start {
@ -151,7 +151,7 @@ struct corosync_service_engine pload_service_engine = {
.name = "corosync profile loading service",
.id = PLOAD_SERVICE,
.private_data_size = 0,
.flow_control = CS_LIB_FLOW_CONTROL_REQUIRED,
.flow_control = CS_LIB_FLOW_CONTROL_REQUIRED,
.lib_init_fn = pload_lib_init_fn,
.lib_exit_fn = pload_lib_exit_fn,
.lib_engine = pload_lib_engine,
@ -258,7 +258,7 @@ static void req_exec_pload_mcast_endian_convert (void *msg)
{
}
static int send_message (enum totem_callback_token_type type, void *arg)
static int send_message (enum totem_callback_token_type type, const void *arg)
{
struct req_exec_pload_mcast req_exec_pload_mcast;
struct iovec iov[2];
@ -300,9 +300,9 @@ static void start_mcasting (void)
&token_callback,
TOTEM_CALLBACK_TOKEN_RECEIVED,
1,
send_message,
send_message,
&token_callback);
}
}
static void message_handler_req_exec_pload_start (
const void *msg,

View File

@ -173,10 +173,10 @@ static void votequorum_init(struct corosync_api_v1 *api,
static void quorum_confchg_fn (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id);
static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
int endian_conversion_required);
@ -910,10 +910,10 @@ static int quorum_exec_send_killnode(int nodeid, unsigned int reason)
static void quorum_confchg_fn (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id)
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id)
{
int i;
int leaving = 0;