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

lvmetad: Use "%" PRId64 in place of "%d" for extra clarity.

This commit is contained in:
Petr Rockai 2012-09-09 21:57:59 +02:00
parent c7b17836ea
commit c9f56d639b
4 changed files with 18 additions and 15 deletions

15
lib/cache/lvmetad.c vendored
View File

@ -508,7 +508,7 @@ int lvmetad_pv_lookup_by_dev(struct cmd_context *cmd, struct device *dev, int *f
if (!lvmetad_active())
return_0;
reply = _lvmetad_send("pv_lookup", "device = %d", dev->dev, NULL);
reply = _lvmetad_send("pv_lookup", "device = %" PRId64, (int64_t) dev->dev, NULL);
if (!_lvmetad_handle_reply(reply, "lookup PV", dev_name(dev), found))
goto_out;
@ -624,7 +624,10 @@ static int _extract_da(struct disk_locn *da, void *baton)
dm_snprintf(id, 32, "da%d", b->i);
if (!(cn = make_config_node(b->cft, id, b->cft->root, b->pre_sib)))
return 0;
if (!config_make_nodes(b->cft, cn, NULL, "offset = %d", da->offset, "size = %d", da->size, NULL))
if (!config_make_nodes(b->cft, cn, NULL,
"offset = %"PRId64, (int64_t) da->offset,
"size = %"PRId64, (int64_t) da->size,
NULL))
return 0;
b->i ++;
@ -676,10 +679,10 @@ int lvmetad_pv_found(struct id pvid, struct device *device, const struct format_
}
if (!config_make_nodes(pvmeta, pvmeta->root, NULL,
"device = %d", device->dev,
"dev_size = %d", info ? lvmcache_device_size(info) : 0,
"device = %"PRId64, (int64_t) device->dev,
"dev_size = %"PRId64, (int64_t) (info ? lvmcache_device_size(info) : 0),
"format = %s", fmt->name,
"label_sector = %d", label_sector,
"label_sector = %"PRId64, (int64_t) label_sector,
"id = %s", uuid,
NULL))
{
@ -751,7 +754,7 @@ int lvmetad_pv_gone(dev_t device, const char *pv_name, activation_handler handle
* the whole stack from top to bottom (not yet upstream).
*/
reply = _lvmetad_send("pv_gone", "device = %d", device, NULL);
reply = _lvmetad_send("pv_gone", "device = %" PRId64, (int64_t) device, NULL);
result = _lvmetad_handle_reply(reply, "drop PV", pv_name, &found);
/* We don't care whether or not the daemon had the PV cached. */

View File

@ -1617,10 +1617,10 @@ static int _mda_export_text_raw(struct metadata_area *mda,
struct mda_context *mdc = (struct mda_context *) mda->metadata_locn;
return config_make_nodes(cft, parent, NULL,
"ignore = %d", mda_is_ignored(mda),
"start = %d", mdc->area.start,
"size = %d", mdc->area.size,
"free_sectors = %d", mdc->free_sectors,
"ignore = %" PRId64, (int64_t) mda_is_ignored(mda),
"start = %" PRId64, (int64_t) mdc->area.start,
"size = %" PRId64, (int64_t) mdc->area.size,
"free_sectors = %" PRId64, (int64_t) mdc->free_sectors,
NULL) ? 1 : 0;
}

View File

@ -115,9 +115,9 @@ char *format_buffer_v(const char *head, va_list ap)
goto fail;
}
keylen = strchr(next, '=') - next;
if (strstr(next, "%d")) {
int value = va_arg(ap, int);
dm_asprintf(&buffer, "%s%.*s= %d\n", buffer, keylen, next, value);
if (strstr(next, "%d") || strstr(next, "%" PRId64)) {
int64_t value = va_arg(ap, int64_t);
dm_asprintf(&buffer, "%s%.*s= %" PRId64 "\n", buffer, keylen, next, value);
dm_free(old);
} else if (strstr(next, "%s")) {
char *value = va_arg(ap, char *);
@ -301,7 +301,7 @@ struct dm_config_node *config_make_nodes_v(struct dm_config_tree *cft,
char *key = dm_pool_strdup(cft->mem, next);
*strchr(key, '=') = 0;
if (!strcmp(fmt, "%d")) {
if (!strcmp(fmt, "%d") || !strcmp(fmt, "%" PRId64)) {
int64_t value = va_arg(ap, int64_t);
if (!(cn = make_int_node(cft, key, value, parent, pre_sib)))
return 0;

View File

@ -360,7 +360,7 @@ static response builtin_handler(daemon_state s, client_handle h, request r)
if (!strcmp(rq, "hello")) {
return daemon_reply_simple("OK", "protocol = %s", s.protocol ?: "default",
"version = %d", s.protocol_version, NULL);
"version = %" PRId64, (int64_t) s.protocol_version, NULL);
}
response res = { .buffer = NULL, .error = EPROTO };