All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: ceph-devel@vger.kernel.org
Subject: memcpy() avoidance using decode(bufferlist)
Date: Fri, 22 Apr 2016 15:53:55 +0200	[thread overview]
Message-ID: <20160422155355.06c5ef4c@echidna.suse.de> (raw)

Hi,

A question regarding bufferlist usage:

I'm working on the cmpext librados C API, and want to decode the OSD
response directly into a (char *buf/size_t len) buffer provided by the
caller.

I figured this would be straightforward via:
  bl.push_back(buffer::create_static(buf, len));
  ...
  ::decode_nohead(iter.get_remaining(), bl, iter);

However, the decoded data doesn't make it into buf, unless an extra copy
occurs via:
  bl.copy(0, bl.length(), buf);

Any suggestions on a clean way to avoid the extra copy here?

Cheers, David

             reply	other threads:[~2016-04-22 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 13:53 David Disseldorp [this message]
2016-04-22 18:05 ` memcpy() avoidance using decode(bufferlist) Casey Bodley
2016-04-24 22:56   ` David Disseldorp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160422155355.06c5ef4c@echidna.suse.de \
    --to=ddiss@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.