MCPcopy Create free account
hub / github.com/ceph/ceph / get_fd_data

Function get_fd_data

src/tools/crushtool.cc:61–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59const char *infn = "stdin";
60
61static int get_fd_data(int fd, bufferlist &bl)
62{
63
64 uint64_t total = 0;
65 do {
66 ssize_t bytes = bl.read_fd(fd, 1024*1024);
67 if (bytes < 0) {
68 cerr << "read_fd error " << cpp_strerror(-bytes) << "\n";
69 return -1;
70 }
71
72 if (bytes == 0)
73 break;
74
75 total += bytes;
76 } while(true);
77
78 ceph_assert(bl.length() == total);
79 return 0;
80}
81
82////////////////////////////////////////////////////////////////////////////
83

Callers 1

mainFunction · 0.70

Calls 3

cpp_strerrorFunction · 0.85
read_fdMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected