mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
gcc: use apropriate type for reading and printing values
This commit is contained in:
parent
b918afb693
commit
ee0cb17608
@ -205,7 +205,7 @@ static int _get_proc_number(const char *file, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (getline(&line, &len, fl) != -1) {
|
while (getline(&line, &len, fl) != -1) {
|
||||||
if (sscanf(line, "%d %255s\n", &num, &nm[0]) == 2) {
|
if (sscanf(line, "%u %255s\n", &num, &nm[0]) == 2) {
|
||||||
if (!strcmp(name, nm)) {
|
if (!strcmp(name, nm)) {
|
||||||
if (number) {
|
if (number) {
|
||||||
*number = num;
|
*number = num;
|
||||||
|
@ -512,7 +512,7 @@ int unmangle_string(const char *str, const char *str_name, size_t len,
|
|||||||
int strict = mode != DM_STRING_MANGLING_NONE;
|
int strict = mode != DM_STRING_MANGLING_NONE;
|
||||||
char str_rest[DM_NAME_LEN];
|
char str_rest[DM_NAME_LEN];
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
int code;
|
unsigned int code;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (!str || !buf)
|
if (!str || !buf)
|
||||||
|
@ -98,7 +98,7 @@ void dm_pools_check_leaks(void)
|
|||||||
p->orig_pool,
|
p->orig_pool,
|
||||||
p->name, p->stats.bytes);
|
p->name, p->stats.bytes);
|
||||||
#else
|
#else
|
||||||
log_error(" [%p] %s", p, p->name);
|
log_error(" [%p] %s", (void *)p, p->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&_dm_pools_mutex);
|
pthread_mutex_unlock(&_dm_pools_mutex);
|
||||||
|
@ -737,7 +737,7 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
|
|||||||
|
|
||||||
keylen = strlen("scan_lvs:");
|
keylen = strlen("scan_lvs:");
|
||||||
if (!strncmp(_hint_line, "scan_lvs:", keylen)) {
|
if (!strncmp(_hint_line, "scan_lvs:", keylen)) {
|
||||||
int scan_lvs = 0;
|
unsigned scan_lvs = 0;
|
||||||
if ((sscanf(_hint_line + keylen, "%u", &scan_lvs) != 1) ||
|
if ((sscanf(_hint_line + keylen, "%u", &scan_lvs) != 1) ||
|
||||||
scan_lvs != cmd->scan_lvs) {
|
scan_lvs != cmd->scan_lvs) {
|
||||||
log_debug("ignore hints with different or unreadable scan_lvs");
|
log_debug("ignore hints with different or unreadable scan_lvs");
|
||||||
|
@ -716,7 +716,7 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
|
|||||||
dev_name(devl->dev),
|
dev_name(devl->dev),
|
||||||
(int)MAJOR(devl->dev->dev),
|
(int)MAJOR(devl->dev->dev),
|
||||||
(int)MINOR(devl->dev->dev),
|
(int)MINOR(devl->dev->dev),
|
||||||
devl->dev->bcache_fd, bb);
|
devl->dev->bcache_fd, (void *)bb);
|
||||||
|
|
||||||
ret = _process_block(cmd, f, devl->dev, bb, 0, 0, &is_lvm_device);
|
ret = _process_block(cmd, f, devl->dev, bb, 0, 0, &is_lvm_device);
|
||||||
|
|
||||||
|
@ -5239,9 +5239,9 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
|
|||||||
dm_config_destroy(cft);
|
dm_config_destroy(cft);
|
||||||
} else {
|
} else {
|
||||||
if (vg->vg_precommitted)
|
if (vg->vg_precommitted)
|
||||||
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", vg, vg->vg_precommitted);
|
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", (void *)vg, (void *)vg->vg_precommitted);
|
||||||
if (vg->vg_committed)
|
if (vg->vg_committed)
|
||||||
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", vg, vg->vg_committed);
|
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", (void *)vg, (void *)vg->vg_committed);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
/* We return with the VG lock held when read is successful. */
|
/* We return with the VG lock held when read is successful. */
|
||||||
@ -5265,9 +5265,9 @@ bad:
|
|||||||
*/
|
*/
|
||||||
if (error_vg && vg) {
|
if (error_vg && vg) {
|
||||||
if (vg->vg_precommitted)
|
if (vg->vg_precommitted)
|
||||||
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", vg, vg->vg_precommitted);
|
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", (void *)vg, (void *)vg->vg_precommitted);
|
||||||
if (vg->vg_committed)
|
if (vg->vg_committed)
|
||||||
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", vg, vg->vg_committed);
|
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", (void *)vg, (void *)vg->vg_committed);
|
||||||
|
|
||||||
/* caller must unlock_vg and release_vg */
|
/* caller must unlock_vg and release_vg */
|
||||||
*error_vg = vg;
|
*error_vg = vg;
|
||||||
|
@ -61,7 +61,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
|
|||||||
dm_list_init(&vg->removed_historical_lvs);
|
dm_list_init(&vg->removed_historical_lvs);
|
||||||
dm_list_init(&vg->removed_pvs);
|
dm_list_init(&vg->removed_pvs);
|
||||||
|
|
||||||
log_debug_mem("Allocated VG %s at %p.", vg->name ? : "<no name>", vg);
|
log_debug_mem("Allocated VG %s at %p.", vg->name ? : "<no name>", (void *)vg);
|
||||||
|
|
||||||
return vg;
|
return vg;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ static void _free_vg(struct volume_group *vg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug_mem("Freeing VG %s at %p.", vg->name ? : "<no name>", vg);
|
log_debug_mem("Freeing VG %s at %p.", vg->name ? : "<no name>", (void *)vg);
|
||||||
|
|
||||||
dm_hash_destroy(vg->hostnames);
|
dm_hash_destroy(vg->hostnames);
|
||||||
dm_pool_destroy(vg->vgmem);
|
dm_pool_destroy(vg->vgmem);
|
||||||
|
@ -232,7 +232,7 @@ static int _maps_line(const struct dm_config_node *cn, lvmlock_t lock,
|
|||||||
const char *line, size_t *mstats)
|
const char *line, size_t *mstats)
|
||||||
{
|
{
|
||||||
const struct dm_config_value *cv;
|
const struct dm_config_value *cv;
|
||||||
long from, to;
|
unsigned long from, to;
|
||||||
int pos;
|
int pos;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char fr, fw, fx, fp;
|
char fr, fw, fx, fp;
|
||||||
|
@ -204,7 +204,7 @@ static int _get_proc_number(const char *file, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (getline(&line, &len, fl) != -1) {
|
while (getline(&line, &len, fl) != -1) {
|
||||||
if (sscanf(line, "%d %255s\n", &num, &nm[0]) == 2) {
|
if (sscanf(line, "%u %255s\n", &num, &nm[0]) == 2) {
|
||||||
if (!strcmp(name, nm)) {
|
if (!strcmp(name, nm)) {
|
||||||
if (number) {
|
if (number) {
|
||||||
*number = num;
|
*number = num;
|
||||||
|
@ -510,7 +510,7 @@ int unmangle_string(const char *str, const char *str_name, size_t len,
|
|||||||
int strict = mode != DM_STRING_MANGLING_NONE;
|
int strict = mode != DM_STRING_MANGLING_NONE;
|
||||||
char str_rest[DM_NAME_LEN];
|
char str_rest[DM_NAME_LEN];
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
int code;
|
unsigned int code;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (!str || !buf)
|
if (!str || !buf)
|
||||||
|
@ -403,7 +403,7 @@ static int _stats_bound(const struct dm_stats *dms)
|
|||||||
if (dms->bind_major > 0 || dms->bind_name || dms->bind_uuid)
|
if (dms->bind_major > 0 || dms->bind_name || dms->bind_uuid)
|
||||||
return 1;
|
return 1;
|
||||||
/* %p format specifier expects a void pointer. */
|
/* %p format specifier expects a void pointer. */
|
||||||
log_error("Stats handle at %p is not bound.", dms);
|
log_error("Stats handle at %p is not bound.", (const void *)dms);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void dm_pools_check_leaks(void)
|
|||||||
p->orig_pool,
|
p->orig_pool,
|
||||||
p->name, p->stats.bytes);
|
p->name, p->stats.bytes);
|
||||||
#else
|
#else
|
||||||
log_error(" [%p] %s", p, p->name);
|
log_error(" [%p] %s", (void *)p, p->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&_dm_pools_mutex);
|
pthread_mutex_unlock(&_dm_pools_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user