aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/gensquashfs/src/fstree_from_dir.c2
-rw-r--r--bin/gensquashfs/src/glob.c2
-rw-r--r--bin/gensquashfs/src/mkfs.c2
-rw-r--r--bin/gensquashfs/src/mkfs.h2
-rw-r--r--bin/tar2sqfs/src/process_tarball.c14
-rw-r--r--bin/tar2sqfs/src/tar2sqfs.c2
-rw-r--r--bin/tar2sqfs/src/tar2sqfs.h2
-rw-r--r--include/io/dir_iterator.h35
-rw-r--r--include/tar/tar.h3
-rw-r--r--lib/io/src/dir_tree_iterator.c43
-rw-r--r--lib/io/src/unix/dir_iterator.c38
-rw-r--r--lib/io/src/win32/dir_iterator.c34
-rw-r--r--lib/io/test/dir_iterator.c2
-rw-r--r--lib/io/test/dir_tree_iterator.c2
-rw-r--r--lib/io/test/dir_tree_iterator2.c2
-rw-r--r--lib/io/test/dir_tree_iterator3.c2
-rw-r--r--lib/tar/src/iterator.c19
-rw-r--r--lib/tar/test/tar_iterator.c2
-rw-r--r--lib/tar/test/tar_iterator2.c2
-rw-r--r--lib/tar/test/tar_iterator3.c2
20 files changed, 110 insertions, 102 deletions
diff --git a/bin/gensquashfs/src/fstree_from_dir.c b/bin/gensquashfs/src/fstree_from_dir.c
index fe0a022..cbdc270 100644
--- a/bin/gensquashfs/src/fstree_from_dir.c
+++ b/bin/gensquashfs/src/fstree_from_dir.c
@@ -6,7 +6,7 @@
*/
#include "mkfs.h"
-int fstree_from_dir(fstree_t *fs, dir_iterator_t *dir)
+int fstree_from_dir(fstree_t *fs, sqfs_dir_iterator_t *dir)
{
for (;;) {
sqfs_dir_entry_t *ent = NULL;
diff --git a/bin/gensquashfs/src/glob.c b/bin/gensquashfs/src/glob.c
index 3e2eabc..dbe93a2 100644
--- a/bin/gensquashfs/src/glob.c
+++ b/bin/gensquashfs/src/glob.c
@@ -69,7 +69,7 @@ int glob_files(fstree_t *fs, const char *filename, size_t line_num,
split_line_t *sep)
{
bool first_type_flag = true;
- dir_iterator_t *dir = NULL;
+ sqfs_dir_iterator_t *dir = NULL;
char *prefix = NULL;
dir_tree_cfg_t cfg;
tree_node_t *root;
diff --git a/bin/gensquashfs/src/mkfs.c b/bin/gensquashfs/src/mkfs.c
index 39329a6..a178066 100644
--- a/bin/gensquashfs/src/mkfs.c
+++ b/bin/gensquashfs/src/mkfs.c
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
}
if (opt.infile == NULL) {
- dir_iterator_t *dir = NULL;
+ sqfs_dir_iterator_t *dir = NULL;
dir_tree_cfg_t cfg;
int ret;
diff --git a/bin/gensquashfs/src/mkfs.h b/bin/gensquashfs/src/mkfs.h
index 3378c05..5c5f02c 100644
--- a/bin/gensquashfs/src/mkfs.h
+++ b/bin/gensquashfs/src/mkfs.h
@@ -112,7 +112,7 @@ int fstree_from_file_stream(fstree_t *fs, sqfs_istream_t *file,
Returns 0 on success, prints to stderr on failure.
*/
-int fstree_from_dir(fstree_t *fs, dir_iterator_t *dir);
+int fstree_from_dir(fstree_t *fs, sqfs_dir_iterator_t *dir);
int fstree_sort_files(fstree_t *fs, sqfs_istream_t *sortfile);
diff --git a/bin/tar2sqfs/src/process_tarball.c b/bin/tar2sqfs/src/process_tarball.c
index 331936d..3b9365d 100644
--- a/bin/tar2sqfs/src/process_tarball.c
+++ b/bin/tar2sqfs/src/process_tarball.c
@@ -6,7 +6,7 @@
*/
#include "tar2sqfs.h"
-static int write_file(sqfs_writer_t *sqfs, dir_iterator_t *it,
+static int write_file(sqfs_writer_t *sqfs, sqfs_dir_iterator_t *it,
const sqfs_dir_entry_t *ent, tree_node_t *n)
{
int flags = 0, ret = 0;
@@ -40,7 +40,7 @@ static int write_file(sqfs_writer_t *sqfs, dir_iterator_t *it,
}
static int copy_xattr(sqfs_writer_t *sqfs, const char *filename,
- tree_node_t *node, dir_iterator_t *it)
+ tree_node_t *node, sqfs_dir_iterator_t *it)
{
sqfs_xattr_t *xattr, *list;
int ret;
@@ -91,8 +91,10 @@ fail:
return -1;
}
-static int create_node_and_repack_data(sqfs_writer_t *sqfs, dir_iterator_t *it,
- const sqfs_dir_entry_t *ent, const char *link)
+static int create_node_and_repack_data(sqfs_writer_t *sqfs,
+ sqfs_dir_iterator_t *it,
+ const sqfs_dir_entry_t *ent,
+ const char *link)
{
tree_node_t *node;
@@ -127,7 +129,7 @@ fail_errno:
return -1;
}
-static int set_root_attribs(sqfs_writer_t *sqfs, dir_iterator_t *it,
+static int set_root_attribs(sqfs_writer_t *sqfs, sqfs_dir_iterator_t *it,
const sqfs_dir_entry_t *ent)
{
if ((ent->flags & SQFS_DIR_ENTRY_FLAG_HARD_LINK) || !S_ISDIR(ent->mode)) {
@@ -150,7 +152,7 @@ static int set_root_attribs(sqfs_writer_t *sqfs, dir_iterator_t *it,
return 0;
}
-int process_tarball(dir_iterator_t *it, sqfs_writer_t *sqfs)
+int process_tarball(sqfs_dir_iterator_t *it, sqfs_writer_t *sqfs)
{
size_t rootlen = root_becomes == NULL ? 0 : strlen(root_becomes);
diff --git a/bin/tar2sqfs/src/tar2sqfs.c b/bin/tar2sqfs/src/tar2sqfs.c
index ae8b548..acb42e2 100644
--- a/bin/tar2sqfs/src/tar2sqfs.c
+++ b/bin/tar2sqfs/src/tar2sqfs.c
@@ -10,7 +10,7 @@ int main(int argc, char **argv)
{
sqfs_istream_t *input_file = NULL;
tar_iterator_opts topts = { 0 };
- dir_iterator_t *tar = NULL;
+ sqfs_dir_iterator_t *tar = NULL;
int status = EXIT_FAILURE;
sqfs_writer_t sqfs;
int ret;
diff --git a/bin/tar2sqfs/src/tar2sqfs.h b/bin/tar2sqfs/src/tar2sqfs.h
index 5dcfad7..d2049f2 100644
--- a/bin/tar2sqfs/src/tar2sqfs.h
+++ b/bin/tar2sqfs/src/tar2sqfs.h
@@ -35,6 +35,6 @@ extern size_t num_excludedirs;
void process_args(int argc, char **argv);
/* process_tarball.c */
-int process_tarball(dir_iterator_t *it, sqfs_writer_t *sqfs);
+int process_tarball(sqfs_dir_iterator_t *it, sqfs_writer_t *sqfs);
#endif /* TAR2SQFS_H */
diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h
index 1801123..e14b2ee 100644
--- a/include/io/dir_iterator.h
+++ b/include/io/dir_iterator.h
@@ -11,11 +11,11 @@
#include "sqfs/predef.h"
/**
- * @interface dir_iterator_t
+ * @interface sqfs_dir_iterator_t
*
* @brief An iterator over entries in a filesystem directory.
*/
-typedef struct dir_iterator_t {
+typedef struct sqfs_dir_iterator_t {
sqfs_object_t obj;
/**
@@ -27,7 +27,7 @@ typedef struct dir_iterator_t {
* @return Zero on success, postivie value if the end of the list was
* reached, negative @ref SQFS_ERROR value on failure.
*/
- int (*next)(struct dir_iterator_t *it, sqfs_dir_entry_t **out);
+ int (*next)(struct sqfs_dir_iterator_t *it, sqfs_dir_entry_t **out);
/**
* @brief If the last entry was a symlink, extract the target path
@@ -38,22 +38,22 @@ typedef struct dir_iterator_t {
*
* @return Zero on success, negative @ref SQFS_ERROR value on failure.
*/
- int (*read_link)(struct dir_iterator_t *it, char **out);
+ int (*read_link)(struct sqfs_dir_iterator_t *it, char **out);
/**
* @brief If the last entry was a directory, open it.
*
* If next() returned a directory, this can be used to create a brand
- * new dir_iterator_t for it, that is independent of the current one
- * and returns the sub-directories entries.
+ * new sqfs_dir_iterator_t for it, that is independent of the current
+ * one and returns the sub-directories entries.
*
* @param it A pointer to the iterator itself.
* @param out Returns a pointer to a directory iterator on success.
*
* @return Zero on success, negative @ref SQFS_ERROR value on failure.
*/
- int (*open_subdir)(struct dir_iterator_t *it,
- struct dir_iterator_t **out);
+ int (*open_subdir)(struct sqfs_dir_iterator_t *it,
+ struct sqfs_dir_iterator_t **out);
/**
* @brief Skip a sub-hierarchy on a stacked iterator
@@ -64,7 +64,7 @@ typedef struct dir_iterator_t {
*
* @param it A pointer to the iterator itself.
*/
- void (*ignore_subdir)(struct dir_iterator_t *it);
+ void (*ignore_subdir)(struct sqfs_dir_iterator_t *it);
/**
* @brief If the last entry was a regular file, open it.
@@ -77,7 +77,8 @@ typedef struct dir_iterator_t {
*
* @return Zero on success, negative @ref SQFS_ERROR value on failure.
*/
- int (*open_file_ro)(struct dir_iterator_t *it, sqfs_istream_t **out);
+ int (*open_file_ro)(struct sqfs_dir_iterator_t *it,
+ sqfs_istream_t **out);
/**
* @brief Read extended attributes associated with the current entry
@@ -87,8 +88,8 @@ typedef struct dir_iterator_t {
*
* @return Zero on success, negative @ref SQFS_ERROR value on failure.
*/
- int (*read_xattr)(struct dir_iterator_t *it, sqfs_xattr_t **out);
-} dir_iterator_t;
+ int (*read_xattr)(struct sqfs_dir_iterator_t *it, sqfs_xattr_t **out);
+} sqfs_dir_iterator_t;
enum {
DIR_SCAN_NO_SOCK = 0x0001,
@@ -155,10 +156,10 @@ extern "C" {
*
* @param path A path to a directory on the file system.
*
- * @return A pointer to a dir_iterator_t implementation on success,
+ * @return A pointer to a sqfs_dir_iterator_t implementation on success,
* NULL on error (message is printed to stderr).
*/
-SQFS_INTERNAL dir_iterator_t *dir_iterator_create(const char *path);
+SQFS_INTERNAL sqfs_dir_iterator_t *dir_iterator_create(const char *path);
/**
* @brief Create a stacked, recursive directory tree iterator
@@ -171,12 +172,12 @@ SQFS_INTERNAL dir_iterator_t *dir_iterator_create(const char *path);
* @param path A path to a directory on the file system.
* @param cfg A @ref dir_tree_cfg_t filtering configuration.
*
- * @return A pointer to a dir_iterator_t implementation on success,
+ * @return A pointer to a sqfs_dir_iterator_t implementation on success,
* NULL on error (message is printed to stderr).
*/
SQFS_INTERNAL
-dir_iterator_t *dir_tree_iterator_create(const char *path,
- const dir_tree_cfg_t *cfg);
+sqfs_dir_iterator_t *dir_tree_iterator_create(const char *path,
+ const dir_tree_cfg_t *cfg);
#ifdef __cplusplus
}
diff --git a/include/tar/tar.h b/include/tar/tar.h
index 811ac47..68fde98 100644
--- a/include/tar/tar.h
+++ b/include/tar/tar.h
@@ -68,7 +68,8 @@ 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(sqfs_istream_t *stream, tar_iterator_opts *opts);
+sqfs_dir_iterator_t *tar_open_stream(sqfs_istream_t *stream,
+ tar_iterator_opts *opts);
/*
Write zero bytes to an output file to padd it to the tar record size.
diff --git a/lib/io/src/dir_tree_iterator.c b/lib/io/src/dir_tree_iterator.c
index 7af4b5e..6370743 100644
--- a/lib/io/src/dir_tree_iterator.c
+++ b/lib/io/src/dir_tree_iterator.c
@@ -14,12 +14,12 @@
typedef struct dir_stack_t {
struct dir_stack_t *next;
- dir_iterator_t *dir;
+ sqfs_dir_iterator_t *dir;
char name[];
} dir_stack_t;
typedef struct {
- dir_iterator_t base;
+ sqfs_dir_iterator_t base;
dir_tree_cfg_t cfg;
int state;
@@ -37,7 +37,8 @@ static void pop(dir_tree_iterator_t *it)
}
}
-static int push(dir_tree_iterator_t *it, const char *name, dir_iterator_t *dir)
+static int push(dir_tree_iterator_t *it, const char *name,
+ sqfs_dir_iterator_t *dir)
{
dir_stack_t *ent = alloc_flex(sizeof(*ent), 1, strlen(name) + 1);
@@ -149,10 +150,10 @@ static void destroy(sqfs_object_t *obj)
free(it);
}
-static int next(dir_iterator_t *base, sqfs_dir_entry_t **out)
+static int next(sqfs_dir_iterator_t *base, sqfs_dir_entry_t **out)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
- dir_iterator_t *sub;
+ sqfs_dir_iterator_t *sub;
sqfs_dir_entry_t *ent;
int ret;
retry:
@@ -241,7 +242,7 @@ fail:
return it->state;
}
-static int read_link(dir_iterator_t *base, char **out)
+static int read_link(sqfs_dir_iterator_t *base, char **out)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
@@ -253,7 +254,7 @@ static int read_link(dir_iterator_t *base, char **out)
return it->top->dir->read_link(it->top->dir, out);
}
-static int open_subdir(dir_iterator_t *base, dir_iterator_t **out)
+static int open_subdir(sqfs_dir_iterator_t *base, sqfs_dir_iterator_t **out)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
@@ -265,14 +266,14 @@ static int open_subdir(dir_iterator_t *base, dir_iterator_t **out)
return it->top->dir->open_subdir(it->top->dir, out);
}
-static void ignore_subdir(dir_iterator_t *base)
+static void ignore_subdir(sqfs_dir_iterator_t *base)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
pop(it);
}
-static int open_file_ro(dir_iterator_t *base, sqfs_istream_t **out)
+static int open_file_ro(sqfs_dir_iterator_t *base, sqfs_istream_t **out)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
@@ -284,7 +285,7 @@ static int open_file_ro(dir_iterator_t *base, sqfs_istream_t **out)
return it->top->dir->open_file_ro(it->top->dir, out);
}
-static int read_xattr(dir_iterator_t *base, sqfs_xattr_t **out)
+static int read_xattr(sqfs_dir_iterator_t *base, sqfs_xattr_t **out)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
@@ -296,11 +297,11 @@ static int read_xattr(dir_iterator_t *base, sqfs_xattr_t **out)
return it->top->dir->read_xattr(it->top->dir, out);
}
-dir_iterator_t *dir_tree_iterator_create(const char *path,
- const dir_tree_cfg_t *cfg)
+sqfs_dir_iterator_t *dir_tree_iterator_create(const char *path,
+ const dir_tree_cfg_t *cfg)
{
dir_tree_iterator_t *it = calloc(1, sizeof(*it));
- dir_iterator_t *dir;
+ sqfs_dir_iterator_t *dir;
int ret;
if (it == NULL) {
@@ -322,14 +323,14 @@ dir_iterator_t *dir_tree_iterator_create(const char *path,
}
sqfs_object_init(it, destroy, NULL);
- ((dir_iterator_t *)it)->next = next;
- ((dir_iterator_t *)it)->read_link = read_link;
- ((dir_iterator_t *)it)->open_subdir = open_subdir;
- ((dir_iterator_t *)it)->ignore_subdir = ignore_subdir;
- ((dir_iterator_t *)it)->open_file_ro = open_file_ro;
- ((dir_iterator_t *)it)->read_xattr = read_xattr;
-
- return (dir_iterator_t *)it;
+ ((sqfs_dir_iterator_t *)it)->next = next;
+ ((sqfs_dir_iterator_t *)it)->read_link = read_link;
+ ((sqfs_dir_iterator_t *)it)->open_subdir = open_subdir;
+ ((sqfs_dir_iterator_t *)it)->ignore_subdir = ignore_subdir;
+ ((sqfs_dir_iterator_t *)it)->open_file_ro = open_file_ro;
+ ((sqfs_dir_iterator_t *)it)->read_xattr = read_xattr;
+
+ return (sqfs_dir_iterator_t *)it;
fail:
free(it);
return NULL;
diff --git a/lib/io/src/unix/dir_iterator.c b/lib/io/src/unix/dir_iterator.c
index d2ae011..74ac953 100644
--- a/lib/io/src/unix/dir_iterator.c
+++ b/lib/io/src/unix/dir_iterator.c
@@ -17,7 +17,7 @@
#include <errno.h>
typedef struct {
- dir_iterator_t base;
+ sqfs_dir_iterator_t base;
struct dirent *ent;
struct stat sb;
@@ -34,7 +34,7 @@ static void dir_destroy(sqfs_object_t *obj)
free(it);
}
-static int dir_read_link(dir_iterator_t *base, char **out)
+static int dir_read_link(sqfs_dir_iterator_t *base, char **out)
{
unix_dir_iterator_t *it = (unix_dir_iterator_t *)base;
ssize_t ret;
@@ -74,7 +74,7 @@ static int dir_read_link(dir_iterator_t *base, char **out)
return 0;
}
-static int dir_next(dir_iterator_t *base, sqfs_dir_entry_t **out)
+static int dir_next(sqfs_dir_iterator_t *base, sqfs_dir_entry_t **out)
{
unix_dir_iterator_t *it = (unix_dir_iterator_t *)base;
@@ -122,12 +122,12 @@ static int dir_next(dir_iterator_t *base, sqfs_dir_entry_t **out)
return it->state;
}
-static void dir_ignore_subdir(dir_iterator_t *it)
+static void dir_ignore_subdir(sqfs_dir_iterator_t *it)
{
(void)it;
}
-static int dir_open_file_ro(dir_iterator_t *base, sqfs_istream_t **out)
+static int dir_open_file_ro(sqfs_dir_iterator_t *base, sqfs_istream_t **out)
{
unix_dir_iterator_t *it = (unix_dir_iterator_t *)base;
int fd, ret;
@@ -153,16 +153,16 @@ static int dir_open_file_ro(dir_iterator_t *base, sqfs_istream_t **out)
return ret;
}
-static int dir_read_xattr(dir_iterator_t *it, sqfs_xattr_t **out)
+static int dir_read_xattr(sqfs_dir_iterator_t *it, sqfs_xattr_t **out)
{
(void)it;
*out = NULL;
return 0;
}
-static int create_iterator(dir_iterator_t **out, DIR *dir);
+static int create_iterator(sqfs_dir_iterator_t **out, DIR *dir);
-static int dir_open_subdir(dir_iterator_t *base, dir_iterator_t **out)
+static int dir_open_subdir(sqfs_dir_iterator_t *base, sqfs_dir_iterator_t **out)
{
const unix_dir_iterator_t *it = (const unix_dir_iterator_t *)base;
DIR *dir;
@@ -194,7 +194,7 @@ static int dir_open_subdir(dir_iterator_t *base, dir_iterator_t **out)
return create_iterator(out, dir);
}
-static int create_iterator(dir_iterator_t **out, DIR *dir)
+static int create_iterator(sqfs_dir_iterator_t **out, DIR *dir)
{
unix_dir_iterator_t *it = calloc(1, sizeof(*it));
@@ -215,20 +215,20 @@ static int create_iterator(dir_iterator_t **out, DIR *dir)
sqfs_object_init(it, dir_destroy, NULL);
it->device = it->sb.st_dev;
- ((dir_iterator_t *)it)->next = dir_next;
- ((dir_iterator_t *)it)->read_link = dir_read_link;
- ((dir_iterator_t *)it)->open_subdir = dir_open_subdir;
- ((dir_iterator_t *)it)->ignore_subdir = dir_ignore_subdir;
- ((dir_iterator_t *)it)->open_file_ro = dir_open_file_ro;
- ((dir_iterator_t *)it)->read_xattr = dir_read_xattr;
-
- *out = (dir_iterator_t *)it;
+ ((sqfs_dir_iterator_t *)it)->next = dir_next;
+ ((sqfs_dir_iterator_t *)it)->read_link = dir_read_link;
+ ((sqfs_dir_iterator_t *)it)->open_subdir = dir_open_subdir;
+ ((sqfs_dir_iterator_t *)it)->ignore_subdir = dir_ignore_subdir;
+ ((sqfs_dir_iterator_t *)it)->open_file_ro = dir_open_file_ro;
+ ((sqfs_dir_iterator_t *)it)->read_xattr = dir_read_xattr;
+
+ *out = (sqfs_dir_iterator_t *)it;
return 0;
}
-dir_iterator_t *dir_iterator_create(const char *path)
+sqfs_dir_iterator_t *dir_iterator_create(const char *path)
{
- dir_iterator_t *out;
+ sqfs_dir_iterator_t *out;
DIR *dir;
dir = opendir(path);
diff --git a/lib/io/src/win32/dir_iterator.c b/lib/io/src/win32/dir_iterator.c
index f66e323..15cfbc5 100644
--- a/lib/io/src/win32/dir_iterator.c
+++ b/lib/io/src/win32/dir_iterator.c
@@ -18,7 +18,7 @@
#define W32_TICS_PER_SEC 10000000UL
typedef struct {
- dir_iterator_t base;
+ sqfs_dir_iterator_t base;
WIN32_FIND_DATAW ent;
HANDLE dirhnd;
@@ -44,14 +44,14 @@ static sqfs_s64 w32time_to_unix(const FILETIME *ft)
return w32ts - UNIX_EPOCH_ON_W32;
}
-static int dir_iterator_read_link(dir_iterator_t *it, char **out)
+static int dir_iterator_read_link(sqfs_dir_iterator_t *it, char **out)
{
(void)it;
*out = NULL;
return SQFS_ERROR_UNSUPPORTED;
}
-static int dir_iterator_next(dir_iterator_t *it, sqfs_dir_entry_t **out)
+static int dir_iterator_next(sqfs_dir_iterator_t *it, sqfs_dir_entry_t **out)
{
dir_iterator_win32_t *w32 = (dir_iterator_win32_t *)it;
sqfs_dir_entry_t *ent = NULL;
@@ -115,12 +115,13 @@ static void dir_iterator_destroy(sqfs_object_t *obj)
free(dir);
}
-static void dir_iterator_ignore_subdir(dir_iterator_t *it)
+static void dir_iterator_ignore_subdir(sqfs_dir_iterator_t *it)
{
(void)it;
}
-static int dir_iterator_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
+static int dir_iterator_open_file_ro(sqfs_dir_iterator_t *it,
+ sqfs_istream_t **out)
{
dir_iterator_win32_t *dir = (dir_iterator_win32_t *)it;
size_t plen, slen;
@@ -184,7 +185,7 @@ static int dir_iterator_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
return ret;
}
-static int dir_iterator_read_xattr(dir_iterator_t *it, sqfs_xattr_t **out)
+static int dir_iterator_read_xattr(sqfs_dir_iterator_t *it, sqfs_xattr_t **out)
{
(void)it;
*out = NULL;
@@ -193,7 +194,8 @@ static int dir_iterator_read_xattr(dir_iterator_t *it, sqfs_xattr_t **out)
static int dir_iterator_init(dir_iterator_win32_t *it);
-static int dir_iterator_open_subdir(dir_iterator_t *it, dir_iterator_t **out)
+static int dir_iterator_open_subdir(sqfs_dir_iterator_t *it,
+ sqfs_dir_iterator_t **out)
{
const dir_iterator_win32_t *dir = (const dir_iterator_win32_t *)it;
dir_iterator_win32_t *sub = NULL;
@@ -228,7 +230,7 @@ static int dir_iterator_open_subdir(dir_iterator_t *it, dir_iterator_t **out)
sub = NULL;
}
- *out = (dir_iterator_t *)sub;
+ *out = (sqfs_dir_iterator_t *)sub;
return ret;
}
@@ -236,12 +238,12 @@ static int dir_iterator_init(dir_iterator_win32_t *it)
{
sqfs_object_init(it, dir_iterator_destroy, NULL);
- ((dir_iterator_t *)it)->next = dir_iterator_next;
- ((dir_iterator_t *)it)->read_link = dir_iterator_read_link;
- ((dir_iterator_t *)it)->open_subdir = dir_iterator_open_subdir;
- ((dir_iterator_t *)it)->ignore_subdir = dir_iterator_ignore_subdir;
- ((dir_iterator_t *)it)->open_file_ro = dir_iterator_open_file_ro;
- ((dir_iterator_t *)it)->read_xattr = dir_iterator_read_xattr;
+ ((sqfs_dir_iterator_t *)it)->next = dir_iterator_next;
+ ((sqfs_dir_iterator_t *)it)->read_link = dir_iterator_read_link;
+ ((sqfs_dir_iterator_t *)it)->open_subdir = dir_iterator_open_subdir;
+ ((sqfs_dir_iterator_t *)it)->ignore_subdir = dir_iterator_ignore_subdir;
+ ((sqfs_dir_iterator_t *)it)->open_file_ro = dir_iterator_open_file_ro;
+ ((sqfs_dir_iterator_t *)it)->read_xattr = dir_iterator_read_xattr;
it->is_first = true;
it->state = 0;
@@ -252,7 +254,7 @@ static int dir_iterator_init(dir_iterator_win32_t *it)
return 0;
}
-dir_iterator_t *dir_iterator_create(const char *path)
+sqfs_dir_iterator_t *dir_iterator_create(const char *path)
{
dir_iterator_win32_t *it;
size_t len, newlen;
@@ -299,7 +301,7 @@ dir_iterator_t *dir_iterator_create(const char *path)
it = NULL;
}
- return (dir_iterator_t *)it;
+ return (sqfs_dir_iterator_t *)it;
fail_alloc:
fprintf(stderr, "%s: allocation failure.\n", path);
free(wpath);
diff --git a/lib/io/test/dir_iterator.c b/lib/io/test/dir_iterator.c
index 48a57ec..013e41e 100644
--- a/lib/io/test/dir_iterator.c
+++ b/lib/io/test/dir_iterator.c
@@ -31,7 +31,7 @@ static int compare_files(const void *a, const void *b)
int main(int argc, char **argv)
{
- dir_iterator_t *dir, *suba, *subb, *subc, *sub;
+ sqfs_dir_iterator_t *dir, *suba, *subb, *subc, *sub;
sqfs_dir_entry_t *dent, *ent[6];
sqfs_istream_t *files[3];
char buffer[128];
diff --git a/lib/io/test/dir_tree_iterator.c b/lib/io/test/dir_tree_iterator.c
index 14fad7e..8e11e2a 100644
--- a/lib/io/test/dir_tree_iterator.c
+++ b/lib/io/test/dir_tree_iterator.c
@@ -22,7 +22,7 @@ static int compare_entries(const void *a, const void *b)
int main(int argc, char **argv)
{
sqfs_dir_entry_t *ent[17];
- dir_iterator_t *dir;
+ sqfs_dir_iterator_t *dir;
dir_tree_cfg_t cfg;
size_t i;
int ret;
diff --git a/lib/io/test/dir_tree_iterator2.c b/lib/io/test/dir_tree_iterator2.c
index 961cd39..2833dc5 100644
--- a/lib/io/test/dir_tree_iterator2.c
+++ b/lib/io/test/dir_tree_iterator2.c
@@ -22,7 +22,7 @@ static int compare_entries(const void *a, const void *b)
int main(int argc, char **argv)
{
sqfs_dir_entry_t *ent[17];
- dir_iterator_t *dir;
+ sqfs_dir_iterator_t *dir;
dir_tree_cfg_t cfg;
size_t i;
int ret;
diff --git a/lib/io/test/dir_tree_iterator3.c b/lib/io/test/dir_tree_iterator3.c
index 5e414d7..b82934f 100644
--- a/lib/io/test/dir_tree_iterator3.c
+++ b/lib/io/test/dir_tree_iterator3.c
@@ -22,7 +22,7 @@ static int compare_entries(const void *a, const void *b)
int main(int argc, char **argv)
{
sqfs_dir_entry_t *ent[17];
- dir_iterator_t *dir;
+ sqfs_dir_iterator_t *dir;
dir_tree_cfg_t cfg;
size_t i;
int ret;
diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c
index a2708a0..85466ba 100644
--- a/lib/tar/src/iterator.c
+++ b/lib/tar/src/iterator.c
@@ -19,7 +19,7 @@
#include <fnmatch.h>
typedef struct {
- dir_iterator_t base;
+ sqfs_dir_iterator_t base;
tar_header_decoded_t current;
sqfs_istream_t *stream;
char **excludedirs;
@@ -167,7 +167,7 @@ static void strm_destroy(sqfs_object_t *obj)
/*****************************************************************************/
-static int it_next(dir_iterator_t *it, sqfs_dir_entry_t **out)
+static int it_next(sqfs_dir_iterator_t *it, sqfs_dir_entry_t **out)
{
tar_iterator_t *tar = (tar_iterator_t *)it;
size_t idx;
@@ -243,7 +243,7 @@ fail:
return tar->state;
}
-static int it_read_link(dir_iterator_t *it, char **out)
+static int it_read_link(sqfs_dir_iterator_t *it, char **out)
{
tar_iterator_t *tar = (tar_iterator_t *)it;
@@ -258,20 +258,20 @@ static int it_read_link(dir_iterator_t *it, char **out)
return (*out == NULL) ? SQFS_ERROR_ALLOC : 0;
}
-static int it_open_subdir(dir_iterator_t *it, dir_iterator_t **out)
+static int it_open_subdir(sqfs_dir_iterator_t *it, sqfs_dir_iterator_t **out)
{
(void)it;
*out = NULL;
return SQFS_ERROR_UNSUPPORTED;
}
-static void it_ignore_subdir(dir_iterator_t *it)
+static void it_ignore_subdir(sqfs_dir_iterator_t *it)
{
(void)it;
/* TODO: skip list */
}
-static int it_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
+static int it_open_file_ro(sqfs_dir_iterator_t *it, sqfs_istream_t **out)
{
tar_iterator_t *tar = (tar_iterator_t *)it;
tar_istream_t *strm;
@@ -302,7 +302,7 @@ static int it_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
return 0;
}
-static int it_read_xattr(dir_iterator_t *it, sqfs_xattr_t **out)
+static int it_read_xattr(sqfs_dir_iterator_t *it, sqfs_xattr_t **out)
{
tar_iterator_t *tar = (tar_iterator_t *)it;
@@ -359,10 +359,11 @@ static int tar_probe(const sqfs_u8 *data, size_t size)
return 0;
}
-dir_iterator_t *tar_open_stream(sqfs_istream_t *strm, tar_iterator_opts *opts)
+sqfs_dir_iterator_t *tar_open_stream(sqfs_istream_t *strm,
+ tar_iterator_opts *opts)
{
tar_iterator_t *tar = calloc(1, sizeof(*tar));
- dir_iterator_t *it = (dir_iterator_t *)tar;
+ sqfs_dir_iterator_t *it = (sqfs_dir_iterator_t *)tar;
xfrm_stream_t *xfrm = NULL;
const sqfs_u8 *ptr;
size_t size;
diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c
index cd24c94..b90d5ca 100644
--- a/lib/tar/test/tar_iterator.c
+++ b/lib/tar/test/tar_iterator.c
@@ -31,7 +31,7 @@ static const char *fname = STRVALUE(TESTFNAME);
int main(int argc, char **argv)
{
sqfs_istream_t *fp, *ti, *ti2;
- dir_iterator_t *it;
+ sqfs_dir_iterator_t *it;
sqfs_dir_entry_t *ent;
char buffer[100];
sqfs_s32 ret;
diff --git a/lib/tar/test/tar_iterator2.c b/lib/tar/test/tar_iterator2.c
index 7b22af3..630f579 100644
--- a/lib/tar/test/tar_iterator2.c
+++ b/lib/tar/test/tar_iterator2.c
@@ -45,7 +45,7 @@ int main(int argc, char **argv)
{
unsigned char buffer[941];
sqfs_istream_t *fp, *ti;
- dir_iterator_t *it;
+ sqfs_dir_iterator_t *it;
sqfs_dir_entry_t *ent;
uint64_t offset;
sqfs_s32 i, ret;
diff --git a/lib/tar/test/tar_iterator3.c b/lib/tar/test/tar_iterator3.c
index 7973441..05940a2 100644
--- a/lib/tar/test/tar_iterator3.c
+++ b/lib/tar/test/tar_iterator3.c
@@ -14,7 +14,7 @@
int main(int argc, char **argv)
{
sqfs_istream_t *fp, *ti;
- dir_iterator_t *it;
+ sqfs_dir_iterator_t *it;
char buffer[100];
sqfs_dir_entry_t *ent;
char *link;