From 09cf0fe6b91fd71d8963de53bc6322b990ee3a53 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 18 Jan 2010 20:08:44 +0000 Subject: [PATCH] Misc compilation clean-ups. --- daemons/cmirrord/clogd.c | 6 +++--- daemons/cmirrord/cluster.c | 12 ++++++------ daemons/cmirrord/compat.c | 4 ++-- daemons/cmirrord/functions.c | 22 +++++++++++----------- daemons/cmirrord/link_mon.c | 5 +++-- daemons/cmirrord/link_mon.h | 2 +- daemons/cmirrord/local.c | 8 ++++---- daemons/cmirrord/logging.c | 2 +- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/daemons/cmirrord/clogd.c b/daemons/cmirrord/clogd.c index d277803ab..5c23851e1 100644 --- a/daemons/cmirrord/clogd.c +++ b/daemons/cmirrord/clogd.c @@ -46,7 +46,7 @@ static void daemonize(void); static void init_all(void); static void cleanup_all(void); -int main(int argc, char *argv[]) +int main(int argc __attribute((unused)), char *argv[] __attribute((unused))) { daemonize(); @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) * @sig: the signal * */ -static void parent_exit_handler(int sig) +static void parent_exit_handler(int sig __attribute((unused))) { exit_now = 1; } @@ -85,7 +85,7 @@ static void parent_exit_handler(int sig) * * Returns: 0 on success, -1 otherwise */ -static int create_lockfile(char *lockfile) +static int create_lockfile(const char *lockfile) { int fd; struct flock lock; diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c index bd2fd2e90..515d07e7f 100644 --- a/daemons/cmirrord/cluster.c +++ b/daemons/cmirrord/cluster.c @@ -227,7 +227,7 @@ static struct clog_request *get_matching_rq(struct clog_request *rq, } static char rq_buffer[DM_ULOG_REQUEST_SIZE]; -static int handle_cluster_request(struct clog_cpg *entry, +static int handle_cluster_request(struct clog_cpg *entry __attribute((unused)), struct clog_request *rq, int server) { int r = 0; @@ -867,7 +867,7 @@ static int resend_requests(struct clog_cpg *entry) return r; } -static int do_cluster_work(void *data) +static int do_cluster_work(void *data __attribute((unused))) { int r = SA_AIS_OK; struct clog_cpg *entry; @@ -939,8 +939,8 @@ static int flush_startup_list(struct clog_cpg *entry) return 0; } -static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gname, - uint32_t nodeid, uint32_t pid, +static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gname __attribute((unused)), + uint32_t nodeid, uint32_t pid __attribute((unused)), void *msg, size_t msg_len) { int i; @@ -1377,7 +1377,7 @@ static void cpg_leave_callback(struct clog_cpg *match, } } -static void cpg_config_callback(cpg_handle_t handle, const struct cpg_name *gname, +static void cpg_config_callback(cpg_handle_t handle, const struct cpg_name *gname __attribute((unused)), const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, @@ -1422,7 +1422,7 @@ cpg_callbacks_t cpg_callbacks = { * * Returns: 1 if checkpoint removed, 0 if no checkpoints, -EXXX on error */ -int remove_checkpoint(struct clog_cpg *entry) +static int remove_checkpoint(struct clog_cpg *entry) { int len; SaNameT name; diff --git a/daemons/cmirrord/compat.c b/daemons/cmirrord/compat.c index 0653e38ba..4d859e60d 100644 --- a/daemons/cmirrord/compat.c +++ b/daemons/cmirrord/compat.c @@ -25,7 +25,7 @@ */ #define COMPAT_OFFSET 256 -static void v5_data_endian_switch(struct clog_request *rq, int to_network) +static void v5_data_endian_switch(struct clog_request *rq, int to_network __attribute((unused))) { int i, end; int64_t *pi64; @@ -201,7 +201,7 @@ int clog_request_from_network(void *data, size_t data_len) if (data_len < (COMPAT_OFFSET + sizeof(*rq))) return -ENOSPC; - rq = data + COMPAT_OFFSET; + rq = (char *)data + COMPAT_OFFSET; break; default: LOG_ERROR("Unable to process cluster message: " diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c index afe921048..1c9120d39 100644 --- a/daemons/cmirrord/functions.c +++ b/daemons/cmirrord/functions.c @@ -262,7 +262,7 @@ static int read_log(struct log_c *lc) bitset_size += (lc->region_count % 8) ? 1 : 0; /* 'lc->clean_bits + 1' becasue dm_bitset_t leads with a uint32_t */ - memcpy(lc->clean_bits + 1, lc->disk_buffer + 1024, bitset_size); + memcpy(lc->clean_bits + 1, (char *)lc->disk_buffer + 1024, bitset_size); return 0; } @@ -289,7 +289,7 @@ static int write_log(struct log_c *lc) bitset_size += (lc->region_count % 8) ? 1 : 0; /* 'lc->clean_bits + 1' becasue dm_bitset_t leads with a uint32_t */ - memcpy(lc->disk_buffer + 1024, lc->clean_bits + 1, bitset_size); + memcpy((char *)lc->disk_buffer + 1024, lc->clean_bits + 1, bitset_size); if (rw_log(lc, 1)) { lc->log_dev_failed = 1; @@ -372,7 +372,7 @@ static int _clog_ctr(char *uuid, uint64_t luid, uint64_t region_count; struct log_c *lc = NULL; struct log_c *duplicate; - enum sync sync = DEFAULTSYNC; + enum sync log_sync = DEFAULTSYNC; uint32_t block_on_error = 0; int disk_log = 0; @@ -427,9 +427,9 @@ static int _clog_ctr(char *uuid, uint64_t luid, for (i = 0; i < argc; i++) { if (!strcmp(argv[i], "sync")) - sync = FORCESYNC; + log_sync = FORCESYNC; else if (!strcmp(argv[i], "nosync")) - sync = NOSYNC; + log_sync = NOSYNC; else if (!strcmp(argv[i], "block_on_error")) block_on_error = 1; } @@ -444,7 +444,7 @@ static int _clog_ctr(char *uuid, uint64_t luid, lc->region_size = region_size; lc->region_count = region_count; - lc->sync = sync; + lc->sync = log_sync; lc->block_on_error = block_on_error; lc->sync_search = 0; lc->recovering_region = (uint64_t)-1; @@ -456,7 +456,7 @@ static int _clog_ctr(char *uuid, uint64_t luid, if ((duplicate = get_log(lc->uuid, lc->luid)) || (duplicate = get_pending_log(lc->uuid, lc->luid))) { - LOG_ERROR("[%s/%llu] Log already exists, unable to create.", + LOG_ERROR("[%s/%" PRIu64 "u] Log already exists, unable to create.", SHORT_UUID(lc->uuid), lc->luid); free(lc); return -EINVAL; @@ -477,10 +477,10 @@ static int _clog_ctr(char *uuid, uint64_t luid, r = -ENOMEM; goto fail; } - if (sync == NOSYNC) + if (log_sync == NOSYNC) dm_bit_set_all(lc->sync_bits); - lc->sync_count = (sync == NOSYNC) ? region_count : 0; + lc->sync_count = (log_sync == NOSYNC) ? region_count : 0; if (disk_log) { page_size = sysconf(_SC_PAGESIZE); @@ -1375,7 +1375,7 @@ static int clog_get_sync_count(struct dm_ulog_request *rq, uint32_t originator) return 0; } -static int core_status_info(struct log_c *lc, struct dm_ulog_request *rq) +static int core_status_info(struct log_c *lc __attribute((unused)), struct dm_ulog_request *rq) { char *data = (char *)rq->data; @@ -1648,7 +1648,7 @@ static void print_bits(dm_bitset_t bs, int print) { int i, size; char outbuf[128]; - unsigned char *buf = bs + 1; + unsigned char *buf = (unsigned char *)(bs + 1); size = (*bs % 8) ? 1 : 0; size += (*bs / 8); diff --git a/daemons/cmirrord/link_mon.c b/daemons/cmirrord/link_mon.c index 7b69664e5..1fbc683f3 100644 --- a/daemons/cmirrord/link_mon.c +++ b/daemons/cmirrord/link_mon.c @@ -14,10 +14,11 @@ #include #include "logging.h" +#include "link_mon.h" struct link_callback { int fd; - char *name; + const char *name; void *data; int (*callback)(void *data); @@ -29,7 +30,7 @@ static int free_pfds = 0; static struct pollfd *pfds = NULL; static struct link_callback *callbacks = NULL; -int links_register(int fd, char *name, int (*callback)(void *data), void *data) +int links_register(int fd, const char *name, int (*callback)(void *data), void *data) { int i; struct link_callback *lc; diff --git a/daemons/cmirrord/link_mon.h b/daemons/cmirrord/link_mon.h index ce9e0557b..e5677f1e6 100644 --- a/daemons/cmirrord/link_mon.h +++ b/daemons/cmirrord/link_mon.h @@ -12,7 +12,7 @@ #ifndef __LINK_MON_DOT_H__ #define __LINK_MON_DOT_H__ -int links_register(int fd, char *name, int (*callback)(void *data), void *data); +int links_register(int fd, const char *name, int (*callback)(void *data), void *data); int links_unregister(int fd); int links_monitor(void); int links_issue_callbacks(void); diff --git a/daemons/cmirrord/local.c b/daemons/cmirrord/local.c index e835fa0f5..6e17697a6 100644 --- a/daemons/cmirrord/local.c +++ b/daemons/cmirrord/local.c @@ -28,7 +28,7 @@ #include "local.h" #ifndef CN_IDX_DM -#warning Kernel should be at least 2.6.31 +/* Kernel 2.6.31 is required to run this code */ #define CN_IDX_DM 0x7 /* Device Mapper */ #define CN_VAL_DM_USERSPACE_LOG 0x1 #endif @@ -159,12 +159,12 @@ static int kernel_recv(struct clog_request **rq) * once... perhaps at compile time? */ // *rq = container_of(u_rq, struct clog_request, u_rq); - *rq = (void *)u_rq - + *rq = (char *)u_rq - (sizeof(struct clog_request) - sizeof(struct dm_ulog_request)); /* Clear the wrapper container fields */ - memset(*rq, 0, (void *)u_rq - (void *)(*rq)); + memset(*rq, 0, (char *)u_rq - (char *)(*rq)); break; default: LOG_ERROR("Unknown nlmsg_type"); @@ -218,7 +218,7 @@ static int kernel_send_helper(void *data, int out_size) * * Returns: 0 on success, -EXXX on failure */ -static int do_local_work(void *data) +static int do_local_work(void *data __attribute((unused))) { int r; struct clog_request *rq; diff --git a/daemons/cmirrord/logging.c b/daemons/cmirrord/logging.c index e9a1d4af1..450056ac7 100644 --- a/daemons/cmirrord/logging.c +++ b/daemons/cmirrord/logging.c @@ -12,7 +12,7 @@ #include #include -char *__rq_types_off_by_one[] = { +const char *__rq_types_off_by_one[] = { "DM_ULOG_CTR", "DM_ULOG_DTR", "DM_ULOG_PRESUSPEND",