diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-15 17:56:07 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-15 17:59:00 +0200 |
commit | 8ee3ee9c71418dbdb73d4350c17056024fb7ec41 (patch) | |
tree | 28416eda2893ed28750c29b41b64d783a1aaa35d /include/sqfs | |
parent | ab2d7fd8bfb1eafc61953e74757e84ed407b1f21 (diff) |
Replace file descriptor IO in data_writer with sqfs_file_t
First, this commit moves the create-blocks-from-fd function over to
libsquashfs and ports it to work on an sqfs_file_t instead.
Second, the function in the data_writer that reads from a file descriptor
is adjusted to use an sqfs_file_t instead.
Finally, the tools that use it have to be adjusted accordingly.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs')
-rw-r--r-- | include/sqfs/io.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/sqfs/io.h b/include/sqfs/io.h index a544875..9784113 100644 --- a/include/sqfs/io.h +++ b/include/sqfs/io.h @@ -150,9 +150,31 @@ SQFS_API sqfs_file_t *sqfs_open_file(const char *filename, int flags); * reading sequentially. * * @param size The alleged "size" of the file. + * + * @return A pointer to a file object on success, NULL on allocation failure. */ SQFS_API sqfs_file_t *sqfs_get_stdin_file(uint64_t size); + +/** + * @brief Read a chunk from a file and turn it into a block that can be + * fed to a block processor. + * + * @member sqfs_file_t + * + * @param file A pointer to a file implementation. + * @param offset A byte offset into the file. + * @param size The number of bytes to read, starting at the given offset. + * @param user A user pointer to set for the block. + * @param flags The flags to store in the newly created block. + * @param out Returns a pointer to a block on success. + * + * @return Zero on success, an @ref E_SQFS_ERROR identifier on failure. + */ +SQFS_API int sqfs_file_create_block(sqfs_file_t *file, uint64_t offset, + size_t size, void *user, uint32_t flags, + sqfs_block_t **out); + #ifdef __cplusplus } #endif |