return true;
}
+ bool buffer::list::is_provided_buffer(const char *dst) const
+ {
+ if (_buffers.empty())
+ return false;
+ return (is_contiguous() && (_buffers.front().c_str() == dst));
+ }
+
bool buffer::list::is_aligned(unsigned align) const
{
for (std::list<ptr>::const_iterator it = _buffers.begin();
break; // done
}
}
-
+
bool buffer::list::is_contiguous() const
{
return &(*_buffers.begin()) == &(*_buffers.rbegin());
bool contents_equal(const buffer::list& other) const;
bool can_zero_copy() const;
+ bool is_provided_buffer(const char *dst) const;
bool is_aligned(unsigned align) const;
bool is_page_aligned() const;
bool is_n_align_sized(unsigned align) const;
tracepoint(librados, rados_read_exit, -ERANGE, NULL);
return -ERANGE;
}
- if (bl.c_str() != buf)
+ if (!bl.is_provided_buffer(buf))
bl.copy(0, bl.length(), buf);
ret = bl.length(); // hrm :/
}
tracepoint(librados, rados_getxattr_exit, -ERANGE, buf, 0);
return -ERANGE;
}
- if (bl.c_str() != buf)
+ if (!bl.is_provided_buffer(buf))
bl.copy(0, bl.length(), buf);
ret = bl.length();
}
}
if (bytes_read)
*bytes_read = out_bl.length();
- if (out_buf && out_bl.c_str() != out_buf)
+ if (out_buf && !out_bl.is_provided_buffer(out_buf))
out_bl.copy(0, out_bl.length(), out_buf);
}
};