mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
gcc: cleanup some sign warnings
When comparing unsigned with int, the comparision is made as 'unsigned' type, so make it rather explicit which type is being compared.
This commit is contained in:
parent
293aabe4cd
commit
dbc71dc05e
@ -1440,7 +1440,7 @@ static void cpg_leave_callback(struct clog_cpg *match,
|
|||||||
free(rq);
|
free(rq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0, j = 0; i < match->checkpoints_needed; i++, j++) {
|
for (i = 0, j = 0; (int) i < match->checkpoints_needed; i++, j++) {
|
||||||
match->checkpoint_requesters[j] = match->checkpoint_requesters[i];
|
match->checkpoint_requesters[j] = match->checkpoint_requesters[i];
|
||||||
if (match->checkpoint_requesters[i] == left->nodeid) {
|
if (match->checkpoint_requesters[i] == left->nodeid) {
|
||||||
LOG_ERROR("[%s] Removing pending ckpt from needed list (%u is leaving)",
|
LOG_ERROR("[%s] Removing pending ckpt from needed list (%u is leaving)",
|
||||||
|
@ -317,7 +317,7 @@ static void log_save_line(int len, char *line,
|
|||||||
unsigned int w = *wrap;
|
unsigned int w = *wrap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len < LOG_DUMP_SIZE - p) {
|
if (len < (int) (LOG_DUMP_SIZE - p)) {
|
||||||
memcpy(log_buf + p, line, len);
|
memcpy(log_buf + p, line, len);
|
||||||
p += len;
|
p += len;
|
||||||
|
|
||||||
|
@ -1847,14 +1847,14 @@ static int _pool_callback(struct dm_tree_node *node,
|
|||||||
log_sys_error("close", argv[args]);
|
log_sys_error("close", argv[args]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (ret = 0; ret < DM_ARRAY_SIZE(buf); ++ret)
|
for (ret = 0; ret < (int) DM_ARRAY_SIZE(buf); ++ret)
|
||||||
if (buf[ret])
|
if (buf[ret])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (close(fd))
|
if (close(fd))
|
||||||
log_sys_error("close", argv[args]);
|
log_sys_error("close", argv[args]);
|
||||||
|
|
||||||
if (ret == DM_ARRAY_SIZE(buf)) {
|
if (ret == (int) DM_ARRAY_SIZE(buf)) {
|
||||||
log_debug("%s skipped, detect empty disk header on %s.",
|
log_debug("%s skipped, detect empty disk header on %s.",
|
||||||
argv[0], argv[args]);
|
argv[0], argv[args]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -452,7 +452,7 @@ void print_log(int level, const char *file, int line, int dm_errno_or_class,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
bufused += n;
|
bufused += n;
|
||||||
if (n >= sizeof(buf))
|
if (n >= (int) sizeof(buf))
|
||||||
bufused = sizeof(buf) - 1;
|
bufused = sizeof(buf) - 1;
|
||||||
done:
|
done:
|
||||||
buf[bufused] = '\n';
|
buf[bufused] = '\n';
|
||||||
|
@ -6201,7 +6201,7 @@ int remove_layer_from_lv(struct logical_volume *lv,
|
|||||||
struct lv_segment *parent_seg;
|
struct lv_segment *parent_seg;
|
||||||
struct segment_type *segtype;
|
struct segment_type *segtype;
|
||||||
struct lv_names lv_names;
|
struct lv_names lv_names;
|
||||||
int r;
|
unsigned r;
|
||||||
|
|
||||||
log_very_verbose("Removing layer %s for %s", layer_lv->name, lv->name);
|
log_very_verbose("Removing layer %s for %s", layer_lv->name, lv->name);
|
||||||
|
|
||||||
@ -6277,7 +6277,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
|
|||||||
struct segment_type *segtype;
|
struct segment_type *segtype;
|
||||||
struct lv_segment *mapseg;
|
struct lv_segment *mapseg;
|
||||||
struct lv_names lv_names;
|
struct lv_names lv_names;
|
||||||
unsigned exclusive = 0;
|
unsigned exclusive = 0, i;
|
||||||
|
|
||||||
/* create an empty layer LV */
|
/* create an empty layer LV */
|
||||||
if (dm_snprintf(name, sizeof(name), "%s%s", lv_where->name, layer_suffix) < 0) {
|
if (dm_snprintf(name, sizeof(name), "%s%s", lv_where->name, layer_suffix) < 0) {
|
||||||
@ -6370,8 +6370,8 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
|
|||||||
* currently supported only for thin data layer
|
* currently supported only for thin data layer
|
||||||
* FIXME: without strcmp it breaks mirrors....
|
* FIXME: without strcmp it breaks mirrors....
|
||||||
*/
|
*/
|
||||||
for (r = 0; r < DM_ARRAY_SIZE(_suffixes); ++r)
|
for (i = 0; i < DM_ARRAY_SIZE(_suffixes); ++i)
|
||||||
if (strcmp(layer_suffix, _suffixes[r]) == 0) {
|
if (strcmp(layer_suffix, _suffixes[i]) == 0) {
|
||||||
lv_names.old = lv_where->name;
|
lv_names.old = lv_where->name;
|
||||||
lv_names.new = layer_lv->name;
|
lv_names.new = layer_lv->name;
|
||||||
if (!for_each_sub_lv(layer_lv, _rename_cb, (void *) &lv_names))
|
if (!for_each_sub_lv(layer_lv, _rename_cb, (void *) &lv_names))
|
||||||
|
@ -2572,7 +2572,7 @@ static int _lv_validate_references_single(struct logical_volume *lv, void *data)
|
|||||||
*/
|
*/
|
||||||
static int _validate_lock_args_chars(const char *lock_args)
|
static int _validate_lock_args_chars(const char *lock_args)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
char c;
|
char c;
|
||||||
int found_colon = 0;
|
int found_colon = 0;
|
||||||
int r = 1;
|
int r = 1;
|
||||||
@ -2581,13 +2581,13 @@ static int _validate_lock_args_chars(const char *lock_args)
|
|||||||
c = lock_args[i];
|
c = lock_args[i];
|
||||||
|
|
||||||
if (!isalnum(c) && c != '.' && c != '_' && c != '-' && c != '+' && c != ':') {
|
if (!isalnum(c) && c != '.' && c != '_' && c != '-' && c != '+' && c != ':') {
|
||||||
log_error(INTERNAL_ERROR "Invalid character at index %d of lock_args \"%s\"",
|
log_error(INTERNAL_ERROR "Invalid character at index %u of lock_args \"%s\"",
|
||||||
i, lock_args);
|
i, lock_args);
|
||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == ':' && found_colon) {
|
if (c == ':' && found_colon) {
|
||||||
log_error(INTERNAL_ERROR "Invalid colon at index %d of lock_args \"%s\"",
|
log_error(INTERNAL_ERROR "Invalid colon at index %u of lock_args \"%s\"",
|
||||||
i, lock_args);
|
i, lock_args);
|
||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count,
|
|||||||
log_verbose("Extracting %u %s from %s/%s", extract,
|
log_verbose("Extracting %u %s from %s/%s", extract,
|
||||||
(extract > 1) ? "images" : "image",
|
(extract > 1) ? "images" : "image",
|
||||||
lv->vg->name, lv->name);
|
lv->vg->name, lv->name);
|
||||||
if (dm_list_size(target_pvs) < extract) {
|
if ((int) dm_list_size(target_pvs) < extract) {
|
||||||
log_error("Unable to remove %d images: Only %d device%s given.",
|
log_error("Unable to remove %d images: Only %d device%s given.",
|
||||||
extract, dm_list_size(target_pvs),
|
extract, dm_list_size(target_pvs),
|
||||||
(dm_list_size(target_pvs) == 1) ? "" : "s");
|
(dm_list_size(target_pvs) == 1) ? "" : "s");
|
||||||
|
@ -320,9 +320,9 @@ int pool_check_overprovisioning(const struct logical_volume *lv)
|
|||||||
* for growing - threshold is 100% or percent is 0% */
|
* for growing - threshold is 100% or percent is 0% */
|
||||||
sz = poolsum;
|
sz = poolsum;
|
||||||
else
|
else
|
||||||
sz = ~0; /* No warning */
|
sz = UINT64_C(~0); /* No warning */
|
||||||
|
|
||||||
if (sz != ~0) {
|
if (sz != UINT64_C(~0)) {
|
||||||
log_warn("WARNING: Sum of all thin volume sizes (%s) exceeds the "
|
log_warn("WARNING: Sum of all thin volume sizes (%s) exceeds the "
|
||||||
"size of thin pool%s%s%s (%s)!",
|
"size of thin pool%s%s%s (%s)!",
|
||||||
display_size(cmd, thinsum),
|
display_size(cmd, thinsum),
|
||||||
|
@ -121,7 +121,7 @@ static int _raid_text_import(struct lv_segment *seg,
|
|||||||
{ "min_recovery_rate", &seg->min_recovery_rate },
|
{ "min_recovery_rate", &seg->min_recovery_rate },
|
||||||
{ "max_recovery_rate", &seg->max_recovery_rate },
|
{ "max_recovery_rate", &seg->max_recovery_rate },
|
||||||
}, *aip = raid_attr_import;
|
}, *aip = raid_attr_import;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < DM_ARRAY_SIZE(raid_attr_import); i++, aip++) {
|
for (i = 0; i < DM_ARRAY_SIZE(raid_attr_import); i++, aip++) {
|
||||||
if (dm_config_has_node(sn, aip->name)) {
|
if (dm_config_has_node(sn, aip->name)) {
|
||||||
|
@ -100,7 +100,7 @@ void *dm_pool_alloc_aligned(struct dm_pool *p, size_t s, unsigned alignment)
|
|||||||
_align_chunk(c, alignment);
|
_align_chunk(c, alignment);
|
||||||
|
|
||||||
/* have we got room ? */
|
/* have we got room ? */
|
||||||
if (!c || (c->begin > c->end) || (c->end - c->begin < s)) {
|
if (!c || (c->begin > c->end) || ((c->end - c->begin) < (int) s)) {
|
||||||
/* allocate new chunk */
|
/* allocate new chunk */
|
||||||
size_t needed = s + alignment + sizeof(struct chunk);
|
size_t needed = s + alignment + sizeof(struct chunk);
|
||||||
c = _new_chunk(p, (needed > p->chunk_size) ?
|
c = _new_chunk(p, (needed > p->chunk_size) ?
|
||||||
@ -177,7 +177,7 @@ int dm_pool_begin_object(struct dm_pool *p, size_t hint)
|
|||||||
if (c)
|
if (c)
|
||||||
_align_chunk(c, align);
|
_align_chunk(c, align);
|
||||||
|
|
||||||
if (!c || (c->begin > c->end) || (c->end - c->begin < hint)) {
|
if (!c || (c->begin > c->end) || ((c->end - c->begin) < (int) hint)) {
|
||||||
/* allocate a new chunk */
|
/* allocate a new chunk */
|
||||||
c = _new_chunk(p,
|
c = _new_chunk(p,
|
||||||
hint > (p->chunk_size - sizeof(struct chunk)) ?
|
hint > (p->chunk_size - sizeof(struct chunk)) ?
|
||||||
@ -200,7 +200,7 @@ int dm_pool_grow_object(struct dm_pool *p, const void *extra, size_t delta)
|
|||||||
if (!delta)
|
if (!delta)
|
||||||
delta = strlen(extra);
|
delta = strlen(extra);
|
||||||
|
|
||||||
if (c->end - (c->begin + p->object_len) < delta) {
|
if ((c->end - (c->begin + p->object_len)) < (int) delta) {
|
||||||
/* move into a new chunk */
|
/* move into a new chunk */
|
||||||
if (p->object_len + delta > (p->chunk_size / 2))
|
if (p->object_len + delta > (p->chunk_size / 2))
|
||||||
nc = _new_chunk(p, (p->object_len + delta) * 2);
|
nc = _new_chunk(p, (p->object_len + delta) * 2);
|
||||||
|
@ -789,7 +789,7 @@ static int _lvchange_writemostly(struct logical_volume *lv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (s = 0; s < raid_seg->area_count; s++) {
|
for (s = 0; s < (int) raid_seg->area_count; s++) {
|
||||||
/*
|
/*
|
||||||
* We don't bother checking the metadata area,
|
* We don't bother checking the metadata area,
|
||||||
* since writemostly only affects the data areas.
|
* since writemostly only affects the data areas.
|
||||||
|
@ -90,7 +90,7 @@ struct convert_poll_id_list {
|
|||||||
|
|
||||||
static int _lvconvert_validate_names(struct lvconvert_params *lp)
|
static int _lvconvert_validate_names(struct lvconvert_params *lp)
|
||||||
{
|
{
|
||||||
int i, j;
|
unsigned i, j;
|
||||||
const char *names[] = {
|
const char *names[] = {
|
||||||
(lp->lv_name == lp->pool_data_name) ? NULL : lp->lv_name, "converted",
|
(lp->lv_name == lp->pool_data_name) ? NULL : lp->lv_name, "converted",
|
||||||
lp->pool_data_name, "pool",
|
lp->pool_data_name, "pool",
|
||||||
|
Loading…
Reference in New Issue
Block a user