Re: Transforming a bufferlist iterator into new bufferlist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 27 Aug 2012, Noah Watkins wrote:
> I have a bufferlist use case that I can't quite resolve. I'm packing
> up a struct and a blob, but not sure how to seek to the beginning of
> the blob correctly during decode:
> 
> 1. Setup bufferlist
> 
>   /* add header */
>   struct header hdr;
>   ::encode(hdr, bl);
> 
>   /* add payload blob */
>   bl.append(buf, len);

Instead, do 

bufferlist b;
b.append(buf, len);
::encode(b, bl);

that'll include a length in front of it...

 
> 2. Later in decode ...
> 
>   /* get header */
>   bufferlist::iterator it = in.begin();
>   ::decode(hdr, it);
> 
>   **problem: Want to get a bufferlist for the payload, which is
> presumably exactly where the iterator now points. How should that
> transformation happen with zero-copy?

and then

bufferlist b;
::decode(b, it);

will get it back.

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux