From bcb8dfad9cbb4c6af7ae7f9584e36449a03cd1b6 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 29 Jan 2013 23:05:49 -0800 Subject: [PATCH] cls_rbd, cls_rgw: use PRI*64 when printing/logging 64-bit values caused segfaults in 32-bit build Fixes: #3961 Signed-off-by: Dan Mick Reviewed-by: Sage Weil (cherry picked from commit e253830abac76af03c63239302691f7fac1af381) --- src/cls/rbd/cls_rbd.cc | 14 ++++++++------ src/cls/rgw/cls_rgw.cc | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index 24159b7fa7ebe..ad3402e17ba71 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -38,6 +38,7 @@ #include "include/types.h" #include "objclass/objclass.h" #include "include/rbd_types.h" +#include #include "cls/rbd/cls_rbd.h" @@ -498,7 +499,7 @@ int get_protection_status(cls_method_context_t hctx, bufferlist *in, key_from_snap_id(snap_id.val, &snapshot_key); r = read_key(hctx, snapshot_key, &snap); if (r < 0) { - CLS_ERR("could not read key for snapshot id %llu", snap_id.val); + CLS_ERR("could not read key for snapshot id %"PRIu64, snap_id.val); return r; } @@ -565,7 +566,7 @@ int set_protection_status(cls_method_context_t hctx, bufferlist *in, key_from_snap_id(snap_id.val, &snapshot_key); r = read_key(hctx, snapshot_key, &snap); if (r < 0) { - CLS_ERR("could not read key for snapshot id %d", snap_id.val); + CLS_ERR("could not read key for snapshot id %"PRIu64, snap_id.val); return r; } @@ -946,7 +947,7 @@ int add_child(cls_method_context_t hctx, bufferlist *in, bufferlist *out) if (r < 0) return r; - CLS_LOG(20, "add_child %s to (%d, %s, %d)", c_image_id.c_str(), + CLS_LOG(20, "add_child %s to (%"PRIu64", %s, %"PRIu64")", c_image_id.c_str(), p_pool_id, p_image_id.c_str(), p_snap_id.val); string key = parent_key(p_pool_id, p_image_id, p_snap_id); @@ -1000,8 +1001,9 @@ int remove_child(cls_method_context_t hctx, bufferlist *in, bufferlist *out) if (r < 0) return r; - CLS_LOG(20, "remove_child %s from (%d, %s, %d)", c_image_id.c_str(), - p_pool_id, p_image_id.c_str(), p_snap_id.val); + CLS_LOG(20, "remove_child %s from (%"PRIu64", %s, %"PRIu64")", + c_image_id.c_str(), p_pool_id, p_image_id.c_str(), + p_snap_id.val); string key = parent_key(p_pool_id, p_image_id, p_snap_id); @@ -1060,7 +1062,7 @@ int get_children(cls_method_context_t hctx, bufferlist *in, bufferlist *out) if (r < 0) return r; - CLS_LOG(20, "get_children of (%d, %s, %d)", + CLS_LOG(20, "get_children of (%"PRIu64", %s, %"PRIu64")", p_pool_id, p_image_id.c_str(), p_snap_id.val); string key = parent_key(p_pool_id, p_image_id, p_snap_id); diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 577d6637b31cd..ae9e19b84bcff 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include "include/types.h" #include "include/utime.h" @@ -538,7 +539,7 @@ int rgw_dir_suggest_changes(cls_method_context_t hctx, bufferlist *in, bufferlis if (cur_disk.pending_map.empty()) { if (cur_disk.exists) { struct rgw_bucket_category_stats& old_stats = header.stats[cur_disk.meta.category]; - CLS_LOG(10, "total_entries: %d -> %d\n", old_stats.num_entries, old_stats.num_entries - 1); + CLS_LOG(10, "total_entries: %"PRId64" -> %"PRId64"\n", old_stats.num_entries, old_stats.num_entries - 1); old_stats.num_entries--; old_stats.total_size -= cur_disk.meta.size; old_stats.total_size_rounded -= get_rounded_size(cur_disk.meta.size); @@ -554,7 +555,7 @@ int rgw_dir_suggest_changes(cls_method_context_t hctx, bufferlist *in, bufferlis return ret; break; case CEPH_RGW_UPDATE: - CLS_LOG(10, "CEPH_RGW_UPDATE name=%s total_entries: %d -> %d\n", cur_change.name.c_str(), stats.num_entries, stats.num_entries + 1); + CLS_LOG(10, "CEPH_RGW_UPDATE name=%s total_entries: %"PRId64" -> %"PRId64"\n", cur_change.name.c_str(), stats.num_entries, stats.num_entries + 1); stats.num_entries++; stats.total_size += cur_change.meta.size; stats.total_size_rounded += get_rounded_size(cur_change.meta.size); -- 2.39.5