aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/data_writer.h2
-rw-r--r--include/sqfs/io.h14
-rw-r--r--include/sqfs/predef.h1
-rw-r--r--include/tar.h3
-rw-r--r--include/util.h8
-rw-r--r--lib/sqfshelper/data_writer.c10
-rw-r--r--lib/tar/cleanup.c4
-rw-r--r--lib/tar/internal.h6
-rw-r--r--lib/tar/read_header.c2
-rw-r--r--lib/tar/read_sparse_map.c4
-rw-r--r--lib/tar/read_sparse_map_old.c4
-rw-r--r--tar/tar2sqfs.c2
-rw-r--r--tests/tar_sparse_gnu.c2
-rw-r--r--tests/tar_sparse_gnu1.c2
-rw-r--r--tests/tar_sparse_gnu2.c2
15 files changed, 37 insertions, 29 deletions
diff --git a/include/data_writer.h b/include/data_writer.h
index c9e6f20..c9b416c 100644
--- a/include/data_writer.h
+++ b/include/data_writer.h
@@ -98,7 +98,7 @@ int write_data_from_file(data_writer_t *data, file_info_t *fi,
Returns 0 on success, prints errors to stderr.
*/
int write_data_from_fd_condensed(data_writer_t *data, file_info_t *fi,
- int infd, sparse_map_t *map, int flags);
+ int infd, sqfs_sparse_map_t *map, int flags);
data_writer_stats_t *data_writer_get_stats(data_writer_t *data);
diff --git a/include/sqfs/io.h b/include/sqfs/io.h
index 9784113..cf6f1fa 100644
--- a/include/sqfs/io.h
+++ b/include/sqfs/io.h
@@ -120,6 +120,20 @@ struct sqfs_file_t {
int (*truncate)(sqfs_file_t *file, uint64_t size);
};
+/**
+ * @struct sqfs_sparse_map_t
+ *
+ * @brief Describes the layout of a sparse file.
+ *
+ * This structure is part of a linked list that indicates where the actual
+ * data is located in a sparse file.
+ */
+struct sqfs_sparse_map_t {
+ sqfs_sparse_map_t *next;
+ uint64_t offset;
+ uint64_t count;
+};
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/include/sqfs/predef.h b/include/sqfs/predef.h
index 7aac1a8..95d907f 100644
--- a/include/sqfs/predef.h
+++ b/include/sqfs/predef.h
@@ -68,6 +68,7 @@ typedef struct sqfs_meta_reader_t sqfs_meta_reader_t;
typedef struct sqfs_meta_writer_t sqfs_meta_writer_t;
typedef struct sqfs_xattr_reader_t sqfs_xattr_reader_t;
typedef struct sqfs_file_t sqfs_file_t;
+typedef struct sqfs_sparse_map_t sqfs_sparse_map_t;
typedef struct sqfs_fragment_t sqfs_fragment_t;
typedef struct sqfs_dir_header_t sqfs_dir_header_t;
diff --git a/include/tar.h b/include/tar.h
index 44db5fe..38f6289 100644
--- a/include/tar.h
+++ b/include/tar.h
@@ -13,6 +13,7 @@
#include <stdbool.h>
#include <stdint.h>
+#include "sqfs/io.h"
#include "util.h"
typedef struct {
@@ -74,7 +75,7 @@ typedef struct {
struct stat sb;
char *name;
char *link_target;
- sparse_map_t *sparse;
+ sqfs_sparse_map_t *sparse;
uint64_t actual_size;
uint64_t record_size;
bool unknown_record;
diff --git a/include/util.h b/include/util.h
index fb927b5..5fb5f9b 100644
--- a/include/util.h
+++ b/include/util.h
@@ -39,14 +39,6 @@
#error Cannot determine maximum value of size_t
#endif
-
-/* layout structure for sparse files, indicating where the actual data is */
-typedef struct sparse_map_t {
- struct sparse_map_t *next;
- uint64_t offset;
- uint64_t count;
-} sparse_map_t;
-
/*
A wrapper around the write() system call. It retries the write if it is
interrupted by a signal or only part of the data was written. Returns 0
diff --git a/lib/sqfshelper/data_writer.c b/lib/sqfshelper/data_writer.c
index edd1770..a6d0297 100644
--- a/lib/sqfshelper/data_writer.c
+++ b/lib/sqfshelper/data_writer.c
@@ -390,9 +390,9 @@ int write_data_from_file(data_writer_t *data, file_info_t *fi,
return 0;
}
-static int check_map_valid(const sparse_map_t *map, file_info_t *fi)
+static int check_map_valid(const sqfs_sparse_map_t *map, file_info_t *fi)
{
- const sparse_map_t *m;
+ const sqfs_sparse_map_t *m;
uint64_t offset;
if (map != NULL) {
@@ -421,10 +421,10 @@ fail_map:
}
static int get_sparse_block(sqfs_block_t *blk, file_info_t *fi, int infd,
- sparse_map_t **sparse_map, uint64_t offset,
+ sqfs_sparse_map_t **sparse_map, uint64_t offset,
size_t diff)
{
- sparse_map_t *map = *sparse_map;
+ sqfs_sparse_map_t *map = *sparse_map;
size_t start, count;
while (map != NULL && map->offset < offset + diff) {
@@ -451,7 +451,7 @@ static int get_sparse_block(sqfs_block_t *blk, file_info_t *fi, int infd,
}
int write_data_from_fd_condensed(data_writer_t *data, file_info_t *fi,
- int infd, sparse_map_t *map, int flags)
+ int infd, sqfs_sparse_map_t *map, int flags)
{
uint32_t blk_flags = BLK_FIRST_BLOCK;
size_t diff, i = 0;
diff --git a/lib/tar/cleanup.c b/lib/tar/cleanup.c
index 2f814bf..3c1d0e9 100644
--- a/lib/tar/cleanup.c
+++ b/lib/tar/cleanup.c
@@ -8,9 +8,9 @@
#include "internal.h"
-void free_sparse_list(sparse_map_t *sparse)
+void free_sparse_list(sqfs_sparse_map_t *sparse)
{
- sparse_map_t *old;
+ sqfs_sparse_map_t *old;
while (sparse != NULL) {
old = sparse;
diff --git a/lib/tar/internal.h b/lib/tar/internal.h
index d95ef52..bc9a3a8 100644
--- a/lib/tar/internal.h
+++ b/lib/tar/internal.h
@@ -55,11 +55,11 @@ void update_checksum(tar_header_t *hdr);
bool is_checksum_valid(const tar_header_t *hdr);
-sparse_map_t *read_sparse_map(const char *line);
+sqfs_sparse_map_t *read_sparse_map(const char *line);
-sparse_map_t *read_gnu_old_sparse(int fd, tar_header_t *hdr);
+sqfs_sparse_map_t *read_gnu_old_sparse(int fd, tar_header_t *hdr);
-void free_sparse_list(sparse_map_t *sparse);
+void free_sparse_list(sqfs_sparse_map_t *sparse);
void free_xattr_list(tar_xattr_t *list);
diff --git a/lib/tar/read_header.c b/lib/tar/read_header.c
index 63de699..a874972 100644
--- a/lib/tar/read_header.c
+++ b/lib/tar/read_header.c
@@ -77,7 +77,7 @@ static tar_xattr_t *mkxattr(const char *key, size_t keylen,
static int read_pax_header(int fd, uint64_t entsize, unsigned int *set_by_pax,
tar_header_decoded_t *out)
{
- sparse_map_t *sparse_last = NULL, *sparse;
+ sqfs_sparse_map_t *sparse_last = NULL, *sparse;
uint64_t field, offset = 0, num_bytes = 0;
char *buffer, *line, *key, *ptr, *value;
tar_xattr_t *xattr;
diff --git a/lib/tar/read_sparse_map.c b/lib/tar/read_sparse_map.c
index 0779b96..981a808 100644
--- a/lib/tar/read_sparse_map.c
+++ b/lib/tar/read_sparse_map.c
@@ -8,9 +8,9 @@
#include "internal.h"
-sparse_map_t *read_sparse_map(const char *line)
+sqfs_sparse_map_t *read_sparse_map(const char *line)
{
- sparse_map_t *last = NULL, *list = NULL, *ent = NULL;
+ sqfs_sparse_map_t *last = NULL, *list = NULL, *ent = NULL;
do {
ent = calloc(1, sizeof(*ent));
diff --git a/lib/tar/read_sparse_map_old.c b/lib/tar/read_sparse_map_old.c
index 5891bdb..7fb4cb3 100644
--- a/lib/tar/read_sparse_map_old.c
+++ b/lib/tar/read_sparse_map_old.c
@@ -8,9 +8,9 @@
#include "internal.h"
-sparse_map_t *read_gnu_old_sparse(int fd, tar_header_t *hdr)
+sqfs_sparse_map_t *read_gnu_old_sparse(int fd, tar_header_t *hdr)
{
- sparse_map_t *list = NULL, *end = NULL, *node;
+ sqfs_sparse_map_t *list = NULL, *end = NULL, *node;
gnu_sparse_t sph;
uint64_t off, sz;
int i;
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index d693aa1..ca00579 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -311,7 +311,7 @@ static int process_tar_ball(fstree_t *fs, data_writer_t *data)
{
tar_header_decoded_t hdr;
uint64_t offset, count;
- sparse_map_t *m;
+ sqfs_sparse_map_t *m;
bool skip;
int ret;
diff --git a/tests/tar_sparse_gnu.c b/tests/tar_sparse_gnu.c
index 7cd6132..e0a0200 100644
--- a/tests/tar_sparse_gnu.c
+++ b/tests/tar_sparse_gnu.c
@@ -36,7 +36,7 @@ static int open_read(const char *path)
int main(void)
{
tar_header_decoded_t hdr;
- sparse_map_t *sparse;
+ sqfs_sparse_map_t *sparse;
int fd;
assert(chdir(TEST_PATH) == 0);
diff --git a/tests/tar_sparse_gnu1.c b/tests/tar_sparse_gnu1.c
index 366b0f4..0d8ab6b 100644
--- a/tests/tar_sparse_gnu1.c
+++ b/tests/tar_sparse_gnu1.c
@@ -36,7 +36,7 @@ static int open_read(const char *path)
int main(void)
{
tar_header_decoded_t hdr;
- sparse_map_t *sparse;
+ sqfs_sparse_map_t *sparse;
int fd;
assert(chdir(TEST_PATH) == 0);
diff --git a/tests/tar_sparse_gnu2.c b/tests/tar_sparse_gnu2.c
index cfc7eb3..568c402 100644
--- a/tests/tar_sparse_gnu2.c
+++ b/tests/tar_sparse_gnu2.c
@@ -36,7 +36,7 @@ static int open_read(const char *path)
int main(void)
{
tar_header_decoded_t hdr;
- sparse_map_t *sparse;
+ sqfs_sparse_map_t *sparse;
int fd;
assert(chdir(TEST_PATH) == 0);