From 21bc366486b241180e43864a03267a6d1e2e9a01 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 22 Aug 2007 14:38:18 +0000 Subject: [PATCH] Clean up numerous compiler warnings that crept in recently. Remove several unused parameters from _allocate(). --- WHATS_NEW | 7 +-- lib/config/config.c | 8 ++-- lib/error/errseg.c | 2 +- lib/filters/filter-sysfs.c | 2 +- lib/filters/filter.c | 2 +- lib/format1/disk-rep.c | 2 +- lib/format1/format1.c | 24 +++++----- lib/format1/import-export.c | 6 +-- lib/format1/lvm1-label.c | 8 ++-- lib/format_pool/disk_rep.c | 4 +- lib/format_pool/format_pool.c | 28 ++++++----- lib/format_pool/pool_label.c | 8 ++-- lib/format_text/format-text.c | 27 +++++------ lib/format_text/import_vsn1.c | 19 +++++--- lib/locking/cluster_locking.c | 8 ++-- lib/locking/external_locking.c | 4 +- lib/locking/file_locking.c | 4 +- lib/locking/locking.c | 12 ++--- lib/locking/locking.h | 36 +++++++-------- lib/locking/locking_types.h | 2 +- lib/locking/no_locking.c | 4 +- lib/metadata/lv_alloc.h | 1 - lib/metadata/lv_manip.c | 27 +++++------ lib/metadata/metadata-exported.h | 6 +-- lib/metadata/metadata.c | 12 ++--- lib/metadata/mirror.c | 13 +++--- lib/misc/lvm-string.c | 18 ++++---- lib/misc/lvm-string.h | 4 +- lib/report/report.c | 79 ++++++++++++++++---------------- lib/snapshot/snapshot.c | 2 +- lib/zero/zero.c | 2 +- tools/lvconvert.c | 8 ++-- tools/lvcreate.c | 8 ++-- tools/pvck.c | 2 +- tools/reporter.c | 6 ++- tools/toollib.c | 10 ++-- tools/toollib.h | 6 +-- tools/vgreduce.c | 2 +- tools/vgsplit.c | 6 +-- 39 files changed, 218 insertions(+), 211 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index c9db12e94..b3f601e33 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,10 +1,7 @@ -DO NOT RELEASE UNTIL FOLLOWING FIXED/REVIEWED: - -changed text also needs fixing - some poor English -lvcreate page needs fixing too - emphasis on best behaviour (disk log) got inverted! - Version 2.02.28 - ================================ + Clean up numerous compiler warnings that crept in recently. + Remove several unused parameters from _allocate(). Only permit --force, --verbose and --debug arguments to be repeated. Move guts of vgremove into library. Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. diff --git a/lib/config/config.c b/lib/config/config.c index e5317a447..5060715d3 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -156,7 +156,7 @@ static int _parse_config_file(struct parser *p, struct config_tree *cft) return 1; } -struct config_tree *create_config_tree_from_string(struct cmd_context *cmd, +struct config_tree *create_config_tree_from_string(struct cmd_context *cmd __attribute((unused)), const char *config_settings) { struct cs *c; @@ -371,7 +371,7 @@ static int _line_append(struct output_line *outline, const char *fmt, ...) va_start(ap, fmt); n = vsnprintf(&buf[0], sizeof buf - 1, fmt, ap); - if (n < 0 || n > sizeof buf - 1) { + if (n < 0 || n > (int) sizeof buf - 1) { log_error("vsnprintf failed for config line"); return 0; } @@ -1248,13 +1248,13 @@ static char _token_type_to_char(int type) * Returns: * # of 'type' tokens in 'str'. */ -static unsigned _count_tokens (const char *str, unsigned len, int type) +static unsigned _count_tokens(const char *str, unsigned len, int type) { char c; c = _token_type_to_char(type); - return(count_chars_len(str, len, c)); + return count_chars_len(str, len, c); } /* diff --git a/lib/error/errseg.c b/lib/error/errseg.c index e86a52c6f..6c62f406c 100644 --- a/lib/error/errseg.c +++ b/lib/error/errseg.c @@ -67,7 +67,7 @@ static int _errseg_target_present(const struct lv_segment *seg __attribute((unus #endif static int _errseg_modules_needed(struct dm_pool *mem, - const struct lv_segment *seg, + const struct lv_segment *seg __attribute((unused)), struct list *modules) { if (!str_list_add(mem, modules, "error")) { diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c index c0830a6d2..47f774195 100644 --- a/lib/filters/filter-sysfs.c +++ b/lib/filters/filter-sysfs.c @@ -299,7 +299,7 @@ struct dev_filter *sysfs_filter_create(const char *proc) #else -struct dev_filter *sysfs_filter_create(const char *proc) +struct dev_filter *sysfs_filter_create(const char *proc __attribute((unused))) { return NULL; } diff --git a/lib/filters/filter.c b/lib/filters/filter.c index bbe9c66e3..7013c22e4 100644 --- a/lib/filters/filter.c +++ b/lib/filters/filter.c @@ -80,7 +80,7 @@ static const device_info_t device_info[] = { {NULL, 0} }; -static int _passes_lvm_type_device_filter(struct dev_filter *f, +static int _passes_lvm_type_device_filter(struct dev_filter *f __attribute((unused)), struct device *dev) { const char *name = dev_name(dev); diff --git a/lib/format1/disk-rep.c b/lib/format1/disk-rep.c index 260c2f2b9..7d63b7906 100644 --- a/lib/format1/disk-rep.c +++ b/lib/format1/disk-rep.c @@ -653,7 +653,7 @@ static int _write_pvd(struct disk_list *data) /* * assumes the device has been opened. */ -static int __write_all_pvd(const struct format_type *fmt, +static int __write_all_pvd(const struct format_type *fmt __attribute((unused)), struct disk_list *data) { const char *pv_name = dev_name(data->dev); diff --git a/lib/format1/format1.c b/lib/format1/format1.c index 42c713c4f..89f96bd9b 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -175,7 +175,7 @@ static struct volume_group *_build_vg(struct format_instance *fid, static struct volume_group *_format1_vg_read(struct format_instance *fid, const char *vg_name, - struct metadata_area *mda) + struct metadata_area *mda __attribute((unused))) { struct dm_pool *mem = dm_pool_create("lvm1 vg_read", 1024 * 10); struct list pvs; @@ -261,7 +261,7 @@ static int _flatten_vg(struct format_instance *fid, struct dm_pool *mem, } static int _format1_vg_write(struct format_instance *fid, struct volume_group *vg, - struct metadata_area *mda) + struct metadata_area *mda __attribute((unused))) { struct dm_pool *mem = dm_pool_create("lvm1 vg_write", 1024 * 10); struct list pvds; @@ -284,7 +284,7 @@ static int _format1_vg_write(struct format_instance *fid, struct volume_group *v } static int _format1_pv_read(const struct format_type *fmt, const char *pv_name, - struct physical_volume *pv, struct list *mdas) + struct physical_volume *pv, struct list *mdas __attribute((unused))) { struct dm_pool *mem = dm_pool_create("lvm1 pv_read", 1024); struct disk_list *dl; @@ -325,9 +325,9 @@ static int _format1_pv_read(const struct format_type *fmt, const char *pv_name, static int _format1_pv_setup(const struct format_type *fmt, uint64_t pe_start, uint32_t extent_count, uint32_t extent_size, - int pvmetadatacopies, - uint64_t pvmetadatasize, struct list *mdas, - struct physical_volume *pv, struct volume_group *vg) + int pvmetadatacopies __attribute((unused)), + uint64_t pvmetadatasize __attribute((unused)), struct list *mdas __attribute((unused)), + struct physical_volume *pv, struct volume_group *vg __attribute((unused))) { if (pv->size > MAX_PV_SIZE) pv->size--; @@ -381,7 +381,7 @@ static int _format1_lv_setup(struct format_instance *fid, struct logical_volume } static int _format1_pv_write(const struct format_type *fmt, struct physical_volume *pv, - struct list *mdas, int64_t sector) + struct list *mdas __attribute((unused)), int64_t sector __attribute((unused))) { struct dm_pool *mem; struct disk_list *dl; @@ -470,7 +470,7 @@ static int _format1_vg_setup(struct format_instance *fid, struct volume_group *v return 1; } -static int _format1_segtype_supported(struct format_instance *fid, +static int _format1_segtype_supported(struct format_instance *fid __attribute((unused)), const struct segment_type *segtype) { if (!(segtype->flags & SEG_FORMAT1_SUPPORT)) { @@ -487,9 +487,9 @@ static struct metadata_area_ops _metadata_format1_ops = { }; static struct format_instance *_format1_create_instance(const struct format_type *fmt, - const char *vgname, - const char *vgid, - void *private) + const char *vgname __attribute((unused)), + const char *vgid __attribute((unused)), + void *private __attribute((unused))) { struct format_instance *fid; struct metadata_area *mda; @@ -516,7 +516,7 @@ static struct format_instance *_format1_create_instance(const struct format_type return fid; } -static void _format1_destroy_instance(struct format_instance *fid) +static void _format1_destroy_instance(struct format_instance *fid __attribute((unused))) { return; } diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index c334213ec..0966f11c2 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -134,7 +134,7 @@ static int _system_id(struct cmd_context *cmd, char *s, const char *prefix) return 1; } -int export_pv(struct cmd_context *cmd, struct dm_pool *mem, +int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute((unused)), struct volume_group *vg, struct pv_disk *pvd, struct physical_volume *pv) { @@ -588,7 +588,7 @@ int export_lvs(struct disk_list *dl, struct volume_group *vg, /* * FIXME: More inefficient code. */ -int import_snapshots(struct dm_pool *mem, struct volume_group *vg, +int import_snapshots(struct dm_pool *mem __attribute((unused)), struct volume_group *vg, struct list *pvds) { struct logical_volume *lvs[MAX_LV]; @@ -679,7 +679,7 @@ int export_uuids(struct disk_list *dl, struct volume_group *vg) * This calculates the nasty pv_number field * used by LVM1. */ -void export_numbers(struct list *pvds, struct volume_group *vg) +void export_numbers(struct list *pvds, struct volume_group *vg __attribute((unused))) { struct disk_list *dl; int pv_num = 1; diff --git a/lib/format1/lvm1-label.c b/lib/format1/lvm1-label.c index 78e714f44..e2bb465f1 100644 --- a/lib/format1/lvm1-label.c +++ b/lib/format1/lvm1-label.c @@ -30,7 +30,7 @@ static void _not_supported(const char *op) op); } -static int _lvm1_can_handle(struct labeller *l, void *buf, uint64_t sector) +static int _lvm1_can_handle(struct labeller *l __attribute((unused)), void *buf, uint64_t sector) { struct pv_disk *pvd = (struct pv_disk *) buf; uint32_t version; @@ -48,7 +48,7 @@ static int _lvm1_can_handle(struct labeller *l, void *buf, uint64_t sector) return 0; } -static int _lvm1_write(struct label *label, void *buf) +static int _lvm1_write(struct label *label __attribute((unused)), void *buf __attribute((unused))) { _not_supported("write"); return 0; @@ -85,14 +85,14 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, return 1; } -static int _lvm1_initialise_label(struct labeller *l, struct label *label) +static int _lvm1_initialise_label(struct labeller *l __attribute((unused)), struct label *label) { strcpy(label->type, "LVM1"); return 1; } -static void _lvm1_destroy_label(struct labeller *l, struct label *label) +static void _lvm1_destroy_label(struct labeller *l __attribute((unused)), struct label *label __attribute((unused))) { return; } diff --git a/lib/format_pool/disk_rep.c b/lib/format_pool/disk_rep.c index f71568198..ff024d834 100644 --- a/lib/format_pool/disk_rep.c +++ b/lib/format_pool/disk_rep.c @@ -33,8 +33,8 @@ #define CPOUT_64(x, y) {(y) = xlate64_be((x));} static int __read_pool_disk(const struct format_type *fmt, struct device *dev, - struct dm_pool *mem, struct pool_list *pl, - const char *vg_name) + struct dm_pool *mem __attribute((unused)), struct pool_list *pl, + const char *vg_name __attribute((unused))) { char buf[512] __attribute((aligned(8))); diff --git a/lib/format_pool/format_pool.c b/lib/format_pool/format_pool.c index 44275d6c7..bf6faeaf0 100644 --- a/lib/format_pool/format_pool.c +++ b/lib/format_pool/format_pool.c @@ -172,7 +172,7 @@ static struct volume_group *_build_vg_from_pds(struct format_instance static struct volume_group *_pool_vg_read(struct format_instance *fid, const char *vg_name, - struct metadata_area *mda) + struct metadata_area *mda __attribute((unused))) { struct dm_pool *mem = dm_pool_create("pool vg_read", 1024); struct list pds; @@ -207,18 +207,22 @@ static struct volume_group *_pool_vg_read(struct format_instance *fid, return vg; } -static int _pool_pv_setup(const struct format_type *fmt, - uint64_t pe_start, uint32_t extent_count, - uint32_t extent_size, - int pvmetadatacopies, - uint64_t pvmetadatasize, struct list *mdas, - struct physical_volume *pv, struct volume_group *vg) +static int _pool_pv_setup(const struct format_type *fmt __attribute((unused)), + uint64_t pe_start __attribute((unused)), + uint32_t extent_count __attribute((unused)), + uint32_t extent_size __attribute((unused)), + int pvmetadatacopies __attribute((unused)), + uint64_t pvmetadatasize __attribute((unused)), + struct list *mdas __attribute((unused)), + struct physical_volume *pv __attribute((unused)), + struct volume_group *vg __attribute((unused))) { return 1; } static int _pool_pv_read(const struct format_type *fmt, const char *pv_name, - struct physical_volume *pv, struct list *mdas) + struct physical_volume *pv, + struct list *mdas __attribute((unused))) { struct dm_pool *mem = dm_pool_create("pool pv_read", 1024); struct pool_list *pl; @@ -268,9 +272,9 @@ static struct metadata_area_ops _metadata_format_pool_ops = { /* *INDENT-ON* */ static struct format_instance *_pool_create_instance(const struct format_type *fmt, - const char *vgname, - const char *vgid, - void *private) + const char *vgname __attribute((unused)), + const char *vgid __attribute((unused)), + void *private __attribute((unused))) { struct format_instance *fid; struct metadata_area *mda; @@ -299,7 +303,7 @@ static struct format_instance *_pool_create_instance(const struct format_type *f return fid; } -static void _pool_destroy_instance(struct format_instance *fid) +static void _pool_destroy_instance(struct format_instance *fid __attribute((unused))) { return; } diff --git a/lib/format_pool/pool_label.c b/lib/format_pool/pool_label.c index 29c2d3e0f..11d21ad19 100644 --- a/lib/format_pool/pool_label.c +++ b/lib/format_pool/pool_label.c @@ -29,7 +29,7 @@ static void _pool_not_supported(const char *op) op); } -static int _pool_can_handle(struct labeller *l, void *buf, uint64_t sector) +static int _pool_can_handle(struct labeller *l __attribute((unused)), void *buf, uint64_t sector) { struct pool_disk pd; @@ -50,7 +50,7 @@ static int _pool_can_handle(struct labeller *l, void *buf, uint64_t sector) return 0; } -static int _pool_write(struct label *label, void *buf) +static int _pool_write(struct label *label __attribute((unused)), void *buf __attribute((unused))) { _pool_not_supported("write"); return 0; @@ -64,14 +64,14 @@ static int _pool_read(struct labeller *l, struct device *dev, void *buf, return read_pool_label(&pl, l, dev, buf, label); } -static int _pool_initialise_label(struct labeller *l, struct label *label) +static int _pool_initialise_label(struct labeller *l __attribute((unused)), struct label *label) { strcpy(label->type, "POOL"); return 1; } -static void _pool_destroy_label(struct labeller *l, struct label *label) +static void _pool_destroy_label(struct labeller *l __attribute((unused)), struct label *label __attribute((unused))) { return; } diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 5eacd582a..1653855cc 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -140,8 +140,8 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt, int i; uint64_t offset; uint64_t offset2; - uint64_t size; - uint64_t size2; + size_t size; + size_t size2; char *buf=NULL; struct device_area *area; struct mda_context *mdac; @@ -149,9 +149,8 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt, mdac = (struct mda_context *) mda->metadata_locn; - log_print("Found text metadata area, offset=%"PRIu64", size=%"PRIu64, - mdac->area.start, - mdac->area.size); + log_print("Found text metadata area: offset=%" PRIu64 ", size=%" + PRIu64, mdac->area.start, mdac->area.size); area = &mdac->area; if (!dev_open(area->dev)) @@ -201,12 +200,12 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt, /* * FIXME: We could add more sophisticated metadata detection */ - if (maybe_config_section(buf, size+size2)) { + if (maybe_config_section(buf, size + size2)) { /* FIXME: Validate region, pull out timestamp?, etc */ /* FIXME: Do something with this region */ log_verbose ("Found LVM2 metadata record at " - "offset=%"PRIu64", size=%"PRIu64", " - "offset2=%"PRIu64" size2=%"PRIu64, + "offset=%"PRIu64", size=%"PRIsize_t", " + "offset2=%"PRIu64" size2=%"PRIsize_t, offset, size, offset2, size2); offset = prev_sector; size = SECTOR_SIZE; @@ -840,8 +839,8 @@ static struct volume_group *_vg_read_precommit_file(struct format_instance *fid, return vg; } -static int _vg_write_file(struct format_instance *fid, struct volume_group *vg, - struct metadata_area *mda) +static int _vg_write_file(struct format_instance *fid __attribute((unused)), + struct volume_group *vg, struct metadata_area *mda) { struct text_context *tc = (struct text_context *) mda->metadata_locn; @@ -905,7 +904,7 @@ static int _vg_write_file(struct format_instance *fid, struct volume_group *vg, return 1; } -static int _vg_commit_file_backup(struct format_instance *fid, +static int _vg_commit_file_backup(struct format_instance *fid __attribute((unused)), struct volume_group *vg, struct metadata_area *mda) { @@ -972,7 +971,8 @@ static int _vg_commit_file(struct format_instance *fid, struct volume_group *vg, return 1; } -static int _vg_remove_file(struct format_instance *fid, struct volume_group *vg, +static int _vg_remove_file(struct format_instance *fid __attribute((unused)), + struct volume_group *vg __attribute((unused)), struct metadata_area *mda) { struct text_context *tc = (struct text_context *) mda->metadata_locn; @@ -1164,7 +1164,8 @@ static int _mda_setup(const struct format_type *fmt, uint64_t pe_start, uint64_t pe_end, int pvmetadatacopies, uint64_t pvmetadatasize, struct list *mdas, - struct physical_volume *pv, struct volume_group *vg) + struct physical_volume *pv, + struct volume_group *vg __attribute((unused))) { uint64_t mda_adjustment, disk_size, alignment; uint64_t start1, mda_size1; /* First area - start of disk */ diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index fb136ba66..ea207fad1 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -111,7 +111,8 @@ static int _read_id(struct id *id, struct config_node *cn, const char *path) static int _read_pv(struct format_instance *fid, struct dm_pool *mem, struct volume_group *vg, struct config_node *pvn, - struct config_node *vgn, struct dm_hash_table *pv_hash) + struct config_node *vgn __attribute((unused)), + struct dm_hash_table *pv_hash) { struct physical_volume *pv; struct pv_list *pvl; @@ -383,12 +384,12 @@ int text_import_areas(struct lv_segment *seg, const struct config_node *sn, /* FIXME Cope if LV not yet read in */ if ((pv = dm_hash_lookup(pv_hash, cv->v.str))) { - if (!set_lv_segment_area_pv(seg, s, pv, cv->next->v.i)) { + if (!set_lv_segment_area_pv(seg, s, pv, (uint32_t) cv->next->v.i)) { stack; return 0; } } else if ((lv1 = find_lv(seg->lv->vg, cv->v.str))) { - set_lv_segment_area_lv(seg, s, lv1, cv->next->v.i, + set_lv_segment_area_lv(seg, s, lv1, (uint32_t) cv->next->v.i, flags); } else { log_error("Couldn't find volume '%s' " @@ -469,9 +470,11 @@ static int _read_segments(struct dm_pool *mem, struct volume_group *vg, return 1; } -static int _read_lvnames(struct format_instance *fid, struct dm_pool *mem, +static int _read_lvnames(struct format_instance *fid __attribute((unused)), + struct dm_pool *mem, struct volume_group *vg, struct config_node *lvn, - struct config_node *vgn, struct dm_hash_table *pv_hash) + struct config_node *vgn __attribute((unused)), + struct dm_hash_table *pv_hash __attribute((unused))) { struct logical_volume *lv; struct lv_list *lvl; @@ -544,9 +547,11 @@ static int _read_lvnames(struct format_instance *fid, struct dm_pool *mem, return 1; } -static int _read_lvsegs(struct format_instance *fid, struct dm_pool *mem, +static int _read_lvsegs(struct format_instance *fid __attribute((unused)), + struct dm_pool *mem, struct volume_group *vg, struct config_node *lvn, - struct config_node *vgn, struct dm_hash_table *pv_hash) + struct config_node *vgn __attribute((unused)), + struct dm_hash_table *pv_hash) { struct logical_volume *lv; struct lv_list *lvl; diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index 0aaf53ffb..58054addd 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -31,7 +31,7 @@ #include #ifndef CLUSTER_LOCKING_INTERNAL -int lock_resource(struct cmd_context *cmd, const char *resource, int flags); +int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags); void locking_end(void); int locking_init(int type, struct config_tree *cf, uint32_t *flags); #endif @@ -295,7 +295,7 @@ static int _cluster_free_request(lvm_response_t * response, int num) return 1; } -static int _lock_for_cluster(unsigned char cmd, unsigned int flags, char *name) +static int _lock_for_cluster(unsigned char cmd, uint32_t flags, char *name) { int status; int i; @@ -368,9 +368,9 @@ static int _lock_for_cluster(unsigned char cmd, unsigned int flags, char *name) /* API entry point for LVM */ #ifdef CLUSTER_LOCKING_INTERNAL static int _lock_resource(struct cmd_context *cmd, const char *resource, - int flags) + uint32_t flags) #else -int lock_resource(struct cmd_context *cmd, const char *resource, int flags) +int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags) #endif { char lockname[PATH_MAX]; diff --git a/lib/locking/external_locking.c b/lib/locking/external_locking.c index 3251bc109..a8c81c5ea 100644 --- a/lib/locking/external_locking.c +++ b/lib/locking/external_locking.c @@ -23,12 +23,12 @@ static void *_locking_lib = NULL; static void (*_reset_fn) (void) = NULL; static void (*_end_fn) (void) = NULL; static int (*_lock_fn) (struct cmd_context * cmd, const char *resource, - int flags) = NULL; + uint32_t flags) = NULL; static int (*_init_fn) (int type, struct config_tree * cft, uint32_t *flags) = NULL; static int _lock_resource(struct cmd_context *cmd, const char *resource, - int flags) + uint32_t flags) { if (_lock_fn) return _lock_fn(cmd, resource, flags); diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c index 757e4dc83..2ad86fd14 100644 --- a/lib/locking/file_locking.c +++ b/lib/locking/file_locking.c @@ -124,7 +124,7 @@ static void _install_ctrl_c_handler() siginterrupt(SIGINT, 1); } -static int _lock_file(const char *file, int flags) +static int _lock_file(const char *file, uint32_t flags) { int operation; int r = 1; @@ -204,7 +204,7 @@ static int _lock_file(const char *file, int flags) } static int _file_lock_resource(struct cmd_context *cmd, const char *resource, - int flags) + uint32_t flags) { char lockfile[PATH_MAX]; diff --git a/lib/locking/locking.c b/lib/locking/locking.c index aa7b13509..6b57b1289 100644 --- a/lib/locking/locking.c +++ b/lib/locking/locking.c @@ -118,7 +118,7 @@ void sigint_restore(void) sigaction(SIGINT, &_oldhandler, NULL); } -static void _block_signals(int flags __attribute((unused))) +static void _block_signals(uint32_t flags __attribute((unused))) { sigset_t set; @@ -156,7 +156,7 @@ static void _unblock_signals(void) return; } -static void _lock_memory(int flags) +static void _lock_memory(uint32_t flags) { if (!(_locking.flags & LCK_PRE_MEMLOCK)) return; @@ -165,7 +165,7 @@ static void _lock_memory(int flags) memlock_inc(); } -static void _unlock_memory(int flags) +static void _unlock_memory(uint32_t flags) { if (!(_locking.flags & LCK_PRE_MEMLOCK)) return; @@ -187,7 +187,7 @@ void reset_locking(void) _unblock_signals(); } -static void _update_vg_lock_count(int flags) +static void _update_vg_lock_count(uint32_t flags) { if ((flags & LCK_SCOPE_MASK) != LCK_VG) return; @@ -313,7 +313,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname) * VG locking is by VG name. * FIXME This should become VG uuid. */ -static int _lock_vol(struct cmd_context *cmd, const char *resource, int flags) +static int _lock_vol(struct cmd_context *cmd, const char *resource, uint32_t flags) { _block_signals(flags); _lock_memory(flags); @@ -331,7 +331,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource, int flags) return 1; } -int lock_vol(struct cmd_context *cmd, const char *vol, int flags) +int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags) { char resource[258] __attribute((aligned(8))); diff --git a/lib/locking/locking.h b/lib/locking/locking.h index c029bb6f9..9b32524fa 100644 --- a/lib/locking/locking.h +++ b/lib/locking/locking.h @@ -35,7 +35,7 @@ int locking_is_clustered(void); * Lock/unlock an individual logical volume * char *vol holds lvid */ -int lock_vol(struct cmd_context *cmd, const char *vol, int flags); +int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags); /* * Does the LVM1 driver have this VG active? @@ -45,37 +45,37 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname); /* * Lock type - these numbers are the same as VMS and the IBM DLM */ -#define LCK_TYPE_MASK 0x00000007 +#define LCK_TYPE_MASK 0x00000007U -#define LCK_NULL 0x00000000 /* LCK$_NLMODE */ -#define LCK_READ 0x00000001 /* LCK$_CRMODE */ +#define LCK_NULL 0x00000000U /* LCK$_NLMODE */ +#define LCK_READ 0x00000001U /* LCK$_CRMODE */ /* LCK$_CWMODE */ -#define LCK_PREAD 0x00000003 /* LCK$_PRMODE */ -#define LCK_WRITE 0x00000004 /* LCK$_PWMODE */ -#define LCK_EXCL 0x00000005 /* LCK$_EXMODE */ -#define LCK_UNLOCK 0x00000006 /* This is ours */ +#define LCK_PREAD 0x00000003U /* LCK$_PRMODE */ +#define LCK_WRITE 0x00000004U /* LCK$_PWMODE */ +#define LCK_EXCL 0x00000005U /* LCK$_EXMODE */ +#define LCK_UNLOCK 0x00000006U /* This is ours */ /* * Lock scope */ -#define LCK_SCOPE_MASK 0x00000008 -#define LCK_VG 0x00000000 -#define LCK_LV 0x00000008 +#define LCK_SCOPE_MASK 0x00000008U +#define LCK_VG 0x00000000U +#define LCK_LV 0x00000008U /* * Lock bits */ -#define LCK_NONBLOCK 0x00000010 /* Don't block waiting for lock? */ -#define LCK_HOLD 0x00000020 /* Hold lock when lock_vol returns? */ -#define LCK_LOCAL 0x00000040 /* Don't propagate to other nodes */ -#define LCK_CLUSTER_VG 0x00000080 /* VG is clustered */ +#define LCK_NONBLOCK 0x00000010U /* Don't block waiting for lock? */ +#define LCK_HOLD 0x00000020U /* Hold lock when lock_vol returns? */ +#define LCK_LOCAL 0x00000040U /* Don't propagate to other nodes */ +#define LCK_CLUSTER_VG 0x00000080U /* VG is clustered */ /* * Additional lock bits for cluster communication */ -#define LCK_PARTIAL_MODE 0x00000001 /* Running in partial mode */ -#define LCK_MIRROR_NOSYNC_MODE 0x00000002 /* Mirrors don't require sync */ -#define LCK_DMEVENTD_MONITOR_MODE 0x00000004 /* Register with dmeventd */ +#define LCK_PARTIAL_MODE 0x00000001U /* Running in partial mode */ +#define LCK_MIRROR_NOSYNC_MODE 0x00000002U /* Mirrors don't require sync */ +#define LCK_DMEVENTD_MONITOR_MODE 0x00000004U /* Register with dmeventd */ /* diff --git a/lib/locking/locking_types.h b/lib/locking/locking_types.h index 3be4a764d..f78362966 100644 --- a/lib/locking/locking_types.h +++ b/lib/locking/locking_types.h @@ -17,7 +17,7 @@ #include "config.h" typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, - int flags); + uint32_t flags); typedef void (*fin_lock_fn) (void); typedef void (*reset_lock_fn) (void); diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c index a2bb132a4..0b70951b2 100644 --- a/lib/locking/no_locking.c +++ b/lib/locking/no_locking.c @@ -37,7 +37,7 @@ static void _no_reset_locking(void) } static int _no_lock_resource(struct cmd_context *cmd, const char *resource, - int flags) + uint32_t flags) { switch (flags & LCK_SCOPE_MASK) { case LCK_VG: @@ -76,7 +76,7 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource, return 1; } -int init_no_locking(struct locking_type *locking, struct cmd_context *cmd) +int init_no_locking(struct locking_type *locking, struct cmd_context *cmd __attribute((unused))) { locking->lock_resource = _no_lock_resource; locking->reset_locking = _no_reset_locking; diff --git a/lib/metadata/lv_alloc.h b/lib/metadata/lv_alloc.h index 3a7c48e0a..f203aef68 100644 --- a/lib/metadata/lv_alloc.h +++ b/lib/metadata/lv_alloc.h @@ -50,7 +50,6 @@ struct alloc_handle *allocate_extents(struct volume_group *vg, uint32_t extents, struct physical_volume *mirrored_pv, uint32_t mirrored_pe, - uint32_t status, struct list *allocatable_pvs, alloc_policy_t alloc, struct list *parallel_areas); diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 5384041fd..c761533e2 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -735,13 +735,13 @@ static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv, (le - seg->le) / area_multiple, area_len, max_seg_len, only_single_area_segments ? 0 : 0, - only_single_area_segments ? 1 : 0, - top_level_area_index != -1 ? top_level_area_index : s, + only_single_area_segments ? 1U : 0U, + top_level_area_index != -1 ? top_level_area_index : (int) s, only_single_area_segments, fn, data))) stack; } else if (seg_type(seg, s) == AREA_PV) - if (!(r = fn(cmd, seg_pvseg(seg, s), top_level_area_index != -1 ? top_level_area_index : s, data))) + if (!(r = fn(cmd, seg_pvseg(seg, s), top_level_area_index != -1 ? (uint32_t) top_level_area_index : s, data))) stack; if (r != 1) return r; @@ -813,7 +813,7 @@ static int _is_contiguous(struct pv_segment *pvseg, struct pv_area *pva) return 1; } -static int _is_condition(struct cmd_context *cmd, +static int _is_condition(struct cmd_context *cmd __attribute((unused)), struct pv_segment *pvseg, uint32_t s, void *data) { @@ -1068,11 +1068,9 @@ static int _find_parallel_space(struct alloc_handle *ah, alloc_policy_t alloc, */ static int _allocate(struct alloc_handle *ah, struct volume_group *vg, - struct logical_volume *lv, uint32_t status, + struct logical_volume *lv, uint32_t new_extents, - struct list *allocatable_pvs, - uint32_t stripes, uint32_t mirrors, - const struct segment_type *segtype) + struct list *allocatable_pvs) { struct pv_area **areas; uint32_t allocated = lv ? lv->le_count : 0; @@ -1197,7 +1195,6 @@ struct alloc_handle *allocate_extents(struct volume_group *vg, uint32_t extents, struct physical_volume *mirrored_pv, uint32_t mirrored_pe, - uint32_t status, struct list *allocatable_pvs, alloc_policy_t alloc, struct list *parallel_areas) @@ -1230,8 +1227,8 @@ struct alloc_handle *allocate_extents(struct volume_group *vg, } if (!segtype_is_virtual(segtype) && - !_allocate(ah, vg, lv, status, (lv ? lv->le_count : 0) + extents, - allocatable_pvs, stripes, mirrors, segtype)) { + !_allocate(ah, vg, lv, (lv ? lv->le_count : 0) + extents, + allocatable_pvs)) { stack; alloc_destroy(ah); return NULL; @@ -1334,8 +1331,8 @@ int lv_add_mirror_segment(struct alloc_handle *ah, struct logical_volume *lv, struct logical_volume **sub_lvs, uint32_t mirrors, - const struct segment_type *segtype, - uint32_t status, + const struct segment_type *segtype __attribute((unused)), + uint32_t status __attribute((unused)), uint32_t region_size, struct logical_volume *log_lv) { @@ -1431,7 +1428,7 @@ int lv_extend(struct logical_volume *lv, return lv_add_virtual_segment(lv, status, extents, segtype); if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors, 0, - extents, mirrored_pv, mirrored_pe, status, + extents, mirrored_pv, mirrored_pe, allocatable_pvs, alloc, NULL))) { stack; return 0; @@ -1556,7 +1553,7 @@ static int _for_each_sub_lv(struct cmd_context *cmd, struct logical_volume *lv, void *data) { struct lv_segment *seg; - int s; + uint32_t s; list_iterate_items(seg, &lv->segments) { if (seg->log_lv && !func(cmd, seg->log_lv, data)) diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index a6fa49e50..7bc55b074 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -323,7 +323,7 @@ pv_t *pv_create(const struct format_type *fmt, int pv_resize(struct physical_volume *pv, struct volume_group *vg, uint32_t new_pe_count); int pv_analyze(struct cmd_context *cmd, const char *pv_name, - int64_t label_sector); + uint64_t label_sector); struct volume_group *vg_create(struct cmd_context *cmd, const char *name, uint32_t extent_size, uint32_t max_pv, @@ -430,9 +430,9 @@ int create_mirror_layers(struct alloc_handle *ah, struct logical_volume *log_lv); int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, - struct list *removable_pvs, int remove_log); + struct list *removable_pvs, unsigned remove_log); int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, - struct list *removable_pvs, int remove_log); + struct list *removable_pvs, unsigned remove_log); int insert_pvmove_mirrors(struct cmd_context *cmd, struct logical_volume *lv_mirr, diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index c8b0e9f74..80efbb00a 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -251,7 +251,7 @@ int vg_rename(struct cmd_context *cmd, struct volume_group *vg, int vg_remove_single(struct cmd_context *cmd, const char *vg_name, struct volume_group *vg, int consistent, - force_t force) + force_t force __attribute((unused))) { struct physical_volume *pv; struct pv_list *pvl; @@ -466,8 +466,8 @@ static int _recalc_extents(uint32_t *extents, const char *desc1, return 1; } -int vg_change_pesize(struct cmd_context *cmd, struct volume_group *vg, - uint32_t new_size) +int vg_change_pesize(struct cmd_context *cmd __attribute((unused)), + struct volume_group *vg, uint32_t new_size) { uint32_t old_size = vg->extent_size; struct pv_list *pvl; @@ -617,8 +617,8 @@ int vg_change_pesize(struct cmd_context *cmd, struct volume_group *vg, return 1; } -int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from, - struct volume_group *vg_to) +int vg_split_mdas(struct cmd_context *cmd __attribute((unused)), + struct volume_group *vg_from, struct volume_group *vg_to) { struct metadata_area *mda, *mda2; struct list *mdas_from, *mdas_to; @@ -1783,7 +1783,7 @@ int is_orphan(pv_t *pv) * 1 - success */ int pv_analyze(struct cmd_context *cmd, const char *pv_name, - int64_t label_sector) + uint64_t label_sector) { struct label *label; struct device *dev; diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index ae8532d83..97899e56e 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -118,7 +118,7 @@ static int _delete_lv(struct lv_segment *mirrored_seg, struct logical_volume *lv * Reduce mirrored_seg to num_mirrors images. */ int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, - struct list *removable_pvs, int remove_log) + struct list *removable_pvs, unsigned remove_log) { uint32_t m; uint32_t extents; @@ -255,7 +255,8 @@ int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, return 1; } -static int get_mirror_fault_policy(struct cmd_context *cmd, int log_policy) +static int get_mirror_fault_policy(struct cmd_context *cmd __attribute((unused)), + int log_policy) { const char *policy; @@ -347,7 +348,7 @@ static int replace_mirror_images(struct lv_segment *mirrored_seg, } int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, - struct list *removable_pvs, int remove_log) + struct list *removable_pvs, unsigned remove_log) { int r; int insync = 0; @@ -416,7 +417,7 @@ static int _create_layers_for_mirror(struct alloc_handle *ah, uint32_t first_area, uint32_t num_mirrors, struct logical_volume *lv, - const struct segment_type *segtype, + const struct segment_type *segtype __attribute((unused)), struct logical_volume **img_lvs) { uint32_t m; @@ -467,7 +468,7 @@ int create_mirror_layers(struct alloc_handle *ah, uint32_t num_mirrors, struct logical_volume *lv, const struct segment_type *segtype, - uint32_t status, + uint32_t status __attribute((unused)), uint32_t region_size, struct logical_volume *log_lv) { @@ -508,7 +509,7 @@ int create_mirror_layers(struct alloc_handle *ah, int add_mirror_layers(struct alloc_handle *ah, uint32_t num_mirrors, - uint32_t existing_mirrors, + uint32_t existing_mirrors __attribute((unused)), struct logical_volume *lv, const struct segment_type *segtype) { diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c index 15a63090d..d26de9a60 100644 --- a/lib/misc/lvm-string.c +++ b/lib/misc/lvm-string.c @@ -27,7 +27,7 @@ int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...) n = vsnprintf(*buffer, *size, fmt, ap); va_end(ap); - if (n < 0 || (n == *size)) + if (n < 0 || ((size_t)n == *size)) return 0; *buffer += n; @@ -40,10 +40,10 @@ int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...) * * Returns: * len - incremented for each char we encounter, whether 'c' or not. - * count - number of occurences of 'c' + * count - number of occurrences of 'c' */ void count_chars(const char *str, size_t *len, int *count, - const char c) + const int c) { const char *ptr; @@ -56,18 +56,18 @@ void count_chars(const char *str, size_t *len, int *count, * Count occurences of 'c' in 'str' of length 'size'. * * Returns: - * # of occurences of 'c' + * Number of occurrences of 'c' */ -unsigned count_chars_len(const char *str, size_t size, const char c) +unsigned count_chars_len(const char *str, size_t len, const int c) { - int i; - unsigned count=0; + size_t i; + unsigned count = 0; - for (i=0; i < size; i++) + for (i = 0; i < len; i++) if (str[i] == c) count++; - return count; + return count; } /* diff --git a/lib/misc/lvm-string.h b/lib/misc/lvm-string.h index d45bced8b..0fe38bfd2 100644 --- a/lib/misc/lvm-string.h +++ b/lib/misc/lvm-string.h @@ -32,7 +32,7 @@ char *build_dm_name(struct dm_pool *mem, const char *vg, int validate_name(const char *n); void count_chars(const char *str, size_t *len, int *count, - char c); -unsigned count_chars_len(const char *str, size_t size, char c); + const int c); +unsigned count_chars_len(const char *str, size_t len, const int c); #endif diff --git a/lib/report/report.c b/lib/report/report.c index fae88dc12..96b2d0ead 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -62,25 +62,25 @@ static char _alloc_policy_char(alloc_policy_t alloc) /* * Data-munging functions to prepare each data type for display and sorting */ -static int _string_disp(struct dm_report *rh, struct dm_pool *mem, +static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { return dm_report_field_string(rh, field, (const char **) data); } -static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem, +static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const char *name = dev_name(*(const struct device **) data); return dm_report_field_string(rh, field, &name); } -static int _devices_disp(struct dm_report *rh, struct dm_pool *mem, +static int _devices_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct lv_segment *seg = (const struct lv_segment *) data; unsigned int s; @@ -141,9 +141,9 @@ static int _devices_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _tags_disp(struct dm_report *rh, struct dm_pool *mem, +static int _tags_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct list *tags = (const struct list *) data; struct str_list *sl; @@ -218,9 +218,9 @@ static int _pvfmt_disp(struct dm_report *rh, struct dm_pool *mem, return _string_disp(rh, mem, field, &pv->fmt->name, private); } -static int _lvkmaj_disp(struct dm_report *rh, struct dm_pool *mem, +static int _lvkmaj_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; struct lvinfo info; @@ -232,9 +232,9 @@ static int _lvkmaj_disp(struct dm_report *rh, struct dm_pool *mem, return dm_report_field_uint64(rh, field, &minusone); } -static int _lvkmin_disp(struct dm_report *rh, struct dm_pool *mem, +static int _lvkmin_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; struct lvinfo info; @@ -246,9 +246,9 @@ static int _lvkmin_disp(struct dm_report *rh, struct dm_pool *mem, return dm_report_field_uint64(rh, field, &minusone); } -static int _lvstatus_disp(struct dm_report *rh, struct dm_pool *mem, +static int _lvstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; struct lvinfo info; @@ -331,9 +331,9 @@ static int _lvstatus_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _pvstatus_disp(struct dm_report *rh, struct dm_pool *mem, +static int _pvstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const uint32_t status = *(const uint32_t *) data; char *repstr; @@ -357,9 +357,9 @@ static int _pvstatus_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _vgstatus_disp(struct dm_report *rh, struct dm_pool *mem, +static int _vgstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct volume_group *vg = (const struct volume_group *) data; char *repstr; @@ -401,9 +401,9 @@ static int _vgstatus_disp(struct dm_report *rh, struct dm_pool *mem, } static int _segtype_disp(struct dm_report *rh __attribute((unused)), - struct dm_pool *mem, + struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct lv_segment *seg = (const struct lv_segment *) data; @@ -416,9 +416,9 @@ static int _segtype_disp(struct dm_report *rh __attribute((unused)), return 1; } -static int _origin_disp(struct dm_report *rh, struct dm_pool *mem, +static int _origin_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; @@ -430,9 +430,9 @@ static int _origin_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem, +static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; struct lv_segment *seg; @@ -450,7 +450,7 @@ static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem, static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; char *repstr, *lvname; @@ -482,9 +482,9 @@ static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem, +static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; const char *name; @@ -501,7 +501,7 @@ static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _size32_disp(struct dm_report *rh, struct dm_pool *mem, +static int _size32_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) { @@ -531,7 +531,8 @@ static int _size32_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _size64_disp(struct dm_report *rh, struct dm_pool *mem, +static int _size64_disp(struct dm_report *rh __attribute((unused)), + struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) { @@ -684,9 +685,9 @@ static int _vgfree_disp(struct dm_report *rh, struct dm_pool *mem, return _size64_disp(rh, mem, field, &freespace, private); } -static int _uuid_disp(struct dm_report *rh, struct dm_pool *mem, +static int _uuid_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { char *repstr = NULL; @@ -704,16 +705,16 @@ static int _uuid_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem, +static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { return dm_report_field_uint32(rh, field, data); } -static int _int32_disp(struct dm_report *rh, struct dm_pool *mem, +static int _int32_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)), struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { return dm_report_field_int32(rh, field, data); } @@ -756,9 +757,9 @@ static int _lvsegcount_disp(struct dm_report *rh, struct dm_pool *mem, return _uint32_disp(rh, mem, field, &count, private); } -static int _snpercent_disp(struct dm_report *rh, struct dm_pool *mem, +static int _snpercent_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { const struct logical_volume *lv = (const struct logical_volume *) data; struct lvinfo info; @@ -806,9 +807,9 @@ static int _snpercent_disp(struct dm_report *rh, struct dm_pool *mem, return 1; } -static int _copypercent_disp(struct dm_report *rh, struct dm_pool *mem, +static int _copypercent_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, - const void *data, void *private) + const void *data, void *private __attribute((unused))) { struct logical_volume *lv = (struct logical_volume *) data; float percent; diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c index d567aa801..97f0ce8c1 100644 --- a/lib/snapshot/snapshot.c +++ b/lib/snapshot/snapshot.c @@ -128,7 +128,7 @@ static int _snap_target_present(const struct lv_segment *seg __attribute((unused #endif static int _snap_modules_needed(struct dm_pool *mem, - const struct lv_segment *seg, + const struct lv_segment *seg __attribute((unused)), struct list *modules) { if (!str_list_add(mem, modules, "snapshot")) { diff --git a/lib/zero/zero.c b/lib/zero/zero.c index b04ef289b..cd871614a 100644 --- a/lib/zero/zero.c +++ b/lib/zero/zero.c @@ -65,7 +65,7 @@ static int _zero_target_present(const struct lv_segment *seg __attribute((unused #endif static int _zero_modules_needed(struct dm_pool *mem, - const struct lv_segment *seg, + const struct lv_segment *seg __attribute((unused)), struct list *modules) { if (!str_list_add(mem, modules, "zero")) { diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 86e4cd507..61e6a0a5c 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -338,9 +338,9 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype, 1, lp->mirrors - 1, - corelog ? 0 : 1, + corelog ? 0U : 1U, lv->le_count * (lp->mirrors - 1), - NULL, 0, 0, lp->pvh, + NULL, 0, lp->pvh, lp->alloc, parallel_areas))) return_0; @@ -390,7 +390,7 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l if (!(ah = allocate_extents(lv->vg, NULL, segtype, 0, 0, 1, 0, - NULL, 0, 0, lp->pvh, + NULL, 0, lp->pvh, lp->alloc, parallel_areas))) { stack; @@ -503,7 +503,7 @@ static int lvconvert_snapshot(struct cmd_context *cmd, if (!lp->zero || !(lv->status & LVM_WRITE)) log_warn("WARNING: \"%s\" not zeroed", lv->name); - else if (!set_lv(cmd, lv, 0, 0)) { + else if (!set_lv(cmd, lv, UINT64_C(0), 0)) { log_error("Aborting. Failed to wipe snapshot " "exception store."); return 0; diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 39bfed1a3..dd28ceec8 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -572,7 +572,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) log_error("Volume too large (%s) for extent size %s. " "Upper limit is %s.", display_size(cmd, tmp_size), - display_size(cmd, vg->extent_size), + display_size(cmd, (uint64_t) vg->extent_size), display_size(cmd, (uint64_t) UINT32_MAX * vg->extent_size)); return 0; @@ -707,8 +707,8 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) /* FIXME Calculate how many extents needed for the log */ if (!(ah = allocate_extents(vg, NULL, lp->segtype, lp->stripes, - lp->mirrors, lp->corelog ? 0 : 1, - lp->extents, NULL, 0, 0, + lp->mirrors, lp->corelog ? 0U : 1U, + lp->extents, NULL, 0, pvh, lp->alloc, NULL))) { stack; return 0; @@ -804,7 +804,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) } if ((lp->zero || lp->snapshot) && activation()) { - if (!set_lv(cmd, lv, 0, 0) && lp->snapshot) { + if (!set_lv(cmd, lv, UINT64_C(0), 0) && lp->snapshot) { /* FIXME Remove the failed lv we just added */ log_error("Aborting. Failed to wipe snapshot " "exception store. Remove new LV and retry."); diff --git a/tools/pvck.c b/tools/pvck.c index ebe9588ad..1b878d14a 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -32,7 +32,7 @@ int pvck(struct cmd_context *cmd, int argc, char **argv) log_verbose("Scanning %s", argv[i]); pv_analyze(cmd, argv[i], - arg_int64_value(cmd, labelsector_ARG, + arg_uint64_value(cmd, labelsector_ARG, UINT64_C(0))); } diff --git a/tools/reporter.c b/tools/reporter.c index 2f12ff763..2b8e52e7b 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -134,7 +134,8 @@ out: } static int _pvs_in_vg(struct cmd_context *cmd, const char *vg_name, - struct volume_group *vg, int consistent, + struct volume_group *vg, + int consistent __attribute((unused)), void *handle) { if (!vg) { @@ -146,7 +147,8 @@ static int _pvs_in_vg(struct cmd_context *cmd, const char *vg_name, } static int _pvsegs_in_vg(struct cmd_context *cmd, const char *vg_name, - struct volume_group *vg, int consistent, + struct volume_group *vg, + int consistent __attribute((unused)), void *handle) { if (!vg) { diff --git a/tools/toollib.c b/tools/toollib.c index 09a8ab833..c2b996f7c 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -221,7 +221,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, } int process_each_lv(struct cmd_context *cmd, int argc, char **argv, - int lock_type, void *handle, + uint32_t lock_type, void *handle, int (*process_single) (struct cmd_context * cmd, struct logical_volume * lv, void *handle)) @@ -392,7 +392,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv, list_init(&lvnames); break; } else if (!strncmp(vg_name, vgname, strlen(vgname)) && - strlen(vgname) == lv_name - vg_name) { + strlen(vgname) == (size_t) (lv_name - vg_name)) { if (!str_list_add(cmd->mem, &lvnames, dm_pool_strdup(cmd->mem, lv_name + 1))) { @@ -463,7 +463,7 @@ int process_each_segment_in_lv(struct cmd_context *cmd, static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, const char *vgid, struct list *tags, struct list *arg_vgnames, - int lock_type, int consistent, void *handle, + uint32_t lock_type, int consistent, void *handle, int ret_max, int (*process_single) (struct cmd_context * cmd, const char *vg_name, @@ -513,7 +513,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, } int process_each_vg(struct cmd_context *cmd, int argc, char **argv, - int lock_type, int consistent, void *handle, + uint32_t lock_type, int consistent, void *handle, int (*process_single) (struct cmd_context * cmd, const char *vg_name, struct volume_group * vg, @@ -1133,7 +1133,7 @@ struct list *clone_pv_list(struct dm_pool *mem, struct list *pvsl) * Attempt metadata recovery */ struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname, - int lock_type) + uint32_t lock_type) { int consistent = 1; diff --git a/tools/toollib.h b/tools/toollib.h index 22a7a0b67..899430dab 100644 --- a/tools/toollib.h +++ b/tools/toollib.h @@ -24,10 +24,10 @@ int autobackup_init(const char *backup_dir, int keep_days, int keep_number, int autobackup(struct volume_group *vg); struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname, - int lock_type); + uint32_t lock_type); int process_each_vg(struct cmd_context *cmd, int argc, char **argv, - int lock_type, int consistent, void *handle, + uint32_t lock_type, int consistent, void *handle, int (*process_single) (struct cmd_context * cmd, const char *vg_name, struct volume_group * vg, @@ -49,7 +49,7 @@ int process_each_segment_in_pv(struct cmd_context *cmd, void *handle)); int process_each_lv(struct cmd_context *cmd, int argc, char **argv, - int lock_type, void *handle, + uint32_t lock_type, void *handle, int (*process_single) (struct cmd_context * cmd, struct logical_volume * lv, void *handle)); diff --git a/tools/vgreduce.c b/tools/vgreduce.c index e1bcb4b28..8b079f837 100644 --- a/tools/vgreduce.c +++ b/tools/vgreduce.c @@ -301,7 +301,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg) } } - if ((mimages != mirrored_seg->area_count) || (remove_log)){ + if ((mimages != mirrored_seg->area_count) || remove_log){ if (!reconfigure_mirror_images(mirrored_seg, mimages, NULL, remove_log)) { stack; diff --git a/tools/vgsplit.c b/tools/vgsplit.c index 355d53711..eebf91b56 100644 --- a/tools/vgsplit.c +++ b/tools/vgsplit.c @@ -173,7 +173,7 @@ static int _move_mirrors(struct volume_group *vg_from, struct list *lvh, *lvht; struct logical_volume *lv; struct lv_segment *seg; - int i, seg_in, log_in; + unsigned s, seg_in, log_in; list_iterate_safe(lvh, lvht, &vg_from->lvs) { lv = list_item(lvh, struct lv_list)->lv; @@ -184,8 +184,8 @@ static int _move_mirrors(struct volume_group *vg_from, seg = first_seg(lv); seg_in = 0; - for (i = 0; i < seg->area_count; i++) - if (_lv_is_in_vg(vg_to, seg_lv(seg, i))) + for (s = 0; s < seg->area_count; s++) + if (_lv_is_in_vg(vg_to, seg_lv(seg, s))) seg_in++; log_in = (!seg->log_lv || _lv_is_in_vg(vg_to, seg->log_lv));