summaryrefslogtreecommitdiffstats
path: root/src/common/buffer.cc
diff options
context:
space:
mode:
authorRadoslaw Zarzynski <rzarzyns@redhat.com>2020-07-22 20:57:51 +0200
committerRadoslaw Zarzynski <rzarzyns@redhat.com>2020-07-24 15:23:00 +0200
commit053e6fa97c70b47912bc9ab9b37de16018da8410 (patch)
tree89cc66be0720cddce313c4378854b1742dec57e7 /src/common/buffer.cc
parentMerge pull request #36238 from yuvalif/fix_zippet_notif_merge (diff)
downloadceph-053e6fa97c70b47912bc9ab9b37de16018da8410.tar.xz
ceph-053e6fa97c70b47912bc9ab9b37de16018da8410.zip
common/bl: don't access raw::data directly. Use the getter instead.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Diffstat (limited to 'src/common/buffer.cc')
-rw-r--r--src/common/buffer.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/buffer.cc b/src/common/buffer.cc
index 6ac87306c93..7e07667b3f6 100644
--- a/src/common/buffer.cc
+++ b/src/common/buffer.cc
@@ -279,7 +279,7 @@ static ceph::spinlock debug_lock;
ceph::unique_leakable_ptr<buffer::raw> buffer::copy(const char *c, unsigned len) {
auto r = buffer::create_aligned(len, sizeof(size_t));
- memcpy(r->data, c, len);
+ memcpy(r->get_data(), c, len);
return r;
}
@@ -288,7 +288,7 @@ static ceph::spinlock debug_lock;
}
ceph::unique_leakable_ptr<buffer::raw> buffer::create(unsigned len, char c) {
auto ret = buffer::create_aligned(len, sizeof(size_t));
- memset(ret->data, c, len);
+ memset(ret->get_data(), c, len);
return ret;
}
ceph::unique_leakable_ptr<buffer::raw>
@@ -539,7 +539,7 @@ static ceph::spinlock debug_lock;
return _raw->get_data()[_off + n];
}
- const char *buffer::ptr::raw_c_str() const { ceph_assert(_raw); return _raw->data; }
+ 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; }
int buffer::ptr::raw_nref() const { ceph_assert(_raw); return _raw->nref; }
@@ -547,7 +547,7 @@ static ceph::spinlock debug_lock;
ceph_assert(_raw);
if (o+l > _len)
throw end_of_buffer();
- char* src = _raw->data + _off + o;
+ char* src = _raw->get_data() + _off + o;
maybe_inline_memcpy(dest, src, l, 8);
}
@@ -580,7 +580,7 @@ static ceph::spinlock debug_lock;
{
ceph_assert(_raw);
ceph_assert(1 <= unused_tail_length());
- char* ptr = _raw->data + _off + _len;
+ char* ptr = _raw->get_data() + _off + _len;
*ptr = c;
_len++;
return _len + _off;
@@ -590,7 +590,7 @@ static ceph::spinlock debug_lock;
{
ceph_assert(_raw);
ceph_assert(l <= unused_tail_length());
- char* c = _raw->data + _off + _len;
+ char* c = _raw->get_data() + _off + _len;
maybe_inline_memcpy(c, p, l, 32);
_len += l;
return _len + _off;
@@ -600,7 +600,7 @@ static ceph::spinlock debug_lock;
{
ceph_assert(_raw);
ceph_assert(l <= unused_tail_length());
- char* c = _raw->data + _off + _len;
+ char* c = _raw->get_data() + _off + _len;
// FIPS zeroization audit 20191115: this memset is not security related.
memset(c, 0, l);
_len += l;
@@ -612,7 +612,7 @@ static ceph::spinlock debug_lock;
ceph_assert(_raw);
ceph_assert(o <= _len);
ceph_assert(o+l <= _len);
- char* dest = _raw->data + _off + o;
+ char* dest = _raw->get_data() + _off + o;
if (crc_reset)
_raw->invalidate_crc();
maybe_inline_memcpy(dest, src, l, 64);
@@ -2179,7 +2179,7 @@ buffer::ptr_node* buffer::ptr_node::cloner::operator()(
}
std::ostream& buffer::operator<<(std::ostream& out, const buffer::raw &r) {
- return out << "buffer::raw(" << (void*)r.data << " len " << r.len << " nref " << r.nref.load() << ")";
+ return out << "buffer::raw(" << (void*)r.get_data() << " len " << r.len << " nref " << r.nref.load() << ")";
}
std::ostream& buffer::operator<<(std::ostream& out, const buffer::ptr& bp) {