1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Clean up numerous compiler warnings that crept in recently.

Remove several unused parameters from _allocate().
This commit is contained in:
Alasdair Kergon 2007-08-22 14:38:18 +00:00
parent d65b20980b
commit 21bc366486
39 changed files with 218 additions and 211 deletions

View File

@ -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 - 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. Only permit --force, --verbose and --debug arguments to be repeated.
Move guts of vgremove into library. Move guts of vgremove into library.
Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.

View File

@ -156,7 +156,7 @@ static int _parse_config_file(struct parser *p, struct config_tree *cft)
return 1; 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) const char *config_settings)
{ {
struct cs *c; struct cs *c;
@ -371,7 +371,7 @@ static int _line_append(struct output_line *outline, const char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
n = vsnprintf(&buf[0], sizeof buf - 1, fmt, ap); 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"); log_error("vsnprintf failed for config line");
return 0; return 0;
} }
@ -1248,13 +1248,13 @@ static char _token_type_to_char(int type)
* Returns: * Returns:
* # of 'type' tokens in 'str'. * # 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; char c;
c = _token_type_to_char(type); c = _token_type_to_char(type);
return(count_chars_len(str, len, c)); return count_chars_len(str, len, c);
} }
/* /*

View File

@ -67,7 +67,7 @@ static int _errseg_target_present(const struct lv_segment *seg __attribute((unus
#endif #endif
static int _errseg_modules_needed(struct dm_pool *mem, static int _errseg_modules_needed(struct dm_pool *mem,
const struct lv_segment *seg, const struct lv_segment *seg __attribute((unused)),
struct list *modules) struct list *modules)
{ {
if (!str_list_add(mem, modules, "error")) { if (!str_list_add(mem, modules, "error")) {

View File

@ -299,7 +299,7 @@ struct dev_filter *sysfs_filter_create(const char *proc)
#else #else
struct dev_filter *sysfs_filter_create(const char *proc) struct dev_filter *sysfs_filter_create(const char *proc __attribute((unused)))
{ {
return NULL; return NULL;
} }

View File

@ -80,7 +80,7 @@ static const device_info_t device_info[] = {
{NULL, 0} {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) struct device *dev)
{ {
const char *name = dev_name(dev); const char *name = dev_name(dev);

View File

@ -653,7 +653,7 @@ static int _write_pvd(struct disk_list *data)
/* /*
* assumes the device has been opened. * 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) struct disk_list *data)
{ {
const char *pv_name = dev_name(data->dev); const char *pv_name = dev_name(data->dev);

View File

@ -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, static struct volume_group *_format1_vg_read(struct format_instance *fid,
const char *vg_name, 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 dm_pool *mem = dm_pool_create("lvm1 vg_read", 1024 * 10);
struct list pvs; 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, 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 dm_pool *mem = dm_pool_create("lvm1 vg_write", 1024 * 10);
struct list pvds; 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, 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 dm_pool *mem = dm_pool_create("lvm1 pv_read", 1024);
struct disk_list *dl; 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, static int _format1_pv_setup(const struct format_type *fmt,
uint64_t pe_start, uint32_t extent_count, uint64_t pe_start, uint32_t extent_count,
uint32_t extent_size, uint32_t extent_size,
int pvmetadatacopies, int pvmetadatacopies __attribute((unused)),
uint64_t pvmetadatasize, struct list *mdas, uint64_t pvmetadatasize __attribute((unused)), struct list *mdas __attribute((unused)),
struct physical_volume *pv, struct volume_group *vg) struct physical_volume *pv, struct volume_group *vg __attribute((unused)))
{ {
if (pv->size > MAX_PV_SIZE) if (pv->size > MAX_PV_SIZE)
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, 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 dm_pool *mem;
struct disk_list *dl; struct disk_list *dl;
@ -470,7 +470,7 @@ static int _format1_vg_setup(struct format_instance *fid, struct volume_group *v
return 1; 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) const struct segment_type *segtype)
{ {
if (!(segtype->flags & SEG_FORMAT1_SUPPORT)) { 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, static struct format_instance *_format1_create_instance(const struct format_type *fmt,
const char *vgname, const char *vgname __attribute((unused)),
const char *vgid, const char *vgid __attribute((unused)),
void *private) void *private __attribute((unused)))
{ {
struct format_instance *fid; struct format_instance *fid;
struct metadata_area *mda; struct metadata_area *mda;
@ -516,7 +516,7 @@ static struct format_instance *_format1_create_instance(const struct format_type
return fid; return fid;
} }
static void _format1_destroy_instance(struct format_instance *fid) static void _format1_destroy_instance(struct format_instance *fid __attribute((unused)))
{ {
return; return;
} }

View File

@ -134,7 +134,7 @@ static int _system_id(struct cmd_context *cmd, char *s, const char *prefix)
return 1; 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 volume_group *vg,
struct pv_disk *pvd, struct physical_volume *pv) 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. * 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 list *pvds)
{ {
struct logical_volume *lvs[MAX_LV]; 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 * This calculates the nasty pv_number field
* used by LVM1. * 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; struct disk_list *dl;
int pv_num = 1; int pv_num = 1;

View File

@ -30,7 +30,7 @@ static void _not_supported(const char *op)
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; struct pv_disk *pvd = (struct pv_disk *) buf;
uint32_t version; uint32_t version;
@ -48,7 +48,7 @@ static int _lvm1_can_handle(struct labeller *l, void *buf, uint64_t sector)
return 0; 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"); _not_supported("write");
return 0; return 0;
@ -85,14 +85,14 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf,
return 1; 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"); strcpy(label->type, "LVM1");
return 1; 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; return;
} }

View File

@ -33,8 +33,8 @@
#define CPOUT_64(x, y) {(y) = xlate64_be((x));} #define CPOUT_64(x, y) {(y) = xlate64_be((x));}
static int __read_pool_disk(const struct format_type *fmt, struct device *dev, static int __read_pool_disk(const struct format_type *fmt, struct device *dev,
struct dm_pool *mem, struct pool_list *pl, struct dm_pool *mem __attribute((unused)), struct pool_list *pl,
const char *vg_name) const char *vg_name __attribute((unused)))
{ {
char buf[512] __attribute((aligned(8))); char buf[512] __attribute((aligned(8)));

View File

@ -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, static struct volume_group *_pool_vg_read(struct format_instance *fid,
const char *vg_name, 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 dm_pool *mem = dm_pool_create("pool vg_read", 1024);
struct list pds; struct list pds;
@ -207,18 +207,22 @@ static struct volume_group *_pool_vg_read(struct format_instance *fid,
return vg; return vg;
} }
static int _pool_pv_setup(const struct format_type *fmt, static int _pool_pv_setup(const struct format_type *fmt __attribute((unused)),
uint64_t pe_start, uint32_t extent_count, uint64_t pe_start __attribute((unused)),
uint32_t extent_size, uint32_t extent_count __attribute((unused)),
int pvmetadatacopies, uint32_t extent_size __attribute((unused)),
uint64_t pvmetadatasize, struct list *mdas, int pvmetadatacopies __attribute((unused)),
struct physical_volume *pv, struct volume_group *vg) uint64_t pvmetadatasize __attribute((unused)),
struct list *mdas __attribute((unused)),
struct physical_volume *pv __attribute((unused)),
struct volume_group *vg __attribute((unused)))
{ {
return 1; return 1;
} }
static int _pool_pv_read(const struct format_type *fmt, const char *pv_name, 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 dm_pool *mem = dm_pool_create("pool pv_read", 1024);
struct pool_list *pl; struct pool_list *pl;
@ -268,9 +272,9 @@ static struct metadata_area_ops _metadata_format_pool_ops = {
/* *INDENT-ON* */ /* *INDENT-ON* */
static struct format_instance *_pool_create_instance(const struct format_type *fmt, static struct format_instance *_pool_create_instance(const struct format_type *fmt,
const char *vgname, const char *vgname __attribute((unused)),
const char *vgid, const char *vgid __attribute((unused)),
void *private) void *private __attribute((unused)))
{ {
struct format_instance *fid; struct format_instance *fid;
struct metadata_area *mda; struct metadata_area *mda;
@ -299,7 +303,7 @@ static struct format_instance *_pool_create_instance(const struct format_type *f
return fid; return fid;
} }
static void _pool_destroy_instance(struct format_instance *fid) static void _pool_destroy_instance(struct format_instance *fid __attribute((unused)))
{ {
return; return;
} }

View File

@ -29,7 +29,7 @@ static void _pool_not_supported(const char *op)
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; struct pool_disk pd;
@ -50,7 +50,7 @@ static int _pool_can_handle(struct labeller *l, void *buf, uint64_t sector)
return 0; 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"); _pool_not_supported("write");
return 0; 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); 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"); strcpy(label->type, "POOL");
return 1; 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; return;
} }

View File

@ -140,8 +140,8 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
int i; int i;
uint64_t offset; uint64_t offset;
uint64_t offset2; uint64_t offset2;
uint64_t size; size_t size;
uint64_t size2; size_t size2;
char *buf=NULL; char *buf=NULL;
struct device_area *area; struct device_area *area;
struct mda_context *mdac; 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; mdac = (struct mda_context *) mda->metadata_locn;
log_print("Found text metadata area, offset=%"PRIu64", size=%"PRIu64, log_print("Found text metadata area: offset=%" PRIu64 ", size=%"
mdac->area.start, PRIu64, mdac->area.start, mdac->area.size);
mdac->area.size);
area = &mdac->area; area = &mdac->area;
if (!dev_open(area->dev)) 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 * 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: Validate region, pull out timestamp?, etc */
/* FIXME: Do something with this region */ /* FIXME: Do something with this region */
log_verbose ("Found LVM2 metadata record at " log_verbose ("Found LVM2 metadata record at "
"offset=%"PRIu64", size=%"PRIu64", " "offset=%"PRIu64", size=%"PRIsize_t", "
"offset2=%"PRIu64" size2=%"PRIu64, "offset2=%"PRIu64" size2=%"PRIsize_t,
offset, size, offset2, size2); offset, size, offset2, size2);
offset = prev_sector; offset = prev_sector;
size = SECTOR_SIZE; size = SECTOR_SIZE;
@ -840,8 +839,8 @@ static struct volume_group *_vg_read_precommit_file(struct format_instance *fid,
return vg; return vg;
} }
static int _vg_write_file(struct format_instance *fid, struct volume_group *vg, static int _vg_write_file(struct format_instance *fid __attribute((unused)),
struct metadata_area *mda) struct volume_group *vg, struct metadata_area *mda)
{ {
struct text_context *tc = (struct text_context *) mda->metadata_locn; 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; 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 volume_group *vg,
struct metadata_area *mda) struct metadata_area *mda)
{ {
@ -972,7 +971,8 @@ static int _vg_commit_file(struct format_instance *fid, struct volume_group *vg,
return 1; 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 metadata_area *mda)
{ {
struct text_context *tc = (struct text_context *) mda->metadata_locn; 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, uint64_t pe_start, uint64_t pe_end,
int pvmetadatacopies, int pvmetadatacopies,
uint64_t pvmetadatasize, struct list *mdas, 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 mda_adjustment, disk_size, alignment;
uint64_t start1, mda_size1; /* First area - start of disk */ uint64_t start1, mda_size1; /* First area - start of disk */

View File

@ -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, static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
struct volume_group *vg, struct config_node *pvn, 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 physical_volume *pv;
struct pv_list *pvl; 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 */ /* FIXME Cope if LV not yet read in */
if ((pv = dm_hash_lookup(pv_hash, cv->v.str))) { 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; stack;
return 0; return 0;
} }
} else if ((lv1 = find_lv(seg->lv->vg, cv->v.str))) { } 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); flags);
} else { } else {
log_error("Couldn't find volume '%s' " 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; 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 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 logical_volume *lv;
struct lv_list *lvl; struct lv_list *lvl;
@ -544,9 +547,11 @@ static int _read_lvnames(struct format_instance *fid, struct dm_pool *mem,
return 1; 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 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 logical_volume *lv;
struct lv_list *lvl; struct lv_list *lvl;

View File

@ -31,7 +31,7 @@
#include <unistd.h> #include <unistd.h>
#ifndef CLUSTER_LOCKING_INTERNAL #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); void locking_end(void);
int locking_init(int type, struct config_tree *cf, uint32_t *flags); int locking_init(int type, struct config_tree *cf, uint32_t *flags);
#endif #endif
@ -295,7 +295,7 @@ static int _cluster_free_request(lvm_response_t * response, int num)
return 1; 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 status;
int i; int i;
@ -368,9 +368,9 @@ static int _lock_for_cluster(unsigned char cmd, unsigned int flags, char *name)
/* API entry point for LVM */ /* API entry point for LVM */
#ifdef CLUSTER_LOCKING_INTERNAL #ifdef CLUSTER_LOCKING_INTERNAL
static int _lock_resource(struct cmd_context *cmd, const char *resource, static int _lock_resource(struct cmd_context *cmd, const char *resource,
int flags) uint32_t flags)
#else #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 #endif
{ {
char lockname[PATH_MAX]; char lockname[PATH_MAX];

View File

@ -23,12 +23,12 @@ static void *_locking_lib = NULL;
static void (*_reset_fn) (void) = NULL; static void (*_reset_fn) (void) = NULL;
static void (*_end_fn) (void) = NULL; static void (*_end_fn) (void) = NULL;
static int (*_lock_fn) (struct cmd_context * cmd, const char *resource, 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, static int (*_init_fn) (int type, struct config_tree * cft,
uint32_t *flags) = NULL; uint32_t *flags) = NULL;
static int _lock_resource(struct cmd_context *cmd, const char *resource, static int _lock_resource(struct cmd_context *cmd, const char *resource,
int flags) uint32_t flags)
{ {
if (_lock_fn) if (_lock_fn)
return _lock_fn(cmd, resource, flags); return _lock_fn(cmd, resource, flags);

View File

@ -124,7 +124,7 @@ static void _install_ctrl_c_handler()
siginterrupt(SIGINT, 1); 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 operation;
int r = 1; 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, static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
int flags) uint32_t flags)
{ {
char lockfile[PATH_MAX]; char lockfile[PATH_MAX];

View File

@ -118,7 +118,7 @@ void sigint_restore(void)
sigaction(SIGINT, &_oldhandler, NULL); sigaction(SIGINT, &_oldhandler, NULL);
} }
static void _block_signals(int flags __attribute((unused))) static void _block_signals(uint32_t flags __attribute((unused)))
{ {
sigset_t set; sigset_t set;
@ -156,7 +156,7 @@ static void _unblock_signals(void)
return; return;
} }
static void _lock_memory(int flags) static void _lock_memory(uint32_t flags)
{ {
if (!(_locking.flags & LCK_PRE_MEMLOCK)) if (!(_locking.flags & LCK_PRE_MEMLOCK))
return; return;
@ -165,7 +165,7 @@ static void _lock_memory(int flags)
memlock_inc(); memlock_inc();
} }
static void _unlock_memory(int flags) static void _unlock_memory(uint32_t flags)
{ {
if (!(_locking.flags & LCK_PRE_MEMLOCK)) if (!(_locking.flags & LCK_PRE_MEMLOCK))
return; return;
@ -187,7 +187,7 @@ void reset_locking(void)
_unblock_signals(); _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) if ((flags & LCK_SCOPE_MASK) != LCK_VG)
return; return;
@ -313,7 +313,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname)
* VG locking is by VG name. * VG locking is by VG name.
* FIXME This should become VG uuid. * 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); _block_signals(flags);
_lock_memory(flags); _lock_memory(flags);
@ -331,7 +331,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource, int flags)
return 1; 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))); char resource[258] __attribute((aligned(8)));

View File

@ -35,7 +35,7 @@ int locking_is_clustered(void);
* Lock/unlock an individual logical volume * Lock/unlock an individual logical volume
* char *vol holds lvid * 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? * 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 * 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_NULL 0x00000000U /* LCK$_NLMODE */
#define LCK_READ 0x00000001 /* LCK$_CRMODE */ #define LCK_READ 0x00000001U /* LCK$_CRMODE */
/* LCK$_CWMODE */ /* LCK$_CWMODE */
#define LCK_PREAD 0x00000003 /* LCK$_PRMODE */ #define LCK_PREAD 0x00000003U /* LCK$_PRMODE */
#define LCK_WRITE 0x00000004 /* LCK$_PWMODE */ #define LCK_WRITE 0x00000004U /* LCK$_PWMODE */
#define LCK_EXCL 0x00000005 /* LCK$_EXMODE */ #define LCK_EXCL 0x00000005U /* LCK$_EXMODE */
#define LCK_UNLOCK 0x00000006 /* This is ours */ #define LCK_UNLOCK 0x00000006U /* This is ours */
/* /*
* Lock scope * Lock scope
*/ */
#define LCK_SCOPE_MASK 0x00000008 #define LCK_SCOPE_MASK 0x00000008U
#define LCK_VG 0x00000000 #define LCK_VG 0x00000000U
#define LCK_LV 0x00000008 #define LCK_LV 0x00000008U
/* /*
* Lock bits * Lock bits
*/ */
#define LCK_NONBLOCK 0x00000010 /* Don't block waiting for lock? */ #define LCK_NONBLOCK 0x00000010U /* Don't block waiting for lock? */
#define LCK_HOLD 0x00000020 /* Hold lock when lock_vol returns? */ #define LCK_HOLD 0x00000020U /* Hold lock when lock_vol returns? */
#define LCK_LOCAL 0x00000040 /* Don't propagate to other nodes */ #define LCK_LOCAL 0x00000040U /* Don't propagate to other nodes */
#define LCK_CLUSTER_VG 0x00000080 /* VG is clustered */ #define LCK_CLUSTER_VG 0x00000080U /* VG is clustered */
/* /*
* Additional lock bits for cluster communication * Additional lock bits for cluster communication
*/ */
#define LCK_PARTIAL_MODE 0x00000001 /* Running in partial mode */ #define LCK_PARTIAL_MODE 0x00000001U /* Running in partial mode */
#define LCK_MIRROR_NOSYNC_MODE 0x00000002 /* Mirrors don't require sync */ #define LCK_MIRROR_NOSYNC_MODE 0x00000002U /* Mirrors don't require sync */
#define LCK_DMEVENTD_MONITOR_MODE 0x00000004 /* Register with dmeventd */ #define LCK_DMEVENTD_MONITOR_MODE 0x00000004U /* Register with dmeventd */
/* /*

View File

@ -17,7 +17,7 @@
#include "config.h" #include "config.h"
typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, 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 (*fin_lock_fn) (void);
typedef void (*reset_lock_fn) (void); typedef void (*reset_lock_fn) (void);

View File

@ -37,7 +37,7 @@ static void _no_reset_locking(void)
} }
static int _no_lock_resource(struct cmd_context *cmd, const char *resource, static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
int flags) uint32_t flags)
{ {
switch (flags & LCK_SCOPE_MASK) { switch (flags & LCK_SCOPE_MASK) {
case LCK_VG: case LCK_VG:
@ -76,7 +76,7 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
return 1; 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->lock_resource = _no_lock_resource;
locking->reset_locking = _no_reset_locking; locking->reset_locking = _no_reset_locking;

View File

@ -50,7 +50,6 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
uint32_t extents, uint32_t extents,
struct physical_volume *mirrored_pv, struct physical_volume *mirrored_pv,
uint32_t mirrored_pe, uint32_t mirrored_pe,
uint32_t status,
struct list *allocatable_pvs, struct list *allocatable_pvs,
alloc_policy_t alloc, alloc_policy_t alloc,
struct list *parallel_areas); struct list *parallel_areas);

View File

@ -735,13 +735,13 @@ static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv,
(le - seg->le) / area_multiple, (le - seg->le) / area_multiple,
area_len, max_seg_len, area_len, max_seg_len,
only_single_area_segments ? 0 : 0, only_single_area_segments ? 0 : 0,
only_single_area_segments ? 1 : 0, only_single_area_segments ? 1U : 0U,
top_level_area_index != -1 ? top_level_area_index : s, top_level_area_index != -1 ? top_level_area_index : (int) s,
only_single_area_segments, fn, only_single_area_segments, fn,
data))) data)))
stack; stack;
} else if (seg_type(seg, s) == AREA_PV) } 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; stack;
if (r != 1) if (r != 1)
return r; return r;
@ -813,7 +813,7 @@ static int _is_contiguous(struct pv_segment *pvseg, struct pv_area *pva)
return 1; 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, struct pv_segment *pvseg, uint32_t s,
void *data) 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, static int _allocate(struct alloc_handle *ah,
struct volume_group *vg, struct volume_group *vg,
struct logical_volume *lv, uint32_t status, struct logical_volume *lv,
uint32_t new_extents, uint32_t new_extents,
struct list *allocatable_pvs, struct list *allocatable_pvs)
uint32_t stripes, uint32_t mirrors,
const struct segment_type *segtype)
{ {
struct pv_area **areas; struct pv_area **areas;
uint32_t allocated = lv ? lv->le_count : 0; uint32_t allocated = lv ? lv->le_count : 0;
@ -1197,7 +1195,6 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
uint32_t extents, uint32_t extents,
struct physical_volume *mirrored_pv, struct physical_volume *mirrored_pv,
uint32_t mirrored_pe, uint32_t mirrored_pe,
uint32_t status,
struct list *allocatable_pvs, struct list *allocatable_pvs,
alloc_policy_t alloc, alloc_policy_t alloc,
struct list *parallel_areas) struct list *parallel_areas)
@ -1230,8 +1227,8 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
} }
if (!segtype_is_virtual(segtype) && if (!segtype_is_virtual(segtype) &&
!_allocate(ah, vg, lv, status, (lv ? lv->le_count : 0) + extents, !_allocate(ah, vg, lv, (lv ? lv->le_count : 0) + extents,
allocatable_pvs, stripes, mirrors, segtype)) { allocatable_pvs)) {
stack; stack;
alloc_destroy(ah); alloc_destroy(ah);
return NULL; return NULL;
@ -1334,8 +1331,8 @@ int lv_add_mirror_segment(struct alloc_handle *ah,
struct logical_volume *lv, struct logical_volume *lv,
struct logical_volume **sub_lvs, struct logical_volume **sub_lvs,
uint32_t mirrors, uint32_t mirrors,
const struct segment_type *segtype, const struct segment_type *segtype __attribute((unused)),
uint32_t status, uint32_t status __attribute((unused)),
uint32_t region_size, uint32_t region_size,
struct logical_volume *log_lv) 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); return lv_add_virtual_segment(lv, status, extents, segtype);
if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors, 0, 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))) { allocatable_pvs, alloc, NULL))) {
stack; stack;
return 0; return 0;
@ -1556,7 +1553,7 @@ static int _for_each_sub_lv(struct cmd_context *cmd, struct logical_volume *lv,
void *data) void *data)
{ {
struct lv_segment *seg; struct lv_segment *seg;
int s; uint32_t s;
list_iterate_items(seg, &lv->segments) { list_iterate_items(seg, &lv->segments) {
if (seg->log_lv && !func(cmd, seg->log_lv, data)) if (seg->log_lv && !func(cmd, seg->log_lv, data))

View File

@ -323,7 +323,7 @@ pv_t *pv_create(const struct format_type *fmt,
int pv_resize(struct physical_volume *pv, struct volume_group *vg, int pv_resize(struct physical_volume *pv, struct volume_group *vg,
uint32_t new_pe_count); uint32_t new_pe_count);
int pv_analyze(struct cmd_context *cmd, const char *pv_name, 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, struct volume_group *vg_create(struct cmd_context *cmd, const char *name,
uint32_t extent_size, uint32_t max_pv, 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); struct logical_volume *log_lv);
int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, 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, 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, int insert_pvmove_mirrors(struct cmd_context *cmd,
struct logical_volume *lv_mirr, struct logical_volume *lv_mirr,

View File

@ -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, int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent, struct volume_group *vg, int consistent,
force_t force) force_t force __attribute((unused)))
{ {
struct physical_volume *pv; struct physical_volume *pv;
struct pv_list *pvl; struct pv_list *pvl;
@ -466,8 +466,8 @@ static int _recalc_extents(uint32_t *extents, const char *desc1,
return 1; return 1;
} }
int vg_change_pesize(struct cmd_context *cmd, struct volume_group *vg, int vg_change_pesize(struct cmd_context *cmd __attribute((unused)),
uint32_t new_size) struct volume_group *vg, uint32_t new_size)
{ {
uint32_t old_size = vg->extent_size; uint32_t old_size = vg->extent_size;
struct pv_list *pvl; struct pv_list *pvl;
@ -617,8 +617,8 @@ int vg_change_pesize(struct cmd_context *cmd, struct volume_group *vg,
return 1; return 1;
} }
int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from, int vg_split_mdas(struct cmd_context *cmd __attribute((unused)),
struct volume_group *vg_to) struct volume_group *vg_from, struct volume_group *vg_to)
{ {
struct metadata_area *mda, *mda2; struct metadata_area *mda, *mda2;
struct list *mdas_from, *mdas_to; struct list *mdas_from, *mdas_to;
@ -1783,7 +1783,7 @@ int is_orphan(pv_t *pv)
* 1 - success * 1 - success
*/ */
int pv_analyze(struct cmd_context *cmd, const char *pv_name, int pv_analyze(struct cmd_context *cmd, const char *pv_name,
int64_t label_sector) uint64_t label_sector)
{ {
struct label *label; struct label *label;
struct device *dev; struct device *dev;

View File

@ -118,7 +118,7 @@ static int _delete_lv(struct lv_segment *mirrored_seg, struct logical_volume *lv
* Reduce mirrored_seg to num_mirrors images. * Reduce mirrored_seg to num_mirrors images.
*/ */
int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, 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 m;
uint32_t extents; uint32_t extents;
@ -255,7 +255,8 @@ int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors,
return 1; 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; 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, 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 r;
int insync = 0; int insync = 0;
@ -416,7 +417,7 @@ static int _create_layers_for_mirror(struct alloc_handle *ah,
uint32_t first_area, uint32_t first_area,
uint32_t num_mirrors, uint32_t num_mirrors,
struct logical_volume *lv, struct logical_volume *lv,
const struct segment_type *segtype, const struct segment_type *segtype __attribute((unused)),
struct logical_volume **img_lvs) struct logical_volume **img_lvs)
{ {
uint32_t m; uint32_t m;
@ -467,7 +468,7 @@ int create_mirror_layers(struct alloc_handle *ah,
uint32_t num_mirrors, uint32_t num_mirrors,
struct logical_volume *lv, struct logical_volume *lv,
const struct segment_type *segtype, const struct segment_type *segtype,
uint32_t status, uint32_t status __attribute((unused)),
uint32_t region_size, uint32_t region_size,
struct logical_volume *log_lv) 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, int add_mirror_layers(struct alloc_handle *ah,
uint32_t num_mirrors, uint32_t num_mirrors,
uint32_t existing_mirrors, uint32_t existing_mirrors __attribute((unused)),
struct logical_volume *lv, struct logical_volume *lv,
const struct segment_type *segtype) const struct segment_type *segtype)
{ {

View File

@ -27,7 +27,7 @@ int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...)
n = vsnprintf(*buffer, *size, fmt, ap); n = vsnprintf(*buffer, *size, fmt, ap);
va_end(ap); va_end(ap);
if (n < 0 || (n == *size)) if (n < 0 || ((size_t)n == *size))
return 0; return 0;
*buffer += n; *buffer += n;
@ -40,10 +40,10 @@ int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...)
* *
* Returns: * Returns:
* len - incremented for each char we encounter, whether 'c' or not. * 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, void count_chars(const char *str, size_t *len, int *count,
const char c) const int c)
{ {
const char *ptr; 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'. * Count occurences of 'c' in 'str' of length 'size'.
* *
* Returns: * 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; size_t i;
unsigned count=0; unsigned count = 0;
for (i=0; i < size; i++) for (i = 0; i < len; i++)
if (str[i] == c) if (str[i] == c)
count++; count++;
return count;
return count;
} }
/* /*

View File

@ -32,7 +32,7 @@ char *build_dm_name(struct dm_pool *mem, const char *vg,
int validate_name(const char *n); int validate_name(const char *n);
void count_chars(const char *str, size_t *len, int *count, void count_chars(const char *str, size_t *len, int *count,
char c); const int c);
unsigned count_chars_len(const char *str, size_t size, char c); unsigned count_chars_len(const char *str, size_t len, const int c);
#endif #endif

View File

@ -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 * 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, 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); 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, 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); const char *name = dev_name(*(const struct device **) data);
return dm_report_field_string(rh, field, &name); 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, 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; const struct lv_segment *seg = (const struct lv_segment *) data;
unsigned int s; unsigned int s;
@ -141,9 +141,9 @@ static int _devices_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, 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; const struct list *tags = (const struct list *) data;
struct str_list *sl; 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); 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, 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 struct logical_volume *lv = (const struct logical_volume *) data;
struct lvinfo info; 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); 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, 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 struct logical_volume *lv = (const struct logical_volume *) data;
struct lvinfo info; 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); 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, 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 struct logical_volume *lv = (const struct logical_volume *) data;
struct lvinfo info; struct lvinfo info;
@ -331,9 +331,9 @@ static int _lvstatus_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, 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; const uint32_t status = *(const uint32_t *) data;
char *repstr; char *repstr;
@ -357,9 +357,9 @@ static int _pvstatus_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, 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; const struct volume_group *vg = (const struct volume_group *) data;
char *repstr; 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)), 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, 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; 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; 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, 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 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; 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, 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 struct logical_volume *lv = (const struct logical_volume *) data;
struct lv_segment *seg; 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, static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field, 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 struct logical_volume *lv = (const struct logical_volume *) data;
char *repstr, *lvname; char *repstr, *lvname;
@ -482,9 +482,9 @@ static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, 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 struct logical_volume *lv = (const struct logical_volume *) data;
const char *name; const char *name;
@ -501,7 +501,7 @@ static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, struct dm_report_field *field,
const void *data, void *private) const void *data, void *private)
{ {
@ -531,7 +531,8 @@ static int _size32_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, struct dm_report_field *field,
const void *data, void *private) 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); 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, struct dm_report_field *field,
const void *data, void *private) const void *data, void *private __attribute((unused)))
{ {
char *repstr = NULL; char *repstr = NULL;
@ -704,16 +705,16 @@ static int _uuid_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, 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); 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, 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); 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); 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, 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 struct logical_volume *lv = (const struct logical_volume *) data;
struct lvinfo info; struct lvinfo info;
@ -806,9 +807,9 @@ static int _snpercent_disp(struct dm_report *rh, struct dm_pool *mem,
return 1; 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, 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; struct logical_volume *lv = (struct logical_volume *) data;
float percent; float percent;

View File

@ -128,7 +128,7 @@ static int _snap_target_present(const struct lv_segment *seg __attribute((unused
#endif #endif
static int _snap_modules_needed(struct dm_pool *mem, static int _snap_modules_needed(struct dm_pool *mem,
const struct lv_segment *seg, const struct lv_segment *seg __attribute((unused)),
struct list *modules) struct list *modules)
{ {
if (!str_list_add(mem, modules, "snapshot")) { if (!str_list_add(mem, modules, "snapshot")) {

View File

@ -65,7 +65,7 @@ static int _zero_target_present(const struct lv_segment *seg __attribute((unused
#endif #endif
static int _zero_modules_needed(struct dm_pool *mem, static int _zero_modules_needed(struct dm_pool *mem,
const struct lv_segment *seg, const struct lv_segment *seg __attribute((unused)),
struct list *modules) struct list *modules)
{ {
if (!str_list_add(mem, modules, "zero")) { if (!str_list_add(mem, modules, "zero")) {

View File

@ -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, if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype,
1, lp->mirrors - 1, 1, lp->mirrors - 1,
corelog ? 0 : 1, corelog ? 0U : 1U,
lv->le_count * (lp->mirrors - 1), lv->le_count * (lp->mirrors - 1),
NULL, 0, 0, lp->pvh, NULL, 0, lp->pvh,
lp->alloc, lp->alloc,
parallel_areas))) parallel_areas)))
return_0; 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, if (!(ah = allocate_extents(lv->vg, NULL, segtype, 0,
0, 1, 0, 0, 1, 0,
NULL, 0, 0, lp->pvh, NULL, 0, lp->pvh,
lp->alloc, lp->alloc,
parallel_areas))) { parallel_areas))) {
stack; stack;
@ -503,7 +503,7 @@ static int lvconvert_snapshot(struct cmd_context *cmd,
if (!lp->zero || !(lv->status & LVM_WRITE)) if (!lp->zero || !(lv->status & LVM_WRITE))
log_warn("WARNING: \"%s\" not zeroed", lv->name); 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 " log_error("Aborting. Failed to wipe snapshot "
"exception store."); "exception store.");
return 0; return 0;

View File

@ -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. " log_error("Volume too large (%s) for extent size %s. "
"Upper limit is %s.", "Upper limit is %s.",
display_size(cmd, tmp_size), 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 * display_size(cmd, (uint64_t) UINT32_MAX *
vg->extent_size)); vg->extent_size));
return 0; 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 */ /* FIXME Calculate how many extents needed for the log */
if (!(ah = allocate_extents(vg, NULL, lp->segtype, lp->stripes, if (!(ah = allocate_extents(vg, NULL, lp->segtype, lp->stripes,
lp->mirrors, lp->corelog ? 0 : 1, lp->mirrors, lp->corelog ? 0U : 1U,
lp->extents, NULL, 0, 0, lp->extents, NULL, 0,
pvh, lp->alloc, NULL))) { pvh, lp->alloc, NULL))) {
stack; stack;
return 0; return 0;
@ -804,7 +804,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
} }
if ((lp->zero || lp->snapshot) && activation()) { 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 */ /* FIXME Remove the failed lv we just added */
log_error("Aborting. Failed to wipe snapshot " log_error("Aborting. Failed to wipe snapshot "
"exception store. Remove new LV and retry."); "exception store. Remove new LV and retry.");

View File

@ -32,7 +32,7 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Scanning %s", argv[i]); log_verbose("Scanning %s", argv[i]);
pv_analyze(cmd, argv[i], pv_analyze(cmd, argv[i],
arg_int64_value(cmd, labelsector_ARG, arg_uint64_value(cmd, labelsector_ARG,
UINT64_C(0))); UINT64_C(0)));
} }

View File

@ -134,7 +134,8 @@ out:
} }
static int _pvs_in_vg(struct cmd_context *cmd, const char *vg_name, 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) void *handle)
{ {
if (!vg) { 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, 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) void *handle)
{ {
if (!vg) { if (!vg) {

View File

@ -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 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, int (*process_single) (struct cmd_context * cmd,
struct logical_volume * lv, struct logical_volume * lv,
void *handle)) void *handle))
@ -392,7 +392,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
list_init(&lvnames); list_init(&lvnames);
break; break;
} else if (!strncmp(vg_name, vgname, strlen(vgname)) && } 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, if (!str_list_add(cmd->mem, &lvnames,
dm_pool_strdup(cmd->mem, dm_pool_strdup(cmd->mem,
lv_name + 1))) { 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, static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
const char *vgid, const char *vgid,
struct list *tags, struct list *arg_vgnames, 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 ret_max,
int (*process_single) (struct cmd_context * cmd, int (*process_single) (struct cmd_context * cmd,
const char *vg_name, 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 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, int (*process_single) (struct cmd_context * cmd,
const char *vg_name, const char *vg_name,
struct volume_group * vg, struct volume_group * vg,
@ -1133,7 +1133,7 @@ struct list *clone_pv_list(struct dm_pool *mem, struct list *pvsl)
* Attempt metadata recovery * Attempt metadata recovery
*/ */
struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname, struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname,
int lock_type) uint32_t lock_type)
{ {
int consistent = 1; int consistent = 1;

View File

@ -24,10 +24,10 @@ int autobackup_init(const char *backup_dir, int keep_days, int keep_number,
int autobackup(struct volume_group *vg); int autobackup(struct volume_group *vg);
struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname, 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 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, int (*process_single) (struct cmd_context * cmd,
const char *vg_name, const char *vg_name,
struct volume_group * vg, struct volume_group * vg,
@ -49,7 +49,7 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
void *handle)); void *handle));
int process_each_lv(struct cmd_context *cmd, int argc, char **argv, 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, int (*process_single) (struct cmd_context * cmd,
struct logical_volume * lv, struct logical_volume * lv,
void *handle)); void *handle));

View File

@ -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, if (!reconfigure_mirror_images(mirrored_seg, mimages,
NULL, remove_log)) { NULL, remove_log)) {
stack; stack;

View File

@ -173,7 +173,7 @@ static int _move_mirrors(struct volume_group *vg_from,
struct list *lvh, *lvht; struct list *lvh, *lvht;
struct logical_volume *lv; struct logical_volume *lv;
struct lv_segment *seg; struct lv_segment *seg;
int i, seg_in, log_in; unsigned s, seg_in, log_in;
list_iterate_safe(lvh, lvht, &vg_from->lvs) { list_iterate_safe(lvh, lvht, &vg_from->lvs) {
lv = list_item(lvh, struct lv_list)->lv; 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 = first_seg(lv);
seg_in = 0; seg_in = 0;
for (i = 0; i < seg->area_count; i++) for (s = 0; s < seg->area_count; s++)
if (_lv_is_in_vg(vg_to, seg_lv(seg, i))) if (_lv_is_in_vg(vg_to, seg_lv(seg, s)))
seg_in++; seg_in++;
log_in = (!seg->log_lv || _lv_is_in_vg(vg_to, seg->log_lv)); log_in = (!seg->log_lv || _lv_is_in_vg(vg_to, seg->log_lv));