diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/data_writer.h | 4 | ||||
-rw-r--r-- | include/sqfs/io.h | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/include/data_writer.h b/include/data_writer.h index 5987cd6..c9e6f20 100644 --- a/include/data_writer.h +++ b/include/data_writer.h @@ -84,8 +84,8 @@ int data_writer_sync(data_writer_t *data); Returns 0 on success, prints errors to stderr. */ -int write_data_from_fd(data_writer_t *data, file_info_t *fi, int infd, - int flags); +int write_data_from_file(data_writer_t *data, file_info_t *fi, + sqfs_file_t *file, int flags); /* Does the same as write_data_from_fd but the input file is the condensed 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 |