aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-12 20:14:44 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 13:38:25 +0200
commite811851deba9c45f3d9b3c5b4ad5eaa7945382d5 (patch)
tree4a5084324ab2a76d3c205f34bb0871de58ac192a /include
parent2694532a5479d157903b6c600d9b1d5c145a4e4c (diff)
Mass rename istream_t/ostream_t with sqfs_ prefix
istream_t becomes sqfs_istream_t and ostream_t becomes sqfs_ostream_t Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/common.h10
-rw-r--r--include/io/dir_iterator.h4
-rw-r--r--include/io/file.h20
-rw-r--r--include/io/istream.h35
-rw-r--r--include/io/mem.h5
-rw-r--r--include/io/ostream.h14
-rw-r--r--include/io/std.h8
-rw-r--r--include/io/xfrm.h12
-rw-r--r--include/tar/tar.h11
9 files changed, 64 insertions, 55 deletions
diff --git a/include/common.h b/include/common.h
index 30c30fe..c289458 100644
--- a/include/common.h
+++ b/include/common.h
@@ -36,7 +36,7 @@ typedef struct sqfs_hard_link_t {
int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
const sqfs_inode_generic_t *inode,
- ostream_t *fp, size_t block_size);
+ sqfs_ostream_t *fp, size_t block_size);
int write_data_from_file(const char *filename, sqfs_block_processor_t *data,
sqfs_inode_generic_t **inode,
@@ -64,10 +64,10 @@ int parse_size(const char *what, size_t *out, const char *str,
void print_size(sqfs_u64 size, char *buffer, bool round_to_int);
-ostream_t *data_writer_ostream_create(const char *filename,
- sqfs_block_processor_t *proc,
- sqfs_inode_generic_t **inode,
- int flags);
+sqfs_ostream_t *data_writer_ostream_create(const char *filename,
+ sqfs_block_processor_t *proc,
+ sqfs_inode_generic_t **inode,
+ int flags);
/*
Parse a comma separated list (e.g. "uid=...,gid=..." of defaults for
diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h
index cc64680..152eb93 100644
--- a/include/io/dir_iterator.h
+++ b/include/io/dir_iterator.h
@@ -73,11 +73,11 @@ typedef struct dir_iterator_t {
* to read from it.
*
* @param it A pointer to the iterator itself.
- * @param out Returns a pointer to a @ref istream_t on success.
+ * @param out Returns a pointer to a @ref sqfs_istream_t on success.
*
* @return Zero on success, negative @ref SQFS_ERROR value on failure.
*/
- int (*open_file_ro)(struct dir_iterator_t *it, istream_t **out);
+ int (*open_file_ro)(struct dir_iterator_t *it, sqfs_istream_t **out);
/**
* @brief Read extended attributes associated with the current entry
diff --git a/include/io/file.h b/include/io/file.h
index d4f6fc1..1072b6a 100644
--- a/include/io/file.h
+++ b/include/io/file.h
@@ -25,7 +25,7 @@ extern "C" {
/**
* @brief Create an input stream for an OS native file handle.
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* The functions takes up ownership of the file handle and takes care
* of cleaning it up. On failure, the handle remains usable, and ownership
@@ -36,12 +36,13 @@ extern "C" {
*
* @return A pointer to an output stream on success, NULL on failure.
*/
-SQFS_INTERNAL istream_t *istream_open_handle(const char *path, os_file_t fd);
+SQFS_INTERNAL
+sqfs_istream_t *istream_open_handle(const char *path, os_file_t fd);
/**
* @brief Create an output stream that writes to an OS native file handle.
*
- * @memberof ostream_t
+ * @memberof sqfs_ostream_t
*
* If the flag SQFS_FILE_OPEN_NO_SPARSE is set, the underlying implementation
* always writes chunks of zero bytes when passing a NULL pointer to append.
@@ -54,24 +55,25 @@ SQFS_INTERNAL istream_t *istream_open_handle(const char *path, os_file_t fd);
*
* @return A pointer to an output stream on success, NULL on failure.
*/
-SQFS_INTERNAL ostream_t *ostream_open_handle(const char *path, os_file_t hnd,
- int flags);
+SQFS_INTERNAL sqfs_ostream_t *ostream_open_handle(const char *path,
+ os_file_t hnd,
+ int flags);
/**
* @brief Create an input stream that reads from a file.
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* @param path A path to the file to open or create.
*
* @return A pointer to an output stream on success, NULL on failure.
*/
-SQFS_INTERNAL istream_t *istream_open_file(const char *path);
+SQFS_INTERNAL sqfs_istream_t *istream_open_file(const char *path);
/**
* @brief Create an output stream that writes to a file.
*
- * @memberof ostream_t
+ * @memberof sqfs_ostream_t
*
* If the file does not yet exist, it is created. If it does exist this
* function fails, unless the flag SQFS_FILE_OPEN_OVERWRITE is set, in which
@@ -87,7 +89,7 @@ SQFS_INTERNAL istream_t *istream_open_file(const char *path);
*
* @return A pointer to an output stream on success, NULL on failure.
*/
-SQFS_INTERNAL ostream_t *ostream_open_file(const char *path, int flags);
+SQFS_INTERNAL sqfs_ostream_t *ostream_open_file(const char *path, int flags);
#ifdef __cplusplus
}
diff --git a/include/io/istream.h b/include/io/istream.h
index 90d6e0d..f4ffcb2 100644
--- a/include/io/istream.h
+++ b/include/io/istream.h
@@ -10,14 +10,16 @@
#include "sqfs/predef.h"
#include "io/ostream.h"
+typedef struct sqfs_istream_t sqfs_istream_t;
+
/**
- * @struct istream_t
+ * @interface sqfs_istream_t
*
* @extends sqfs_object_t
*
* @brief A sequential, read-only data stream.
*/
-typedef struct istream_t {
+struct sqfs_istream_t {
sqfs_object_t base;
/**
@@ -32,7 +34,7 @@ typedef struct istream_t {
* Higher level functions like @ref istream_read (providing a
* Unix read() style API) are built on top of this primitive.
*
- * @param strm A pointer to an istream_t implementation.
+ * @param strm A pointer to an sqfs_istream_t implementation.
* @param out Returns a pointer into an internal buffer on success.
* @param size Returns the number of bytes available in the buffer.
* @param want A number of bytes that the reader would like to have.
@@ -42,7 +44,7 @@ typedef struct istream_t {
* @return Zero on success, a negative error code on failure,
* a postive number on EOF.
*/
- int (*get_buffered_data)(struct istream_t *strm, const sqfs_u8 **out,
+ int (*get_buffered_data)(sqfs_istream_t *strm, const sqfs_u8 **out,
size_t *size, size_t want);
/**
@@ -52,10 +54,10 @@ typedef struct istream_t {
* forcing get_buffered_data to return data afterwards and potentially
* try to load more data.
*
- * @param strm A pointer to an istream_t implementation.
+ * @param strm A pointer to an sqfs_istream_t implementation.
* @param count The number of bytes used up.
*/
- void (*advance_buffer)(struct istream_t *strm, size_t count);
+ void (*advance_buffer)(sqfs_istream_t *strm, size_t count);
/**
* @brief Get the underlying filename of an input stream.
@@ -64,8 +66,8 @@ typedef struct istream_t {
*
* @return A string holding the underlying filename.
*/
- const char *(*get_filename)(struct istream_t *strm);
-} istream_t;
+ const char *(*get_filename)(sqfs_istream_t *strm);
+};
enum {
ISTREAM_LINE_LTRIM = 0x01,
@@ -80,7 +82,7 @@ extern "C" {
/**
* @brief Read a line of text from an input stream
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* The line returned is allocated using malloc and must subsequently be
* freed when it is no longer needed. The line itself is always null-terminated
@@ -103,13 +105,13 @@ extern "C" {
* @return Zero on success, a negative value on error, a positive value if
* end-of-file was reached without reading any data.
*/
-SQFS_INTERNAL int istream_get_line(istream_t *strm, char **out,
+SQFS_INTERNAL int istream_get_line(sqfs_istream_t *strm, char **out,
size_t *line_num, int flags);
/**
* @brief Read data from an input stream
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* @param strm A pointer to an input stream.
* @param data A buffer to read into.
@@ -118,24 +120,25 @@ SQFS_INTERNAL int istream_get_line(istream_t *strm, char **out,
* @return The number of bytes actually read on success, -1 on failure,
* 0 on end-of-file.
*/
-SQFS_INTERNAL sqfs_s32 istream_read(istream_t *strm, void *data, size_t size);
+SQFS_INTERNAL sqfs_s32 istream_read(sqfs_istream_t *strm,
+ void *data, size_t size);
/**
* @brief Skip over a number of bytes in an input stream.
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* @param strm A pointer to an input stream.
* @param size The number of bytes to seek forward.
*
* @return Zero on success, -1 on failure.
*/
-SQFS_INTERNAL int istream_skip(istream_t *strm, sqfs_u64 size);
+SQFS_INTERNAL int istream_skip(sqfs_istream_t *strm, sqfs_u64 size);
/**
* @brief Dump data from an input stream to an output stream
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* @param in A pointer to an input stream to read from.
* @param out A pointer to an output stream to append to.
@@ -144,7 +147,7 @@ SQFS_INTERNAL int istream_skip(istream_t *strm, sqfs_u64 size);
* @return The number of bytes copied on success, -1 on failure,
* 0 on end-of-file.
*/
-SQFS_INTERNAL sqfs_s32 istream_splice(istream_t *in, ostream_t *out,
+SQFS_INTERNAL sqfs_s32 istream_splice(sqfs_istream_t *in, sqfs_ostream_t *out,
sqfs_u32 size);
#ifdef __cplusplus
diff --git a/include/io/mem.h b/include/io/mem.h
index 1efd007..c848ef0 100644
--- a/include/io/mem.h
+++ b/include/io/mem.h
@@ -13,8 +13,9 @@
extern "C" {
#endif
-SQFS_INTERNAL istream_t *istream_memory_create(const char *name, size_t bufsz,
- const void *data, size_t size);
+SQFS_INTERNAL
+sqfs_istream_t *istream_memory_create(const char *name, size_t bufsz,
+ const void *data, size_t size);
#ifdef __cplusplus
}
diff --git a/include/io/ostream.h b/include/io/ostream.h
index 7a57e48..d1781d2 100644
--- a/include/io/ostream.h
+++ b/include/io/ostream.h
@@ -9,14 +9,16 @@
#include "sqfs/predef.h"
+typedef struct sqfs_ostream_t sqfs_ostream_t;
+
/**
- * @struct ostream_t
+ * @interface sqfs_ostream_t
*
* @extends sqfs_object_t
*
* @brief An append-only data stream.
*/
-typedef struct ostream_t {
+struct sqfs_ostream_t {
sqfs_object_t base;
/**
@@ -29,7 +31,7 @@ typedef struct ostream_t {
*
* @return Zero on success, -1 on failure.
*/
- int (*append)(struct ostream_t *strm, const void *data, size_t size);
+ int (*append)(sqfs_ostream_t *strm, const void *data, size_t size);
/**
* @brief Process all pending, buffered data and flush it to disk.
@@ -43,7 +45,7 @@ typedef struct ostream_t {
*
* @return Zero on success, -1 on failure.
*/
- int (*flush)(struct ostream_t *strm);
+ int (*flush)(sqfs_ostream_t *strm);
/**
* @brief Get the underlying filename of a output stream.
@@ -52,7 +54,7 @@ typedef struct ostream_t {
*
* @return A string holding the underlying filename.
*/
- const char *(*get_filename)(struct ostream_t *strm);
-} ostream_t;
+ const char *(*get_filename)(sqfs_ostream_t *strm);
+};
#endif /* IO_OSTREAM_H */
diff --git a/include/io/std.h b/include/io/std.h
index 805bebd..3a8bbf8 100644
--- a/include/io/std.h
+++ b/include/io/std.h
@@ -17,20 +17,20 @@ extern "C" {
/**
* @brief Create an input stream that reads from standard input.
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* @return A pointer to an input stream on success, NULL on failure.
*/
-SQFS_INTERNAL istream_t *istream_open_stdin(void);
+SQFS_INTERNAL sqfs_istream_t *istream_open_stdin(void);
/**
* @brief Create an output stream that writes to standard output.
*
- * @memberof ostream_t
+ * @memberof sqfs_ostream_t
*
* @return A pointer to an output stream on success, NULL on failure.
*/
-SQFS_INTERNAL ostream_t *ostream_open_stdout(void);
+SQFS_INTERNAL sqfs_ostream_t *ostream_open_stdout(void);
#ifdef __cplusplus
}
diff --git a/include/io/xfrm.h b/include/io/xfrm.h
index 3e601ea..c54bc9f 100644
--- a/include/io/xfrm.h
+++ b/include/io/xfrm.h
@@ -18,7 +18,7 @@ extern "C" {
/**
* @brief Create an input stream that transparently decodes data.
*
- * @memberof istream_t
+ * @memberof sqfs_istream_t
*
* This function creates an input stream that wraps an underlying input stream
* that is encoded/compressed and transparently decodes the data when reading
@@ -29,13 +29,13 @@ extern "C" {
*
* @return A pointer to an input stream on success, NULL on failure.
*/
-SQFS_INTERNAL istream_t *istream_xfrm_create(istream_t *strm,
- xfrm_stream_t *xfrm);
+SQFS_INTERNAL sqfs_istream_t *istream_xfrm_create(sqfs_istream_t *strm,
+ xfrm_stream_t *xfrm);
/**
* @brief Create an output stream that transparently encodes data.
*
- * @memberof ostream_t
+ * @memberof sqfs_ostream_t
*
* This function creates an output stream that transparently encodes
* (e.g. compresses) all data appended to it and writes it to an
@@ -46,8 +46,8 @@ SQFS_INTERNAL istream_t *istream_xfrm_create(istream_t *strm,
*
* @return A pointer to an output stream on success, NULL on failure.
*/
-SQFS_INTERNAL ostream_t *ostream_xfrm_create(ostream_t *strm,
- xfrm_stream_t *xfrm);
+SQFS_INTERNAL sqfs_ostream_t *ostream_xfrm_create(sqfs_ostream_t *strm,
+ xfrm_stream_t *xfrm);
#ifdef __cplusplus
}
diff --git a/include/tar/tar.h b/include/tar/tar.h
index 24ec408..60c2a3d 100644
--- a/include/tar/tar.h
+++ b/include/tar/tar.h
@@ -51,25 +51,26 @@ extern "C" {
The counter is an incremental record counter used if additional
headers need to be generated.
*/
-int write_tar_header(ostream_t *fp, const struct stat *sb, const char *name,
+int write_tar_header(sqfs_ostream_t *fp,
+ const struct stat *sb, const char *name,
const char *slink_target, const sqfs_xattr_t *xattr,
unsigned int counter);
-int write_hard_link(ostream_t *fp, const struct stat *sb, const char *name,
+int write_hard_link(sqfs_ostream_t *fp, const struct stat *sb, const char *name,
const char *target, unsigned int counter);
/* round up to block size and skip the entire entry */
-int read_header(istream_t *fp, tar_header_decoded_t *out);
+int read_header(sqfs_istream_t *fp, tar_header_decoded_t *out);
void clear_header(tar_header_decoded_t *hdr);
-dir_iterator_t *tar_open_stream(istream_t *stream);
+dir_iterator_t *tar_open_stream(sqfs_istream_t *stream);
/*
Write zero bytes to an output file to padd it to the tar record size.
Returns 0 on success. On failure, prints error message to stderr.
*/
-int padd_file(ostream_t *fp, sqfs_u64 size);
+int padd_file(sqfs_ostream_t *fp, sqfs_u64 size);
void free_sparse_list(sparse_map_t *sparse);