- ssize_t (*read)(void *user_data, void *buffer, size_t length);
- uint32_t (*write)(void *udata, void *buffer, uint32_t length);
- uint32_t (*seek)(void *user_data, uint64_t position);
- uint32_t (*truncate)(void *user_data);
- void *user_data;
+ /** This pointer is propagated to each call of all methods. */
+ void *user_data;
+ /**
+ * This should return the number of bytes read on success. Short reads
+ * are OK: the function may return less than length.
+ */
+ ssize_t (*read)(void *user_data, void *buffer, size_t length);
+ /**
+ * This method is assumed to succeed. The implementation should simply
+ * abort on errors. Note that offsets beyond EOF must not be regarded
+ * as invalid arguments.
+ */
+ off_t (*seek)(void *user_data, off_t offset, int whence);
+ /**
+ * Like the write() system call, this should return the number of bytes
+ * written. Short writes are OK: the function may return less than
+ * count.
+ */
+ ssize_t (*write)(void *user_data, void *buffer, size_t count);
+ /**
+ * Unlike the truncate system call, this function does not receive an
+ * offset. The method is expected to truncate the file to the offset
+ * given by the current file position instead.
+ */
+ int (*truncate)(void *user_data);