Re: Reading payload from rados_watchcb2_t callback

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

 



Hi Nick,

a good read to see what’s in it.

http://dachary.org/?p=1904

JC

> On Aug 18, 2016, at 08:28, Nick Fisk <nick@xxxxxxxxxx> wrote:
> 
> Just to answer myself in case anyone stumbles across this in the future. I was on the right track, but I think there are null
> characters before the text payload which was tricking printf.
> 
> In the end I managed to work it out and came up with this:
> 
> char *temp = (char*)data+4;
> 
> Which skips the 1st few bytes of the payload.....no idea what they are, but skipping 4 bytes takes you straight to the start of the
> text part that you send with notify.
> 
>> -----Original Message-----
>> From: ceph-users [mailto:ceph-users-bounces@xxxxxxxxxxxxxx] On Behalf Of Nick Fisk
>> Sent: 17 August 2016 21:49
>> To: 'ceph-users' <ceph-users@xxxxxxxxxxxxxx>
>> Subject:  Reading payload from rados_watchcb2_t callback
>> 
>> Hi All,
>> 
>> I'm writing a small piece of code to call fsfreeze/unfreeze that can be invoked by a RADOS notify. I have the basic watch/notify
>> functionality working but I need to be able to determine if the notify message is to freeze or unfreeze, or maybe something
>> completely unrelated.
>> 
>> I'm looking at the rados_watchcb2_t callback and can see that the data payload is returned as a void pointer. This is where it all
> starts
>> to go a little pear shaped for my basic C skills. I think I have to cast the pointer to a (char *) but I still can't seem to get
> anything useful
>> from it.
>> 
>> I've been following some of the tests in the Ceph source and they seem to use some sort of typedef called a bufferlist, is this
> what I
>> need to try and look into?
>> 
>> Does anyone have any pointers (excuse the pun) as to how I would read the text part of the payload from it?
>> 
>> void watch_notify2_cb(void *arg, uint64_t notify_id, uint64_t cookie, uint64_t notifier_gid, void *data, size_t data_len)
>> 
>> Many Thanks,
>> Nick
>> 
>> _______________________________________________
>> ceph-users mailing list
>> ceph-users@xxxxxxxxxxxxxx
>> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
> 
> _______________________________________________
> ceph-users mailing list
> ceph-users@xxxxxxxxxxxxxx
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux