I'm trying to use cl_fmap_open_handle and the callback, however I'm finding
the comments on this somewhat confusing and need clarifying:

 

/**

* @brief Read callback function type.

*

* A callback function pointer type for reading data from a cl_fmap_t that
uses

* reads data from a handle interface.

*

* Read 'count' bytes starting at 'offset' into the buffer 'buf'

*

* Thread safety: It is guaranteed that only one callback is executing for a

* specific handle at any time, but there might be multiple callbacks
executing

* for different handle at the same time.

*

* @param handle    The handle passed to cl_fmap_open_handle, its meaning is
up

*                  to the callback's implementation

* @param buf       A buffer to read data into, must be at least offset +
count

*                  bytes in size.

* @param count     The number of bytes to read.

* @param offset    The the offset into buf to read the data to. If
successful,

*                  the number of bytes actually read is returned. Upon
reading

*                  end-of-file, zero is returned. Otherwise, a -1 is
returned

*                  and the global variable errno is set to indicate the
error.

*/

typedef off_t (*clcb_pread)(void *handle, void *buf, size_t count, off_t
offset);

 

 

First it says - Read 'count' bytes starting at 'offset' into the buffer
'buf'

 

Then it says - @param offset    The the offset into buf to read the data to.

 

So which is it, is offset the offset within the file or the buffer?

 

 

*       Lloyd

_______________________________________________

clamav-devel mailing list
clamav-devel@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-devel

Please submit your patches to our Github: 
https://github.com/Cisco-Talos/clamav-devel/pulls

Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml

Reply via email to