buffer::ptr::ptr(ceph::unique_leakable_ptr<raw> r)
: _raw(r.release()),
_off(0),
- _len(_raw->len)
+ _len(_raw->get_len())
{
_raw->nref.store(1, std::memory_order_release);
bdout << "ptr " << this << " get " << _raw << bendl;
(1 == cached_raw->nref.load(std::memory_order_acquire));
if (likely(last_one) || --cached_raw->nref == 0) {
bdout << "deleting raw " << static_cast<void*>(cached_raw)
- << " len " << cached_raw->len << bendl;
+ << " len " << cached_raw->get_len() << bendl;
ANNOTATE_HAPPENS_AFTER(&cached_raw->nref);
ANNOTATE_HAPPENS_BEFORE_FORGET_ALL(&cached_raw->nref);
delete cached_raw; // dealloc old (if any)
unsigned buffer::ptr::unused_tail_length() const
{
- if (_raw)
- return _raw->len - (_off+_len);
- else
- return 0;
+ return _raw ? _raw->get_len() - (_off + _len) : 0;
}
const char& buffer::ptr::operator[](unsigned n) const
{
}
const char *buffer::ptr::raw_c_str() const { ceph_assert(_raw); return _raw->get_data(); }
- unsigned buffer::ptr::raw_length() const { ceph_assert(_raw); return _raw->len; }
+ unsigned buffer::ptr::raw_length() const { ceph_assert(_raw); return _raw->get_len(); }
int buffer::ptr::raw_nref() const { ceph_assert(_raw); return _raw->nref; }
void buffer::ptr::copy_out(unsigned o, unsigned l, char *dest) const {
unsigned buffer::ptr::wasted() const
{
- return _raw->len - _len;
+ return _raw->get_len() - _len;
}
int buffer::ptr::cmp(const ptr& o) const
if (r == last)
continue;
last = r;
- total += r->len;
+ total += r->get_len();
}
// If multiple buffers are sharing the same raw buffer and they overlap
// with each other, the wasted space will be underestimated.
}
std::ostream& buffer::operator<<(std::ostream& out, const buffer::raw &r) {
- return out << "buffer::raw(" << (void*)r.get_data() << " len " << r.len << " nref " << r.nref.load() << ")";
+ return out << "buffer::raw("
+ << (void*)r.get_data() << " len " << r.get_len()
+ << " nref " << r.nref.load() << ")";
}
std::ostream& buffer::operator<<(std::ostream& out, const buffer::ptr& bp) {