Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
}
}
- bool buffer::ptr::at_buffer_tail() const { return _off + _len == _raw->len; }
-
int buffer::ptr::get_mempool() const {
if (_raw) {
return _raw->mempool;
}
// misc
- bool at_buffer_head() const { return _off == 0; }
- bool at_buffer_tail() const;
-
bool is_aligned(unsigned align) const {
return ((long)c_str() & (align-1)) == 0;
}
}
}
-TEST(BufferPtr, at_buffer_head) {
- bufferptr ptr(2);
- EXPECT_TRUE(ptr.at_buffer_head());
- ptr.set_offset(1);
- EXPECT_FALSE(ptr.at_buffer_head());
-}
-
-TEST(BufferPtr, at_buffer_tail) {
- bufferptr ptr(2);
- EXPECT_TRUE(ptr.at_buffer_tail());
- ptr.set_length(1);
- EXPECT_FALSE(ptr.at_buffer_tail());
-}
-
TEST(BufferPtr, is_n_page_sized) {
{
bufferptr ptr(CEPH_PAGE_SIZE);