]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rbd, cls_rgw: use PRI*64 when printing/logging 64-bit values
authorDan Mick <dan.mick@inktank.com>
Wed, 30 Jan 2013 07:05:49 +0000 (23:05 -0800)
committerSage Weil <sage@inktank.com>
Wed, 30 Jan 2013 07:34:03 +0000 (23:34 -0800)
caused segfaults in 32-bit build

Fixes: #3961
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit e253830abac76af03c63239302691f7fac1af381)

src/cls/rbd/cls_rbd.cc
src/cls/rgw/cls_rgw.cc

index 24159b7fa7ebe17e17b29b3fa9d0d22589909246..ad3402e17ba7153be9e03ce5e0ce6bacb48ab338 100644 (file)
@@ -38,6 +38,7 @@
 #include "include/types.h"
 #include "objclass/objclass.h"
 #include "include/rbd_types.h"
+#include <inttypes.h>
 
 #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);
index 577d6637b31cd79fbcdfb0f36394a033d2461220..ae9e19b84bcffcfba86a81aa913225c92b339f67 100644 (file)
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #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);