On Fri, 2009-04-10 at 18:57 +0200, Jim Meyering wrote:
> Here's a big const-adding change that doesn't touch APIs much.
> However, it's important for internal consistency.
>
> There is one snag, though, which means this patch isn't quite
> committable:
>
> The first clue was a prototype mismatch for
> message_handler_memb_merge_detect. It seemed like
> it should be like the 5 other handlers here:
> [this is in totemsrp.c]
>
> struct message_handlers {
> int count;
> int (*handler_functions[6]) (
> struct totemsrp_instance *instance,
> const void *msg,
> size_t msg_len,
> int endian_conversion_needed);
> };
>
> struct message_handlers totemsrp_message_handlers = {
> 6,
> {
> message_handler_orf_token,
> message_handler_mcast,
> message_handler_memb_merge_detect,
> message_handler_memb_join,
> message_handler_memb_commit_token,
> message_handler_token_hold_cancel
> }
> };
>
> and have a "const" "msg" parameter.
> However, currently it calls memb_merge_detect_endian_convert (msg,
> msg) which modifies *msg, which implies its "msg" can't be "const".
> Yet nothing else in that function uses the modified "msg". Maybe the
> caller requires that *msg be modified?
>
The msg parameter is used in the assignment to merge_detect_timeout
variable.
The endian conversion is absolutely necessary.
What I suggest is to make a second variable which is the endian
converted version and either a) endian convert if necessary or b) memcpy
the message to the data structure if not endian converting.
|
If you don't know what I mean, let me know and I'll work out a patch.
Regards
-steve
> There are two solutions:
>
> - if it really does need to modify *msg, change the sole
> use of totemsrp_message_handlers.handler_functions to treat
> the merge_detect case differently from the others.
>
> - if it doesn't need to, remove the memb_merge_detect_endian_convert call
>
> Let me know and I'll adjust.
>
> From 8a10c661510738bb59bd9685debd9e0162158814 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email protected]>
> Date: Fri, 10 Apr 2009 10:37:29 +0200
> Subject: [PATCH] totemrrp.h, totemsrp.h, totemnet.h: const+size_t
>
> * exec/totemrrp.c (totemrrp_initialize):
> * exec/totemrrp.h (totemrrp_initialize):
> * exec/totemsrp.c (handler_functions, main_deliver_fn):
> (main_iface_change_fn):
> * exec/totemnet.c (totemnet_deliver_fn, totemnet_iface_change_fn):
> (encrypt_and_sign_worker, ucast_sendmsg, mcast_sendmsg):
> (totemnet_mcast_worker_fn, totemnet_initialize):
> (totemnet_token_send, totemnet_mcast_flush_send):
> (totemnet_mcast_noflush_send, totemnet_token_target_set):
> * exec/totemnet.h (TOTEMNET_FLUSH):
> * exec/totemrrp.c (totemrrp_deliver_fn, totemrrp_iface_change_fn):
> (totemrrp_token_seqid_get, rrp_deliver_fn, rrp_iface_change_fn):
> * exec/totemsrp.c (handler_functions, main_token_seqid_get):
> (srp_addr_copy_endian_convert, message_handler_orf_token):
> (message_handler_mcast, message_handler_memb_merge_detect):
> (memb_join_endian_convert, memb_commit_token_endian_convert):
> (orf_token_endian_convert, mcast_endian_convert):
> (memb_merge_detect_endian_convert, message_handler_memb_join):
> (message_handler_memb_commit_token):
> (message_handler_token_hold_cancel, main_deliver_fn):
> ---
> exec/main.c | 2 +-
> exec/sync.c | 4 +-
> exec/totemmrp.c | 8 +-
> exec/totemmrp.h | 4 +-
> exec/totemnet.c | 56 ++++++++--------
> exec/totemnet.h | 16 ++--
> exec/totempg.c | 10 ++--
> exec/totemrrp.c | 134 ++++++++++++++++++------------------
> exec/totemrrp.h | 18 +++---
> exec/totemsrp.c | 94 +++++++++++++-------------
> exec/totemsrp.h | 2 +-
> exec/vsf_ykd.c | 2 +-
> include/corosync/engine/coroapi.h | 2 +-
> include/corosync/totem/totempg.h | 10 ++--
> services/votequorum.c | 6 +-
> 15 files changed, 185 insertions(+), 183 deletions(-)
>
> diff --git a/exec/main.c b/exec/main.c
> index f88f73b..6599f8d 100644
> --- a/exec/main.c
> +++ b/exec/main.c
> @@ -412,7 +412,7 @@ static void corosync_mlockall (void)
>
> static void deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required)
> {
> diff --git a/exec/sync.c b/exec/sync.c
> index 6521c84..9d2873a 100644
> --- a/exec/sync.c
> +++ b/exec/sync.c
> @@ -102,7 +102,7 @@ static int sync_service_process (enum
> totem_callback_token_type type,
>
> static void sync_deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required);
>
> @@ -327,7 +327,7 @@ static void sync_endian_convert (struct
> req_exec_sync_barrier_start
>
> static void sync_deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required)
> {
> diff --git a/exec/totemmrp.c b/exec/totemmrp.c
> index 02635ac..949756b 100644
> --- a/exec/totemmrp.c
> +++ b/exec/totemmrp.c
> @@ -68,7 +68,7 @@ hdb_handle_t totemsrp_handle_in;
>
> void totemmrp_deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required);
>
> @@ -81,7 +81,7 @@ void totemmrp_confchg_fn (
>
> void (*pg_deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required) = 0;
>
> @@ -94,7 +94,7 @@ void (*pg_confchg_fn) (
>
> void totemmrp_deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required)
> {
> @@ -124,7 +124,7 @@ int totemmrp_initialize (
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
> void (*confchg_fn) (
> diff --git a/exec/totemmrp.h b/exec/totemmrp.h
> index e1e02bf..8ae9378 100644
> --- a/exec/totemmrp.h
> +++ b/exec/totemmrp.h
> @@ -7,7 +7,7 @@
> * Author: Steven Dake ([email protected])
> *
> * 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:
> *
> @@ -61,7 +61,7 @@ extern int totemmrp_initialize (
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
> void (*confchg_fn) (
> diff --git a/exec/totemnet.c b/exec/totemnet.c
> index 01338ed..6a75300 100644
> --- a/exec/totemnet.c
> +++ b/exec/totemnet.c
> @@ -1,13 +1,13 @@
> /*
> * Copyright (c) 2005 MontaVista Software, Inc.
> - * Copyright (c) 2006-2008 Red Hat, Inc.
> + * Copyright (c) 2006-2009 Red Hat, Inc.
> *
> * All rights reserved.
> *
> * Author: Steven Dake ([email protected])
>
> * 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:
> *
> @@ -119,12 +119,12 @@ struct totemnet_instance {
>
> void (*totemnet_deliver_fn) (
> void *context,
> - void *msg,
> - int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> void (*totemnet_iface_change_fn) (
> void *context,
> - struct totem_ip_address *iface_address);
> + const struct totem_ip_address *iface_address);
>
> /*
> * Function and data used to log messages
> @@ -297,9 +297,9 @@ static int authenticate_and_decrypt (
> static void encrypt_and_sign_worker (
> struct totemnet_instance *instance,
> unsigned char *buf,
> - int *buf_len,
> - struct iovec *iovec,
> - unsigned int iov_len,
> + size_t *buf_len,
> + const struct iovec *iovec,
> + size_t iov_len,
> prng_state *prng_state_in)
> {
> int i;
> @@ -310,7 +310,7 @@ static void encrypt_and_sign_worker (
> unsigned char *cipher_key = &keys[16];
> unsigned char *initial_vector = &keys[0];
> unsigned long len;
> - int outlen = 0;
> + size_t outlen = 0;
> hmac_state hmac_state;
> prng_state keygen_prng_state;
> prng_state stream_prng_state;
> @@ -379,16 +379,16 @@ static void encrypt_and_sign_worker (
> static inline void ucast_sendmsg (
> struct totemnet_instance *instance,
> struct totem_ip_address *system_to,
> - struct iovec *iovec_in,
> - unsigned int iov_len_in)
> + const struct iovec *iovec_in,
> + size_t iov_len_in)
> {
> struct msghdr msg_ucast;
> int res = 0;
> - int buf_len;
> + size_t buf_len;
> unsigned char sheader[sizeof (struct security_header)];
> unsigned char encrypt_data[FRAME_SIZE_MAX];
> struct iovec iovec_encrypt[20];
> - struct iovec *iovec_sendmsg;
> + const struct iovec *iovec_sendmsg;
> struct sockaddr_storage sockaddr;
> unsigned int iov_len;
> int addrlen;
> @@ -427,7 +427,7 @@ static inline void ucast_sendmsg (
> instance->totem_interface->ip_port, &sockaddr, &addrlen);
> msg_ucast.msg_name = &sockaddr;
> msg_ucast.msg_namelen = addrlen;
> - msg_ucast.msg_iov = iovec_sendmsg;
> + msg_ucast.msg_iov = (void *) iovec_sendmsg;
> msg_ucast.msg_iovlen = iov_len;
> msg_ucast.msg_control = 0;
> msg_ucast.msg_controllen = 0;
> @@ -443,16 +443,16 @@ static inline void ucast_sendmsg (
>
> static inline void mcast_sendmsg (
> struct totemnet_instance *instance,
> - struct iovec *iovec_in,
> - unsigned int iov_len_in)
> + const struct iovec *iovec_in,
> + size_t iov_len_in)
> {
> struct msghdr msg_mcast;
> int res = 0;
> - int buf_len;
> + size_t buf_len;
> unsigned char sheader[sizeof (struct security_header)];
> unsigned char encrypt_data[FRAME_SIZE_MAX];
> struct iovec iovec_encrypt[20];
> - struct iovec *iovec_sendmsg;
> + const struct iovec *iovec_sendmsg;
> struct sockaddr_storage sockaddr;
> unsigned int iov_len;
> int addrlen;
> @@ -491,7 +491,7 @@ static inline void mcast_sendmsg (
> instance->totem_interface->ip_port, &sockaddr, &addrlen);
> msg_mcast.msg_name = &sockaddr;
> msg_mcast.msg_namelen = addrlen;
> - msg_mcast.msg_iov = iovec_sendmsg;
> + msg_mcast.msg_iov = (void *) iovec_sendmsg;
> msg_mcast.msg_iovlen = iov_len;
> msg_mcast.msg_control = 0;
> msg_mcast.msg_controllen = 0;
> @@ -527,7 +527,7 @@ static void totemnet_mcast_worker_fn (void *thread_state,
> void *work_item_in)
> struct msghdr msg_mcast;
> unsigned char sheader[sizeof (struct security_header)];
> int res = 0;
> - int buf_len;
> + size_t buf_len;
> struct iovec iovec_encrypted;
> struct iovec *iovec_sendmsg;
> struct sockaddr_storage sockaddr;
> @@ -1157,12 +1157,12 @@ int totemnet_initialize (
>
> void (*deliver_fn) (
> void *context,
> - void *msg,
> - int msg_len),
> + const void *msg,
> + size_t msg_len),
>
> void (*iface_change_fn) (
> void *context,
> - struct totem_ip_address *iface_address))
> + const struct totem_ip_address *iface_address))
> {
> struct totemnet_instance *instance;
> unsigned int res;
> @@ -1334,7 +1334,7 @@ error_exit:
>
> int totemnet_token_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct totemnet_instance *instance;
> @@ -1356,7 +1356,7 @@ error_exit:
> }
> int totemnet_mcast_flush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct totemnet_instance *instance;
> @@ -1379,7 +1379,7 @@ error_exit:
>
> int totemnet_mcast_noflush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct totemnet_instance *instance;
> @@ -1481,7 +1481,7 @@ error_exit:
>
> int totemnet_token_target_set (
> hdb_handle_t handle,
> - struct totem_ip_address *token_target)
> + const struct totem_ip_address *token_target)
> {
> struct totemnet_instance *instance;
> unsigned int res;
> @@ -1500,5 +1500,3 @@ int totemnet_token_target_set (
> error_exit:
> return (res);
> }
> -
> -
> diff --git a/exec/totemnet.h b/exec/totemnet.h
> index e7a3b8c..e3be277 100644
> --- a/exec/totemnet.h
> +++ b/exec/totemnet.h
> @@ -1,6 +1,6 @@
> /*
> * Copyright (c) 2005 MontaVista Software, Inc.
> - * Copyright (c) 2006-2007 Red Hat, Inc.
> + * Copyright (c) 2006-2007, 2009 Red Hat, Inc.
> *
> * All rights reserved.
> *
> @@ -59,12 +59,12 @@ extern int totemnet_initialize (
>
> void (*deliver_fn) (
> void *context,
> - void *msg,
> - int msg_len),
> + const void *msg,
> + size_t msg_len),
>
> void (*iface_change_fn) (
> void *context,
> - struct totem_ip_address *iface_address));
> + const struct totem_ip_address *iface_address));
>
> extern int totemnet_processor_count_set (
> hdb_handle_t handle,
> @@ -72,17 +72,17 @@ extern int totemnet_processor_count_set (
>
> extern int totemnet_token_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> extern int totemnet_mcast_flush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> extern int totemnet_mcast_noflush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> extern int totemnet_recv_flush (hdb_handle_t handle);
> @@ -103,6 +103,6 @@ extern int totemnet_iface_get (
>
> extern int totemnet_token_target_set (
> hdb_handle_t handle,
> - struct totem_ip_address *token_target);
> + const struct totem_ip_address *token_target);
>
> #endif /* TOTEMNET_H_DEFINED */
> diff --git a/exec/totempg.c b/exec/totempg.c
> index 8ba64ce..ee4c243 100644
> --- a/exec/totempg.c
> +++ b/exec/totempg.c
> @@ -66,7 +66,7 @@
>
> /*
> * ASSEMBLY AND UNPACKING ALGORITHM:
> - *
> + *
> * copy incoming packet into assembly data buffer indexed by current
> * location of end of fragment
> *
> @@ -79,7 +79,7 @@
> * else
> * if msg_count = 1 and fragmented
> * do nothing
> - *
> + *
> */
>
> #include <config.h>
> @@ -211,7 +211,7 @@ static unsigned int totempg_max_handle = 0;
> struct totempg_group_instance {
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required);
>
> @@ -497,7 +497,7 @@ static void totempg_confchg_fn (
>
> static void totempg_deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required)
> {
> @@ -985,7 +985,7 @@ int totempg_groups_initialize (
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
>
> diff --git a/exec/totemrrp.c b/exec/totemrrp.c
> index ef56df0..d28dc5b 100644
> --- a/exec/totemrrp.c
> +++ b/exec/totemrrp.c
> @@ -1,6 +1,6 @@
> /*
> * Copyright (c) 2005 MontaVista Software, Inc.
> - * Copyright (c) 2006-2008 Red Hat, Inc.
> + * Copyright (c) 2006-2009 Red Hat, Inc.
> *
> * All rights reserved.
> *
> @@ -70,12 +70,12 @@
>
> void rrp_deliver_fn (
> void *context,
> - void *msg,
> - int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> void rrp_iface_change_fn (
> void *context,
> - struct totem_ip_address *iface_addr);
> + const struct totem_ip_address *iface_addr);
>
> struct totemrrp_instance;
> struct passive_instance {
> @@ -116,30 +116,30 @@ struct rrp_algo {
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> void (*mcast_noflush_send) (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> void (*mcast_flush_send) (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> void (*token_recv) (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seqid);
>
> void (*token_send) (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> void (*recv_flush) (
> @@ -177,16 +177,16 @@ struct totemrrp_instance {
>
> void (*totemrrp_deliver_fn) (
> void *context,
> - void *msg,
> - int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> void (*totemrrp_iface_change_fn) (
> void *context,
> - struct totem_ip_address *iface_addr,
> + const struct totem_ip_address *iface_addr,
> unsigned int iface_no);
>
> void (*totemrrp_token_seqid_get) (
> - void *msg,
> + const void *msg,
> unsigned int *seqid,
> unsigned int *token_is);
>
> @@ -233,30 +233,30 @@ static void none_mcast_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> static void none_mcast_noflush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void none_mcast_flush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void none_token_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seqid);
>
> static void none_token_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void none_recv_flush (
> @@ -291,30 +291,30 @@ static void passive_mcast_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> static void passive_mcast_noflush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void passive_mcast_flush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void passive_token_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seqid);
>
> static void passive_token_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void passive_recv_flush (
> @@ -349,30 +349,30 @@ static void active_mcast_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> static void active_mcast_noflush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void active_mcast_flush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void active_token_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seqid);
>
> static void active_token_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> static void active_recv_flush (
> @@ -485,8 +485,8 @@ static void none_mcast_recv (
> struct totemrrp_instance *rrp_instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len)
> + const void *msg,
> + size_t msg_len)
> {
> rrp_instance->totemrrp_deliver_fn (
> context,
> @@ -496,7 +496,7 @@ static void none_mcast_recv (
>
> static void none_mcast_flush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> totemnet_mcast_flush_send (instance->net_handles[0], iovec, iov_len);
> @@ -504,7 +504,7 @@ static void none_mcast_flush_send (
>
> static void none_mcast_noflush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> totemnet_mcast_noflush_send (instance->net_handles[0], iovec, iov_len);
> @@ -514,8 +514,8 @@ static void none_token_recv (
> struct totemrrp_instance *rrp_instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seq)
> {
> rrp_instance->totemrrp_deliver_fn (
> @@ -526,7 +526,7 @@ static void none_token_recv (
>
> static void none_token_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> totemnet_token_send (
> @@ -685,8 +685,8 @@ static void passive_mcast_recv (
> struct totemrrp_instance *rrp_instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len)
> + const void *msg,
> + size_t msg_len)
> {
> struct passive_instance *passive_instance = (struct passive_instance
> *)rrp_instance->rrp_algo_instance;
> unsigned int max;
> @@ -740,7 +740,7 @@ static void passive_mcast_recv (
>
> static void passive_mcast_flush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct passive_instance *passive_instance = (struct passive_instance
> *)instance->rrp_algo_instance;
> @@ -754,7 +754,7 @@ static void passive_mcast_flush_send (
>
> static void passive_mcast_noflush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct passive_instance *passive_instance = (struct passive_instance
> *)instance->rrp_algo_instance;
> @@ -771,8 +771,8 @@ static void passive_token_recv (
> struct totemrrp_instance *rrp_instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seq)
> {
> struct passive_instance *passive_instance = (struct passive_instance
> *)rrp_instance->rrp_algo_instance;
> @@ -824,7 +824,7 @@ static void passive_token_recv (
>
> static void passive_token_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct passive_instance *passive_instance = (struct passive_instance
> *)instance->rrp_algo_instance;
> @@ -1094,8 +1094,8 @@ static void active_mcast_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len)
> + const void *msg,
> + size_t msg_len)
> {
> instance->totemrrp_deliver_fn (
> context,
> @@ -1105,7 +1105,7 @@ static void active_mcast_recv (
>
> static void active_mcast_flush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> int i;
> @@ -1120,7 +1120,7 @@ static void active_mcast_flush_send (
>
> static void active_mcast_noflush_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> int i;
> @@ -1137,8 +1137,8 @@ static void active_token_recv (
> struct totemrrp_instance *instance,
> unsigned int iface_no,
> void *context,
> - void *msg,
> - unsigned int msg_len,
> + const void *msg,
> + size_t msg_len,
> unsigned int token_seq)
> {
> int i;
> @@ -1177,7 +1177,7 @@ static void active_token_recv (
>
> static void active_token_send (
> struct totemrrp_instance *instance,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct active_instance *rrp_algo_instance = (struct active_instance
> *)instance->rrp_algo_instance;
> @@ -1308,8 +1308,8 @@ static int totemrrp_algorithm_set (
>
> void rrp_deliver_fn (
> void *context,
> - void *msg,
> - int msg_len)
> + const void *msg,
> + size_t msg_len)
> {
> unsigned int token_seqid;
> unsigned int token_is;
> @@ -1347,7 +1347,7 @@ void rrp_deliver_fn (
>
> void rrp_iface_change_fn (
> void *context,
> - struct totem_ip_address *iface_addr)
> + const struct totem_ip_address *iface_addr)
> {
> struct deliver_fn_context *deliver_fn_context = (struct
> deliver_fn_context *)context;
>
> @@ -1397,16 +1397,16 @@ int totemrrp_initialize (
>
> void (*deliver_fn) (
> void *context,
> - void *msg,
> - int msg_len),
> + const void *msg,
> + size_t msg_len),
>
> void (*iface_change_fn) (
> void *context,
> - struct totem_ip_address *iface_addr,
> + const struct totem_ip_address *iface_addr,
> unsigned int iface_no),
>
> void (*token_seqid_get) (
> - void *msg,
> + const void *msg,
> unsigned int *seqid,
> unsigned int *token_is),
>
> @@ -1589,7 +1589,7 @@ error_exit:
>
> int totemrrp_token_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct totemrrp_instance *instance;
> @@ -1612,7 +1612,7 @@ error_exit:
>
> int totemrrp_mcast_flush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct totemrrp_instance *instance;
> @@ -1635,7 +1635,7 @@ error_exit:
>
> int totemrrp_mcast_noflush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len)
> {
> struct totemrrp_instance *instance;
> diff --git a/exec/totemrrp.h b/exec/totemrrp.h
> index 20eed2f..b5926b2 100644
> --- a/exec/totemrrp.h
> +++ b/exec/totemrrp.h
> @@ -1,13 +1,13 @@
> /*
> * Copyright (c) 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 ([email protected])
> *
> * 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:
> *
> @@ -59,16 +59,16 @@ extern int totemrrp_initialize (
>
> void (*deliver_fn) (
> void *context,
> - void *msg,
> - int msg_len),
> + const void *msg,
> + size_t msg_len),
>
> void (*iface_change_fn) (
> void *context,
> - struct totem_ip_address *iface_addr,
> + const struct totem_ip_address *iface_addr,
> unsigned int iface_no),
>
> void (*token_seqid_get) (
> - void *msg,
> + const void *msg,
> unsigned int *seqid,
> unsigned int *token_is),
>
> @@ -81,17 +81,17 @@ extern int totemrrp_processor_count_set (
>
> extern int totemrrp_token_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> extern int totemrrp_mcast_noflush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> extern int totemrrp_mcast_flush_send (
> hdb_handle_t handle,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len);
>
> extern int totemrrp_recv_flush (hdb_handle_t handle);
> diff --git a/exec/totemsrp.c b/exec/totemsrp.c
> index d10dec0..cac4b14 100644
> --- a/exec/totemsrp.c
> +++ b/exec/totemsrp.c
> @@ -507,8 +507,8 @@ struct message_handlers {
> int count;
> int (*handler_functions[6]) (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
> };
>
> @@ -517,38 +517,38 @@ struct message_handlers {
> */
> static int message_handler_orf_token (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
>
> static int message_handler_mcast (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
>
> static int message_handler_memb_merge_detect (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
>
> static int message_handler_memb_join (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
>
> static int message_handler_memb_commit_token (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
>
> static int message_handler_token_hold_cancel (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed);
>
> static void totemsrp_instance_initialize (struct totemsrp_instance
> *instance);
> @@ -556,7 +556,7 @@ static void totemsrp_instance_initialize (struct
> totemsrp_instance *instance);
> static unsigned int main_msgs_missing (void);
>
> static void main_token_seqid_get (
> - void *msg,
> + const void *msg,
> unsigned int *seqid,
> unsigned int *token_is);
>
> @@ -585,14 +585,14 @@ static void memb_state_commit_token_target_set (struct
> totemsrp_instance *instan
> static int memb_state_commit_token_send (struct totemsrp_instance *instance,
> struct memb_commit_token *memb_commit_token);
> static void memb_state_commit_token_create (struct totemsrp_instance
> *instance, struct memb_commit_token *commit_token);
> static int token_hold_cancel_send (struct totemsrp_instance *instance);
> -static void orf_token_endian_convert (struct orf_token *in, struct orf_token
> *out);
> -static void memb_commit_token_endian_convert (struct memb_commit_token *in,
> struct memb_commit_token *out);
> -static void memb_join_endian_convert (struct memb_join *in, struct memb_join
> *out);
> -static void mcast_endian_convert (struct mcast *in, struct mcast *out);
> +static void orf_token_endian_convert (const struct orf_token *in, struct
> orf_token *out);
> +static void memb_commit_token_endian_convert (const struct memb_commit_token
> *in, struct memb_commit_token *out);
> +static void memb_join_endian_convert (const struct memb_join *in, struct
> memb_join *out);
> +static void mcast_endian_convert (const struct mcast *in, struct mcast *out);
> static void memb_merge_detect_endian_convert (
> struct memb_merge_detect *in,
> struct memb_merge_detect *out);
> -static void srp_addr_copy_endian_convert (struct srp_addr *out, struct
> srp_addr *in);
> +static void srp_addr_copy_endian_convert (struct srp_addr *out, const struct
> srp_addr *in);
> static void timer_function_orf_token_timeout (void *data);
> static void timer_function_heartbeat_timeout (void *data);
> static void timer_function_token_retransmit_timeout (void *data);
> @@ -601,12 +601,12 @@ static void timer_function_merge_detect_timeout (void
> *data);
>
> void main_deliver_fn (
> void *context,
> - void *msg,
> - int msg_len);
> + const void *msg,
> + size_t msg_len);
>
> void main_iface_change_fn (
> void *context,
> - struct totem_ip_address *iface_address,
> + const struct totem_ip_address *iface_address,
> unsigned int iface_no);
>
> /*
> @@ -659,7 +659,7 @@ static void totemsrp_instance_initialize (struct
> totemsrp_instance *instance)
> }
>
> static void main_token_seqid_get (
> - void *msg,
> + const void *msg,
> unsigned int *seqid,
> unsigned int *token_is)
> {
> @@ -689,7 +689,7 @@ int totemsrp_initialize (
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
>
> @@ -1037,7 +1037,7 @@ static void srp_addr_to_nodeid (
> }
> }
>
> -static void srp_addr_copy_endian_convert (struct srp_addr *out, struct
> srp_addr *in)
> +static void srp_addr_copy_endian_convert (struct srp_addr *out, const struct
> srp_addr *in)
> {
> int i;
>
> @@ -3188,8 +3188,8 @@ struct timeval tv_old;
> */
> static int message_handler_orf_token (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed)
> {
> char token_storage[1500];
> @@ -3612,8 +3612,8 @@ static void messages_deliver_to_app (
> */
> static int message_handler_mcast (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed)
> {
> struct sort_queue_item sort_queue_item;
> @@ -3734,8 +3734,8 @@ static int message_handler_mcast (
>
> static int message_handler_memb_merge_detect (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed)
> {
> struct memb_merge_detect *memb_merge_detect = (struct memb_merge_detect
> *)msg;
> @@ -3862,7 +3862,7 @@ static int memb_join_process (
> return (0); /* gather not entered */
> }
>
> -static void memb_join_endian_convert (struct memb_join *in, struct memb_join
> *out)
> +static void memb_join_endian_convert (const struct memb_join *in, struct
> memb_join *out)
> {
> int i;
> struct srp_addr *in_proc_list;
> @@ -3891,7 +3891,7 @@ static void memb_join_endian_convert (struct memb_join
> *in, struct memb_join *ou
> }
> }
>
> -static void memb_commit_token_endian_convert (struct memb_commit_token *in,
> struct memb_commit_token *out)
> +static void memb_commit_token_endian_convert (const struct memb_commit_token
> *in, struct memb_commit_token *out)
> {
> int i;
> struct srp_addr *in_addr = (struct srp_addr *)in->end_of_commit_token;
> @@ -3930,7 +3930,7 @@ static void memb_commit_token_endian_convert (struct
> memb_commit_token *in, stru
> }
> }
>
> -static void orf_token_endian_convert (struct orf_token *in, struct orf_token
> *out)
> +static void orf_token_endian_convert (const struct orf_token *in, struct
> orf_token *out)
> {
> int i;
>
> @@ -3954,7 +3954,7 @@ static void orf_token_endian_convert (struct orf_token
> *in, struct orf_token *ou
> }
> }
>
> -static void mcast_endian_convert (struct mcast *in, struct mcast *out)
> +static void mcast_endian_convert (const struct mcast *in, struct mcast *out)
> {
> out->header.type = in->header.type;
> out->header.endian_detector = ENDIAN_LOCAL;
> @@ -3984,8 +3984,8 @@ static void memb_merge_detect_endian_convert (
>
> static int message_handler_memb_join (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed)
> {
> struct memb_join *memb_join;
> @@ -4049,8 +4049,8 @@ static int message_handler_memb_join (
>
> static int message_handler_memb_commit_token (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed)
> {
> struct memb_commit_token *memb_commit_token_convert = alloca (msg_len);
> @@ -4130,8 +4130,8 @@ static int message_handler_memb_commit_token (
>
> static int message_handler_token_hold_cancel (
> struct totemsrp_instance *instance,
> - void *msg,
> - int msg_len,
> + const void *msg,
> + size_t msg_len,
> int endian_conversion_needed)
> {
> struct token_hold_cancel *token_hold_cancel = (struct token_hold_cancel
> *)msg;
> @@ -4149,14 +4149,16 @@ static int message_handler_token_hold_cancel (
>
> void main_deliver_fn (
> void *context,
> - void *msg,
> - int msg_len)
> + const void *msg,
> + size_t msg_len)
> {
> struct totemsrp_instance *instance = (struct totemsrp_instance
> *)context;
> struct message_header *message_header = (struct message_header *)msg;
>
> if (msg_len < sizeof (struct message_header)) {
> - log_printf (instance->totemsrp_log_level_security, "Received
> message is too short... ignoring %d.\n", msg_len);
> + log_printf (instance->totemsrp_log_level_security,
> + "Received message is too short... ignoring %u.\n",
> + (unsigned int)msg_len);
> return;
> }
>
> @@ -4177,7 +4179,7 @@ void main_deliver_fn (
>
> void main_iface_change_fn (
> void *context,
> - struct totem_ip_address *iface_addr,
> + const struct totem_ip_address *iface_addr,
> unsigned int iface_no)
> {
> struct totemsrp_instance *instance = (struct totemsrp_instance
> *)context;
> diff --git a/exec/totemsrp.h b/exec/totemsrp.h
> index 09ebcb8..5f76dff 100644
> --- a/exec/totemsrp.h
> +++ b/exec/totemsrp.h
> @@ -53,7 +53,7 @@ int totemsrp_initialize (
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
> void (*confchg_fn) (
> diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c
> index 83353c6..091a3ae 100644
> --- a/exec/vsf_ykd.c
> +++ b/exec/vsf_ykd.c
> @@ -341,7 +341,7 @@ static void ykd_state_endian_convert (struct ykd_state
> *ykd_state)
>
> static void ykd_deliver_fn (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required)
> {
> diff --git a/include/corosync/engine/coroapi.h
> b/include/corosync/engine/coroapi.h
> index 13e07ad..779b0c0 100644
> --- a/include/corosync/engine/coroapi.h
> +++ b/include/corosync/engine/coroapi.h
> @@ -446,7 +446,7 @@ struct corosync_api_v1 {
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
>
> diff --git a/include/corosync/totem/totempg.h
> b/include/corosync/totem/totempg.h
> index dffdad9..89bfd7c 100644
> --- a/include/corosync/totem/totempg.h
> +++ b/include/corosync/totem/totempg.h
> @@ -7,7 +7,7 @@
> * Author: Steven Dake ([email protected])
> *
> * 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:
> *
> @@ -80,7 +80,7 @@ extern int totempg_groups_initialize (
>
> void (*deliver_fn) (
> unsigned int nodeid,
> - struct iovec *iovec,
> + const struct iovec *iovec,
> unsigned int iov_len,
> int endian_conversion_required),
>
> @@ -117,7 +117,7 @@ extern int totempg_groups_joined_reserve (
>
> extern int totempg_groups_joined_release (
> int msg_count);
> -
> +
> extern int totempg_groups_mcast_groups (
> hdb_handle_t handle,
> int guarantee,
> @@ -132,7 +132,7 @@ extern int totempg_groups_send_ok_groups (
> size_t groups_cnt,
> const struct iovec *iovec,
> unsigned int iov_len);
> -
> +
> extern int totempg_ifaces_get (
> unsigned int nodeid,
> struct totem_ip_address *interfaces,
> @@ -146,5 +146,5 @@ extern unsigned int totempg_my_nodeid_get (void);
> extern int totempg_my_family_get (void);
>
> extern int totempg_ring_reenable (void);
> -
> +
> #endif /* TOTEMPG_H_DEFINED */
> diff --git a/services/votequorum.c b/services/votequorum.c
> index 5834ed0..9f85b46 100644
> --- a/services/votequorum.c
> +++ b/services/votequorum.c
> @@ -178,7 +178,8 @@ static void quorum_confchg_fn (
> 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,
> unsigned int iov_len,
> +static void quorum_deliver_fn(unsigned int nodeid,
> + const struct iovec *iovec, unsigned int iov_len,
> int endian_conversion_required);
>
> static int votequorum_exec_init_fn (struct corosync_api_v1 *corosync_api);
> @@ -988,7 +989,8 @@ static void exec_quorum_killnode_endian_convert (void
> *msg)
> killnode->nodeid = swab32(killnode->nodeid);
> }
>
> -static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec,
> unsigned int iov_len,
> +static void quorum_deliver_fn(unsigned int nodeid,
> + const struct iovec *iovec, unsigned int iov_len,
> int endian_conversion_required)
> {
> struct q_protheader *header = iovec->iov_base;
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais