aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-20 17:04:15 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-22 16:15:45 +0200
commit6351872732fce77186f401050eee92c7c3aa3461 (patch)
treec938233378d13dbc94e08f24e34bb84406b08d21 /include
parent9a97a9a4fe224bcf53ad23af31bca67bbb71a824 (diff)
libtar: add a dir_iterator_t implementation for tar files
The existing istream_t wrapper is mered into this one as well, we can open the files via the iterators open_file_ro function. Unit tests and tar2sqfs are modified accordingly. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/io/dir_iterator.h9
-rw-r--r--include/io/xattr.h2
-rw-r--r--include/tar/tar.h5
3 files changed, 10 insertions, 6 deletions
diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h
index 377f07e..20fcdff 100644
--- a/include/io/dir_iterator.h
+++ b/include/io/dir_iterator.h
@@ -24,6 +24,11 @@ typedef enum {
*/
typedef struct {
/**
+ * @brief Total size of file entries
+ */
+ sqfs_u64 size;
+
+ /**
* @brief Unix time stamp when the entry was last modified.
*
* If necessary, the OS native time stamp is converted to Unix time.
@@ -49,14 +54,14 @@ typedef struct {
*
* On Windows and other non-Unix OSes, this always reports user 0.
*/
- sqfs_u32 uid;
+ sqfs_u64 uid;
/**
* @brief ID of the group that owns the entry.
*
* On Windows and other non-Unix OSes, this always reports group 0.
*/
- sqfs_u32 gid;
+ sqfs_u64 gid;
/**
* @brief Unix style permissions and entry type.
diff --git a/include/io/xattr.h b/include/io/xattr.h
index cf35bca..d9f3e65 100644
--- a/include/io/xattr.h
+++ b/include/io/xattr.h
@@ -24,6 +24,8 @@ extern "C" {
dir_entry_xattr_t *dir_entry_xattr_create(const char *key, const sqfs_u8 *value,
size_t value_len);
+dir_entry_xattr_t *dir_entry_xattr_list_copy(const dir_entry_xattr_t *list);
+
void dir_entry_xattr_list_free(dir_entry_xattr_t *list);
#ifdef __cplusplus
diff --git a/include/tar/tar.h b/include/tar/tar.h
index 21ded7d..f77b27c 100644
--- a/include/tar/tar.h
+++ b/include/tar/tar.h
@@ -59,14 +59,11 @@ int write_hard_link(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 skip_entry(istream_t *fp, sqfs_u64 size);
-
int read_header(istream_t *fp, tar_header_decoded_t *out);
void clear_header(tar_header_decoded_t *hdr);
-istream_t *tar_record_istream_create(istream_t *parent,
- const tar_header_decoded_t *hdr);
+dir_iterator_t *tar_open_stream(istream_t *stream);
/*
Write zero bytes to an output file to padd it to the tar record size.