]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_filestore_dump: Add utility function get_fd_data()
authorDavid Zafman <david.zafman@inktank.com>
Sat, 7 Jun 2014 00:05:53 +0000 (17:05 -0700)
committerDavid Zafman <dzafman@redhat.com>
Thu, 28 Aug 2014 23:21:28 +0000 (16:21 -0700)
Signed-off-by: David Zafman <david.zafman@inktank.com>
src/tools/ceph_filestore_dump.cc

index dc94ec72bba661fef93a6c367f29171b7903b431..672e2aa3c2dc7f82b2ae6219d406d0598a7d1454 100644 (file)
@@ -388,6 +388,26 @@ int write_simple(sectiontype_t type, int fd)
   return hbl.write_fd(fd);
 }
 
+static int get_fd_data(int fd, bufferlist &bl)
+{
+  uint64_t total = 0;
+  do {
+    ssize_t bytes = bl.read_fd(fd, max_read);
+    if (bytes < 0) {
+      cerr << "read_fd error " << cpp_strerror(-bytes) << std::endl;
+      return 1;
+    }
+
+    if (bytes == 0)
+      break;
+
+    total += bytes;
+  } while(true);
+
+  assert(bl.length() == total);
+  return 0;
+}
+
 static void invalid_path(string &path)
 {
   cerr << "Invalid path to osd store specified: " << path << "\n";