report_error(cb, -ceph_fd);
return;
}
- HT_INFOF("open (%s) fd=%d ceph_fd=%d", fname, fd, ceph_fd);
+ HT_INFOF("open (%s) fd=%" PRIu32 " ceph_fd=%d", fname, fd, ceph_fd);
{
struct sockaddr_in addr;
void CephBroker::close(ResponseCallback *cb, uint32_t fd) {
if (m_verbose) {
- HT_INFOF("close fd=%d", fd);
+ HT_INFOF("close fd=%" PRIu32, fd);
}
OpenFileDataCephPtr fdata;
m_open_file_map.get(fd, fdata);
uint64_t offset;
StaticBuffer buf(new uint8_t [amount], amount);
- HT_DEBUGF("read fd=%d amount = %d", fd, amount);
+ HT_DEBUGF("read fd=%" PRIu32 " amount = %d", fd, amount);
if (!m_open_file_map.get(fd, fdata)) {
char errbuf[32];
- sprintf(errbuf, "%d", fd);
+ sprintf(errbuf, "%" PRIu32, fd);
cb->error(Error::DFSBROKER_BAD_FILE_HANDLE, errbuf);
- HT_ERRORF("bad file handle: %d", fd);
+ HT_ERRORF("bad file handle: %" PRIu32, fd);
return;
}
if ((offset = ceph_lseek(cmount, fdata->fd, 0, SEEK_CUR)) < 0) {
std::string errs(cpp_strerror((int)-offset));
- HT_ERRORF("lseek failed: fd=%d ceph_fd=%d offset=0 SEEK_CUR - %s",
+ HT_ERRORF("lseek failed: fd=%" PRIu32 " ceph_fd=%d offset=0 SEEK_CUR - %s",
fd, fdata->fd, errs.c_str());
report_error(cb, offset);
return;
}
if ((nread = ceph_read(cmount, fdata->fd, (char *)buf.base, amount, 0)) < 0 ) {
- HT_ERRORF("read failed: fd=%d ceph_fd=%d amount=%d", fd, fdata->fd, amount);
+ HT_ERRORF("read failed: fd=%" PRIu32 " ceph_fd=%d amount=%d", fd, fdata->fd, amount);
report_error(cb, -nread);
return;
}
if (!m_open_file_map.get(fd, fdata)) {
char errbuf[32];
- sprintf(errbuf, "%d", fd);
+ sprintf(errbuf, "%" PRIu32, fd);
cb->error(Error::DFSBROKER_BAD_FILE_HANDLE, errbuf);
return;
}
if ((offset = (uint64_t)ceph_lseek(cmount, fdata->fd, 0, SEEK_CUR)) < 0) {
std::string errs(cpp_strerror((int)-offset));
- HT_ERRORF("lseek failed: fd=%d ceph_fd=%d offset=0 SEEK_CUR - %s", fd, fdata->fd,
+ HT_ERRORF("lseek failed: fd=%" PRIu32 " ceph_fd=%d offset=0 SEEK_CUR - %s", fd, fdata->fd,
errs.c_str());
report_error(cb, offset);
return;
if ((nwritten = ceph_write(cmount, fdata->fd, (const char *)data, amount, 0)) < 0) {
std::string errs(cpp_strerror(nwritten));
- HT_ERRORF("write failed: fd=%d ceph_fd=%d amount=%d - %s",
+ HT_ERRORF("write failed: fd=%" PRIu32 " ceph_fd=%d amount=%d - %s",
fd, fdata->fd, amount, errs.c_str());
report_error(cb, -nwritten);
return;
int r;
if (sync && ((r = ceph_fsync(cmount, fdata->fd, true)) != 0)) {
std::string errs(cpp_strerror(errno));
- HT_ERRORF("flush failed: fd=%d ceph_fd=%d - %s", fd, fdata->fd, errs.c_str());
+ HT_ERRORF("flush failed: fd=%" PRIu32 " ceph_fd=%d - %s", fd, fdata->fd, errs.c_str());
report_error(cb, r);
return;
}
void CephBroker::seek(ResponseCallback *cb, uint32_t fd, uint64_t offset) {
OpenFileDataCephPtr fdata;
- HT_DEBUGF("seek fd=%lu offset=%llu", (Lu)fd, (Llu)offset);
+ HT_DEBUGF("seek fd=%" PRIu32 " offset=%llu", fd, (Llu)offset);
if (!m_open_file_map.get(fd, fdata)) {
char errbuf[32];
- sprintf(errbuf, "%d", fd);
+ sprintf(errbuf, "%" PRIu32, fd);
cb->error(Error::DFSBROKER_BAD_FILE_HANDLE, errbuf);
return;
}
loff_t res = ceph_lseek(cmount, fdata->fd, offset, SEEK_SET);
if (res < 0) {
std::string errs(cpp_strerror((int)res));
- HT_ERRORF("lseek failed: fd=%d ceph_fd=%d offset=%llu - %s",
+ HT_ERRORF("lseek failed: fd=%" PRIu32 " ceph_fd=%d offset=%llu - %s",
fd, fdata->fd, (Llu)offset, errs.c_str());
report_error(cb, offset);
return;
ssize_t nread;
StaticBuffer buf(new uint8_t [amount], amount);
- HT_DEBUGF("pread fd=%d offset=%llu amount=%d", fd, (Llu)offset, amount);
+ HT_DEBUGF("pread fd=%" PRIu32 " offset=%llu amount=%d", fd, (Llu)offset, amount);
if (!m_open_file_map.get(fd, fdata)) {
char errbuf[32];
- sprintf(errbuf, "%d", fd);
+ sprintf(errbuf, "%" PRIu32, fd);
cb->error(Error::DFSBROKER_BAD_FILE_HANDLE, errbuf);
return;
}
if ((nread = ceph_read(cmount, fdata->fd, (char *)buf.base, amount, offset)) < 0) {
std::string errs(cpp_strerror(nread));
- HT_ERRORF("pread failed: fd=%d ceph_fd=%d amount=%d offset=%llu - %s", fd, fdata->fd,
- amount, (Llu)offset, errs.c_str());
+ HT_ERRORF("pread failed: fd=%" PRIu32 " ceph_fd=%d amount=%d offset=%llu - %s",
+ fd, fdata->fd, amount, (Llu)offset, errs.c_str());
report_error(cb, nread);
return;
}
void CephBroker::flush(ResponseCallback *cb, uint32_t fd) {
OpenFileDataCephPtr fdata;
- HT_DEBUGF("flush fd=%d", fd);
+ HT_DEBUGF("flush fd=%" PRIu32, fd);
if (!m_open_file_map.get(fd, fdata)) {
char errbuf[32];
- sprintf(errbuf, "%d", fd);
+ sprintf(errbuf, "%" PRIu32, fd);
cb->error(Error::DFSBROKER_BAD_FILE_HANDLE, errbuf);
return;
}
int r;
if ((r = ceph_fsync(cmount, fdata->fd, true)) != 0) {
std::string errs(cpp_strerror(r));
- HT_ERRORF("flush failed: fd=%d ceph_fd=%d - %s", fd, fdata->fd, errs.c_str());
+ HT_ERRORF("flush failed: fd=%" PRIu32 " ceph_fd=%d - %s", fd, fdata->fd, errs.c_str());
report_error(cb, -r);
return;
}