if (fd < 0) {
return;
}
- char partition[PATH_MAX], devname[PATH_MAX];
- int r = get_device_by_fd(fd, partition, devname, sizeof(devname));
- if (r < 0) {
- dout(1) << "unable to get device name for " << get_basedir_path() << ": "
- << cpp_strerror(r) << dendl;
- m_rotational = true;
- } else {
- m_rotational = block_device_is_rotational(devname);
- dout(20) << __func__ << " devname " << devname
- << " rotational " << (int)m_rotational << dendl;
- }
+ BlkDev blkdev(fd);
+ m_rotational = blkdev.is_rotational();
+ dout(20) << __func__ << " basedir " << fn
+ << " rotational " << (int)m_rotational << dendl;
::close(fd);
}
// journal rotational?
if (fd < 0) {
return;
}
- char partition[PATH_MAX], devname[PATH_MAX];
- int r = get_device_by_fd(fd, partition, devname, sizeof(devname));
- if (r < 0) {
- dout(1) << "unable to get journal device name for "
- << get_journal_path() << ": " << cpp_strerror(r) << dendl;
- m_journal_rotational = true;
- } else {
- m_journal_rotational = block_device_is_rotational(devname);
- dout(20) << __func__ << " journal devname " << devname
- << " journal rotational " << (int)m_journal_rotational << dendl;
- }
+ BlkDev blkdev(fd);
+ m_journal_rotational = blkdev.is_rotational();
+ dout(20) << __func__ << " journal filename " << fn.c_str()
+ << " journal rotational " << (int)m_journal_rotational << dendl;
::close(fd);
}
}
fiemap->fm_length = len + start % CEPH_PAGE_SIZE;
fiemap->fm_flags = FIEMAP_FLAG_SYNC; /* flush extents to disk if needed */
-#if defined(DARWIN) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
ret = -ENOTSUP;
goto done_err;
#else
fiemap->fm_extent_count = fiemap->fm_mapped_extents;
fiemap->fm_mapped_extents = 0;
-#if defined(DARWIN) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
ret = -ENOTSUP;
goto done_err;
#else
}
bufferlist bl;
bl.append(std::move(bp));
- bufferlist::iterator p = bl.begin();
+ auto p = bl.cbegin();
try {
- ::decode(*cm, p);
+ decode(*cm, p);
}
catch (buffer::error &e) {
r = -EIO;
int GenericFileStoreBackend::_crc_save(int fd, SloppyCRCMap *cm)
{
bufferlist bl;
- ::encode(*cm, bl);
+ encode(*cm, bl);
int r = chain_fsetxattr(fd, SLOPPY_CRC_XATTR, bl.c_str(), bl.length());
if (r < 0)
derr << __func__ << " got " << cpp_strerror(r) << dendl;