]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
CInode::make_path_string: don't coerce ino
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 4 Nov 2010 21:06:09 +0000 (14:06 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 4 Nov 2010 21:09:32 +0000 (14:09 -0700)
CInode::make_path_string: don't coerce the inode number to 32-bits.
Everyone else is treating it as 64 bits; this function should too.

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/mds/CInode.cc

index 2724249b3561404f77831b7bca373fe1cd2fe7bc..58101d65b4ab6191ae581ca6f108ca191b3b21da 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 
+#define __STDC_FORMAT_MACROS
 
 #include "CInode.h"
 #include "CDir.h"
@@ -36,6 +37,7 @@
 #include "messages/MLock.h"
 #include "messages/MClientCaps.h"
 
+#include <inttypes.h>
 #include <string>
 #include <stdio.h>
 
@@ -655,13 +657,16 @@ void CInode::make_path_string(string& s, bool force, CDentry *use_parent)
     s = "";  // root
   } 
   else if (is_mdsdir()) {
-    char t[30];
-    sprintf(t, "~mds%d", (int)ino() - MDS_INO_MDSDIR_OFFSET);
+    char t[40];
+    uint64_t eino(ino());
+    eino -= MDS_INO_MDSDIR_OFFSET;
+    snprintf(t, sizeof(t), "~mds%" PRId64, eino);
     s = t;
   }
   else {
-    char n[20];
-    snprintf(n, sizeof(n), "#%llx", (unsigned long long)(ino()));
+    char n[40];
+    uint64_t eino(ino());
+    snprintf(n, sizeof(n), "#%" PRIx64, eino);
     s += n;
   }
 }