aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/comp/compressor.c10
-rw-r--r--lib/sqfs/comp/gzip.c14
-rw-r--r--lib/sqfs/comp/lz4.c12
-rw-r--r--lib/sqfs/comp/lzma.c10
-rw-r--r--lib/sqfs/comp/lzo.c14
-rw-r--r--lib/sqfs/comp/xz.c18
-rw-r--r--lib/sqfs/comp/zstd.c10
-rw-r--r--lib/sqfs/data_reader.c30
-rw-r--r--lib/sqfs/data_writer/block.c8
-rw-r--r--lib/sqfs/data_writer/common.c4
-rw-r--r--lib/sqfs/data_writer/fileapi.c2
-rw-r--r--lib/sqfs/data_writer/fragment.c4
-rw-r--r--lib/sqfs/data_writer/internal.h26
-rw-r--r--lib/sqfs/dir_reader.c16
-rw-r--r--lib/sqfs/dir_writer.c42
-rw-r--r--lib/sqfs/id_table.c14
-rw-r--r--lib/sqfs/inode.c16
-rw-r--r--lib/sqfs/io_file.c10
-rw-r--r--lib/sqfs/meta_reader.c20
-rw-r--r--lib/sqfs/meta_writer.c16
-rw-r--r--lib/sqfs/read_inode.c26
-rw-r--r--lib/sqfs/read_table.c10
-rw-r--r--lib/sqfs/read_tree.c2
-rw-r--r--lib/sqfs/readdir.c4
-rw-r--r--lib/sqfs/super.c2
-rw-r--r--lib/sqfs/write_inode.c6
-rw-r--r--lib/sqfs/write_table.c8
-rw-r--r--lib/sqfs/xattr_reader.c16
28 files changed, 185 insertions, 185 deletions
diff --git a/lib/sqfs/comp/compressor.c b/lib/sqfs/comp/compressor.c
index 37f852c..bfc20b7 100644
--- a/lib/sqfs/comp/compressor.c
+++ b/lib/sqfs/comp/compressor.c
@@ -46,10 +46,10 @@ static const char *names[] = {
int sqfs_generic_write_options(sqfs_file_t *file, const void *data, size_t size)
{
- uint8_t buffer[size + 2];
+ sqfs_u8 buffer[size + 2];
int ret;
- *((uint16_t *)buffer) = htole16(0x8000 | size);
+ *((sqfs_u16 *)buffer) = htole16(0x8000 | size);
memcpy(buffer + 2, data, size);
ret = file->write_at(file, sizeof(sqfs_super_t),
@@ -62,7 +62,7 @@ int sqfs_generic_write_options(sqfs_file_t *file, const void *data, size_t size)
int sqfs_generic_read_options(sqfs_file_t *file, void *data, size_t size)
{
- uint8_t buffer[size + 2];
+ sqfs_u8 buffer[size + 2];
int ret;
ret = file->read_at(file, sizeof(sqfs_super_t),
@@ -70,7 +70,7 @@ int sqfs_generic_read_options(sqfs_file_t *file, void *data, size_t size)
if (ret)
return ret;
- if (le16toh(*((uint16_t *)buffer)) != (0x8000 | size))
+ if (le16toh(*((sqfs_u16 *)buffer)) != (0x8000 | size))
return SQFS_ERROR_CORRUPTED;
memcpy(data, buffer + 2, size);
@@ -120,7 +120,7 @@ int sqfs_compressor_id_from_name(const char *name, E_SQFS_COMPRESSOR *out)
int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg,
E_SQFS_COMPRESSOR id,
- size_t block_size, uint16_t flags)
+ size_t block_size, sqfs_u16 flags)
{
memset(cfg, 0, sizeof(*cfg));
diff --git a/lib/sqfs/comp/gzip.c b/lib/sqfs/comp/gzip.c
index 0c6f944..3dd8d10 100644
--- a/lib/sqfs/comp/gzip.c
+++ b/lib/sqfs/comp/gzip.c
@@ -16,9 +16,9 @@
#include "internal.h"
typedef struct {
- uint32_t level;
- uint16_t window;
- uint16_t strategies;
+ sqfs_u32 level;
+ sqfs_u16 window;
+ sqfs_u16 strategies;
} gzip_options_t;
typedef struct {
@@ -106,8 +106,8 @@ static int flag_to_zlib_strategy(int flag)
return 0;
}
-static int find_strategy(gzip_compressor_t *gzip, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static int find_strategy(gzip_compressor_t *gzip, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
int ret, strategy, selected = Z_DEFAULT_STRATEGY;
size_t i, length, minlength = 0;
@@ -148,8 +148,8 @@ static int find_strategy(gzip_compressor_t *gzip, const uint8_t *in,
return selected;
}
-static ssize_t gzip_do_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t gzip_do_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
gzip_compressor_t *gzip = (gzip_compressor_t *)base;
int ret, strategy = 0;
diff --git a/lib/sqfs/comp/lz4.c b/lib/sqfs/comp/lz4.c
index db44bc4..35fd629 100644
--- a/lib/sqfs/comp/lz4.c
+++ b/lib/sqfs/comp/lz4.c
@@ -22,8 +22,8 @@ typedef struct {
} lz4_compressor_t;
typedef struct {
- uint32_t version;
- uint32_t flags;
+ sqfs_u32 version;
+ sqfs_u32 flags;
} lz4_options;
#define LZ4LEGACY 1
@@ -59,8 +59,8 @@ static int lz4_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return 0;
}
-static ssize_t lz4_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lz4_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lz4_compressor_t *lz4 = (lz4_compressor_t *)base;
int ret;
@@ -79,8 +79,8 @@ static ssize_t lz4_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return ret;
}
-static ssize_t lz4_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lz4_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
int ret;
(void)base;
diff --git a/lib/sqfs/comp/lzma.c b/lib/sqfs/comp/lzma.c
index 57a942e..f4211fb 100644
--- a/lib/sqfs/comp/lzma.c
+++ b/lib/sqfs/comp/lzma.c
@@ -39,8 +39,8 @@ static int lzma_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return SQFS_ERROR_UNSUPPORTED;
}
-static ssize_t lzma_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzma_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lzma_compressor_t *lzma = (lzma_compressor_t *)base;
lzma_stream strm = LZMA_STREAM_INIT;
@@ -83,10 +83,10 @@ static ssize_t lzma_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return strm.total_out;
}
-static ssize_t lzma_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzma_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
- uint8_t lzma_header[LZMA_HEADER_SIZE];
+ sqfs_u8 lzma_header[LZMA_HEADER_SIZE];
lzma_stream strm = LZMA_STREAM_INIT;
size_t hdrsize;
int ret;
diff --git a/lib/sqfs/comp/lzo.c b/lib/sqfs/comp/lzo.c
index 0b140b8..9af3321 100644
--- a/lib/sqfs/comp/lzo.c
+++ b/lib/sqfs/comp/lzo.c
@@ -51,12 +51,12 @@ typedef struct {
int algorithm;
int level;
- uint8_t buffer[];
+ sqfs_u8 buffer[];
} lzo_compressor_t;
typedef struct {
- uint32_t algorithm;
- uint32_t level;
+ sqfs_u32 algorithm;
+ sqfs_u32 level;
} lzo_options_t;
static int lzo_write_options(sqfs_compressor_t *base, sqfs_file_t *file)
@@ -112,8 +112,8 @@ static int lzo_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return 0;
}
-static ssize_t lzo_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzo_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
lzo_uint len = outsize;
@@ -138,8 +138,8 @@ static ssize_t lzo_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return 0;
}
-static ssize_t lzo_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzo_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
lzo_uint len = outsize;
diff --git a/lib/sqfs/comp/xz.c b/lib/sqfs/comp/xz.c
index f0229e0..d905f2d 100644
--- a/lib/sqfs/comp/xz.c
+++ b/lib/sqfs/comp/xz.c
@@ -22,8 +22,8 @@ typedef struct {
} xz_compressor_t;
typedef struct {
- uint32_t dict_size;
- uint32_t flags;
+ sqfs_u32 dict_size;
+ sqfs_u32 flags;
} xz_options_t;
static bool is_dict_size_valid(size_t size)
@@ -75,8 +75,8 @@ static int xz_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
}
static ssize_t compress(xz_compressor_t *xz, lzma_vli filter,
- const uint8_t *in, size_t size,
- uint8_t *out, size_t outsize)
+ const sqfs_u8 *in, size_t size,
+ sqfs_u8 *out, size_t outsize)
{
lzma_filter filters[5];
lzma_options_lzma opt;
@@ -135,8 +135,8 @@ static lzma_vli flag_to_vli(int flag)
return LZMA_VLI_UNKNOWN;
}
-static ssize_t xz_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t xz_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
xz_compressor_t *xz = (xz_compressor_t *)base;
lzma_vli filter, selected = LZMA_VLI_UNKNOWN;
@@ -171,10 +171,10 @@ static ssize_t xz_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return compress(xz, selected, in, size, out, outsize);
}
-static ssize_t xz_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t xz_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
- uint64_t memlimit = 32 * 1024 * 1024;
+ sqfs_u64 memlimit = 32 * 1024 * 1024;
size_t dest_pos = 0;
size_t src_pos = 0;
lzma_ret ret;
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c
index 50440a0..81e369b 100644
--- a/lib/sqfs/comp/zstd.c
+++ b/lib/sqfs/comp/zstd.c
@@ -22,7 +22,7 @@ typedef struct {
} zstd_compressor_t;
typedef struct {
- uint32_t level;
+ sqfs_u32 level;
} zstd_options_t;
static int zstd_write_options(sqfs_compressor_t *base, sqfs_file_t *file)
@@ -51,8 +51,8 @@ static int zstd_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return 0;
}
-static ssize_t zstd_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
zstd_compressor_t *zstd = (zstd_compressor_t *)base;
size_t ret;
@@ -66,8 +66,8 @@ static ssize_t zstd_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return ret < size ? ret : 0;
}
-static ssize_t zstd_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t zstd_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
size_t ret;
(void)base;
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c
index 862723d..0befb9d 100644
--- a/lib/sqfs/data_reader.c
+++ b/lib/sqfs/data_reader.c
@@ -25,18 +25,18 @@ struct sqfs_data_reader_t {
sqfs_block_t *data_block;
sqfs_block_t *frag_block;
- uint64_t current_block;
+ sqfs_u64 current_block;
sqfs_file_t *file;
- uint32_t num_fragments;
- uint32_t current_frag_index;
- uint32_t block_size;
+ sqfs_u32 num_fragments;
+ sqfs_u32 current_frag_index;
+ sqfs_u32 block_size;
- uint8_t scratch[];
+ sqfs_u8 scratch[];
};
-static int get_block(sqfs_data_reader_t *data, uint64_t off, uint32_t size,
+static int get_block(sqfs_data_reader_t *data, sqfs_u64 off, sqfs_u32 size,
size_t unpacked_size, sqfs_block_t **out)
{
sqfs_block_t *blk = alloc_flex(sizeof(*blk), 1, unpacked_size);
@@ -87,8 +87,8 @@ static int get_block(sqfs_data_reader_t *data, uint64_t off, uint32_t size,
return 0;
}
-static int precache_data_block(sqfs_data_reader_t *data, uint64_t location,
- uint32_t size)
+static int precache_data_block(sqfs_data_reader_t *data, sqfs_u64 location,
+ sqfs_u32 size)
{
int ret;
@@ -153,7 +153,7 @@ int sqfs_data_reader_load_fragment_table(sqfs_data_reader_t *data,
{
void *raw_frag;
size_t size;
- uint32_t i;
+ sqfs_u32 i;
int ret;
free(data->frag_block);
@@ -210,7 +210,7 @@ int sqfs_data_reader_get_block(sqfs_data_reader_t *data,
size_t index, sqfs_block_t **out)
{
size_t i, unpacked_size;
- uint64_t off, filesz;
+ sqfs_u64 off, filesz;
sqfs_inode_get_file_block_start(inode, &off);
sqfs_inode_get_file_size(inode, &filesz);
@@ -233,9 +233,9 @@ int sqfs_data_reader_get_fragment(sqfs_data_reader_t *data,
const sqfs_inode_generic_t *inode,
sqfs_block_t **out)
{
- uint32_t frag_idx, frag_off, frag_sz;
+ sqfs_u32 frag_idx, frag_off, frag_sz;
sqfs_block_t *blk;
- uint64_t filesz;
+ sqfs_u64 filesz;
sqfs_inode_get_file_size(inode, &filesz);
sqfs_inode_get_frag_location(inode, &frag_idx, &frag_off);
@@ -266,11 +266,11 @@ int sqfs_data_reader_get_fragment(sqfs_data_reader_t *data,
ssize_t sqfs_data_reader_read(sqfs_data_reader_t *data,
const sqfs_inode_generic_t *inode,
- uint64_t offset, void *buffer, size_t size)
+ sqfs_u64 offset, void *buffer, size_t size)
{
- uint32_t frag_idx, frag_off;
+ sqfs_u32 frag_idx, frag_off;
size_t i, diff, total = 0;
- uint64_t off, filesz;
+ sqfs_u64 off, filesz;
char *ptr;
/* work out file location and size */
diff --git a/lib/sqfs/data_writer/block.c b/lib/sqfs/data_writer/block.c
index 9c40793..5dce26c 100644
--- a/lib/sqfs/data_writer/block.c
+++ b/lib/sqfs/data_writer/block.c
@@ -9,8 +9,8 @@
#include <string.h>
-static int store_block_location(sqfs_data_writer_t *proc, uint64_t offset,
- uint32_t size, uint32_t chksum)
+static int store_block_location(sqfs_data_writer_t *proc, sqfs_u64 offset,
+ sqfs_u32 size, sqfs_u32 chksum)
{
size_t new_sz;
void *new;
@@ -61,9 +61,9 @@ static int allign_file(sqfs_data_writer_t *proc, sqfs_block_t *blk)
int process_completed_block(sqfs_data_writer_t *proc, sqfs_block_t *blk)
{
- uint64_t offset, bytes;
+ sqfs_u64 offset, bytes;
size_t start, count;
- uint32_t out;
+ sqfs_u32 out;
int err;
if (proc->hooks != NULL && proc->hooks->pre_block_write != NULL) {
diff --git a/lib/sqfs/data_writer/common.c b/lib/sqfs/data_writer/common.c
index 9e11e36..059ef41 100644
--- a/lib/sqfs/data_writer/common.c
+++ b/lib/sqfs/data_writer/common.c
@@ -99,7 +99,7 @@ sqfs_block_t *data_writer_next_work_item(sqfs_data_writer_t *proc)
}
int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- uint8_t *scratch, size_t scratch_size)
+ sqfs_u8 *scratch, size_t scratch_size)
{
ssize_t ret;
@@ -132,7 +132,7 @@ int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
int sqfs_data_writer_write_fragment_table(sqfs_data_writer_t *proc,
sqfs_super_t *super)
{
- uint64_t start;
+ sqfs_u64 start;
size_t size;
int ret;
diff --git a/lib/sqfs/data_writer/fileapi.c b/lib/sqfs/data_writer/fileapi.c
index 712fd29..2a5d02a 100644
--- a/lib/sqfs/data_writer/fileapi.c
+++ b/lib/sqfs/data_writer/fileapi.c
@@ -26,7 +26,7 @@ static int add_sentinel_block(sqfs_data_writer_t *proc)
}
int sqfs_data_writer_begin_file(sqfs_data_writer_t *proc,
- sqfs_inode_generic_t *inode, uint32_t flags)
+ sqfs_inode_generic_t *inode, sqfs_u32 flags)
{
if (proc->inode != NULL)
return test_and_set_status(proc, SQFS_ERROR_INTERNAL);
diff --git a/lib/sqfs/data_writer/fragment.c b/lib/sqfs/data_writer/fragment.c
index 9f169b7..1957983 100644
--- a/lib/sqfs/data_writer/fragment.c
+++ b/lib/sqfs/data_writer/fragment.c
@@ -49,7 +49,7 @@ static int grow_deduplication_list(sqfs_data_writer_t *proc)
}
static int store_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
- uint64_t hash)
+ sqfs_u64 hash)
{
int err = grow_deduplication_list(proc);
@@ -79,7 +79,7 @@ static int store_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
int process_completed_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
sqfs_block_t **blk_out)
{
- uint64_t hash;
+ sqfs_u64 hash;
size_t i, size;
int err;
diff --git a/lib/sqfs/data_writer/internal.h b/lib/sqfs/data_writer/internal.h
index b1d9d8c..c12d89c 100644
--- a/lib/sqfs/data_writer/internal.h
+++ b/lib/sqfs/data_writer/internal.h
@@ -28,20 +28,20 @@
#define MK_BLK_HASH(chksum, size) \
- (((uint64_t)(size) << 32) | (uint64_t)(chksum))
+ (((sqfs_u64)(size) << 32) | (sqfs_u64)(chksum))
#define INIT_BLOCK_COUNT (128)
typedef struct {
- uint64_t offset;
- uint64_t hash;
+ sqfs_u64 offset;
+ sqfs_u64 hash;
} blk_info_t;
typedef struct {
- uint32_t index;
- uint32_t offset;
- uint64_t hash;
+ sqfs_u32 index;
+ sqfs_u32 offset;
+ sqfs_u64 hash;
} frag_info_t;
@@ -50,7 +50,7 @@ typedef struct {
sqfs_data_writer_t *shared;
sqfs_compressor_t *cmp;
pthread_t thread;
- uint8_t scratch[];
+ sqfs_u8 scratch[];
} compress_worker_t;
#endif
@@ -71,8 +71,8 @@ struct sqfs_data_writer_t {
int status;
/* used by main thread only */
- uint32_t enqueue_id;
- uint32_t dequeue_id;
+ sqfs_u32 enqueue_id;
+ sqfs_u32 dequeue_id;
unsigned int num_workers;
size_t max_backlog;
@@ -84,7 +84,7 @@ struct sqfs_data_writer_t {
size_t num_fragments;
size_t max_fragments;
- uint64_t start;
+ sqfs_u64 start;
size_t file_start;
size_t num_blocks;
@@ -103,7 +103,7 @@ struct sqfs_data_writer_t {
/* file API */
sqfs_inode_generic_t *inode;
sqfs_block_t *blk_current;
- uint32_t blk_flags;
+ sqfs_u32 blk_flags;
size_t blk_index;
/* used only by workers */
@@ -112,7 +112,7 @@ struct sqfs_data_writer_t {
#ifdef WITH_PTHREAD
compress_worker_t *workers[];
#else
- uint8_t scratch[];
+ sqfs_u8 scratch[];
#endif
};
@@ -141,7 +141,7 @@ sqfs_block_t *data_writer_next_work_item(sqfs_data_writer_t *proc);
SQFS_INTERNAL
int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- uint8_t *scratch, size_t scratch_size);
+ sqfs_u8 *scratch, size_t scratch_size);
SQFS_INTERNAL
int test_and_set_status(sqfs_data_writer_t *proc, int status);
diff --git a/lib/sqfs/dir_reader.c b/lib/sqfs/dir_reader.c
index aa9e1a4..a353069 100644
--- a/lib/sqfs/dir_reader.c
+++ b/lib/sqfs/dir_reader.c
@@ -25,13 +25,13 @@ struct sqfs_dir_reader_t {
const sqfs_super_t *super;
sqfs_dir_header_t hdr;
- uint64_t dir_block_start;
+ sqfs_u64 dir_block_start;
size_t entries;
size_t size;
size_t start_size;
- uint16_t dir_offset;
- uint16_t inode_offset;
+ sqfs_u16 dir_offset;
+ sqfs_u16 inode_offset;
};
sqfs_dir_reader_t *sqfs_dir_reader_create(const sqfs_super_t *super,
@@ -39,7 +39,7 @@ sqfs_dir_reader_t *sqfs_dir_reader_create(const sqfs_super_t *super,
sqfs_file_t *file)
{
sqfs_dir_reader_t *rd = calloc(1, sizeof(*rd));
- uint64_t start, limit;
+ sqfs_u64 start, limit;
if (rd == NULL)
return NULL;
@@ -85,7 +85,7 @@ void sqfs_dir_reader_destroy(sqfs_dir_reader_t *rd)
int sqfs_dir_reader_open_dir(sqfs_dir_reader_t *rd,
const sqfs_inode_generic_t *inode)
{
- uint64_t block_start;
+ sqfs_u64 block_start;
size_t size, offset;
if (inode->base.type == SQFS_INODE_DIR) {
@@ -191,7 +191,7 @@ int sqfs_dir_reader_find(sqfs_dir_reader_t *rd, const char *name)
int sqfs_dir_reader_get_inode(sqfs_dir_reader_t *rd,
sqfs_inode_generic_t **inode)
{
- uint64_t block_start;
+ sqfs_u64 block_start;
block_start = rd->hdr.start_block;
@@ -203,8 +203,8 @@ int sqfs_dir_reader_get_inode(sqfs_dir_reader_t *rd,
int sqfs_dir_reader_get_root_inode(sqfs_dir_reader_t *rd,
sqfs_inode_generic_t **inode)
{
- uint64_t block_start = rd->super->root_inode_ref >> 16;
- uint16_t offset = rd->super->root_inode_ref & 0xFFFF;
+ sqfs_u64 block_start = rd->super->root_inode_ref >> 16;
+ sqfs_u16 offset = rd->super->root_inode_ref & 0xFFFF;
return sqfs_meta_reader_read_inode(rd->meta_inode, rd->super,
block_start, offset, inode);
diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c
index 6b38c04..cae1e63 100644
--- a/lib/sqfs/dir_writer.c
+++ b/lib/sqfs/dir_writer.c
@@ -22,9 +22,9 @@
typedef struct dir_entry_t {
struct dir_entry_t *next;
- uint64_t inode_ref;
- uint32_t inode_num;
- uint16_t type;
+ sqfs_u64 inode_ref;
+ sqfs_u32 inode_num;
+ sqfs_u16 type;
size_t name_len;
char name[];
} dir_entry_t;
@@ -32,8 +32,8 @@ typedef struct dir_entry_t {
typedef struct index_ent_t {
struct index_ent_t *next;
dir_entry_t *ent;
- uint64_t block;
- uint32_t index;
+ sqfs_u64 block;
+ sqfs_u32 index;
} index_ent_t;
struct sqfs_dir_writer_t {
@@ -43,7 +43,7 @@ struct sqfs_dir_writer_t {
index_ent_t *idx;
index_ent_t *idx_end;
- uint64_t dir_ref;
+ sqfs_u64 dir_ref;
size_t dir_size;
size_t idx_size;
size_t ent_count;
@@ -109,8 +109,8 @@ void sqfs_dir_writer_destroy(sqfs_dir_writer_t *writer)
int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer)
{
- uint32_t offset;
- uint64_t block;
+ sqfs_u32 offset;
+ sqfs_u64 block;
writer_reset(writer);
@@ -120,7 +120,7 @@ int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer)
}
int sqfs_dir_writer_add_entry(sqfs_dir_writer_t *writer, const char *name,
- uint32_t inode_num, uint64_t inode_ref,
+ sqfs_u32 inode_num, sqfs_u64 inode_ref,
mode_t mode)
{
dir_entry_t *ent;
@@ -152,11 +152,11 @@ int sqfs_dir_writer_add_entry(sqfs_dir_writer_t *writer, const char *name,
return 0;
}
-static size_t get_conseq_entry_count(uint32_t offset, dir_entry_t *head)
+static size_t get_conseq_entry_count(sqfs_u32 offset, dir_entry_t *head)
{
size_t size, count = 0;
dir_entry_t *it;
- int32_t diff;
+ sqfs_s32 diff;
size = (offset + sizeof(sqfs_dir_header_t)) % SQFS_META_BLOCK_SIZE;
@@ -184,7 +184,7 @@ static size_t get_conseq_entry_count(uint32_t offset, dir_entry_t *head)
}
static int add_header(sqfs_dir_writer_t *writer, size_t count,
- dir_entry_t *ref, uint64_t block)
+ dir_entry_t *ref, sqfs_u64 block)
{
sqfs_dir_header_t hdr;
index_ent_t *idx;
@@ -222,10 +222,10 @@ int sqfs_dir_writer_end(sqfs_dir_writer_t *writer)
{
dir_entry_t *it, *first;
sqfs_dir_entry_t ent;
- uint16_t *diff_u16;
+ sqfs_u16 *diff_u16;
size_t i, count;
- uint32_t offset;
- uint64_t block;
+ sqfs_u32 offset;
+ sqfs_u64 block;
int err;
for (it = writer->list; it != NULL; ) {
@@ -244,7 +244,7 @@ int sqfs_dir_writer_end(sqfs_dir_writer_t *writer)
ent.type = htole16(it->type);
ent.size = htole16(it->name_len - 1);
- diff_u16 = (uint16_t *)&ent.inode_diff;
+ diff_u16 = (sqfs_u16 *)&ent.inode_diff;
*diff_u16 = htole16(*diff_u16);
err = sqfs_meta_writer_append(writer->dm, &ent,
@@ -269,7 +269,7 @@ size_t sqfs_dir_writer_get_size(const sqfs_dir_writer_t *writer)
return writer->dir_size;
}
-uint64_t sqfs_dir_writer_get_dir_reference(const sqfs_dir_writer_t *writer)
+sqfs_u64 sqfs_dir_writer_get_dir_reference(const sqfs_dir_writer_t *writer)
{
return writer->dir_ref;
}
@@ -286,12 +286,12 @@ size_t sqfs_dir_writer_get_entry_count(const sqfs_dir_writer_t *writer)
sqfs_inode_generic_t
*sqfs_dir_writer_create_inode(const sqfs_dir_writer_t *writer,
- size_t hlinks, uint32_t xattr,
- uint32_t parent_ino)
+ size_t hlinks, sqfs_u32 xattr,
+ sqfs_u32 parent_ino)
{
sqfs_inode_generic_t *inode;
- uint64_t start_block;
- uint16_t block_offset;
+ sqfs_u64 start_block;
+ sqfs_u16 block_offset;
inode = calloc(1, sizeof(*inode));
if (inode == NULL)
diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c
index a365a5f..78a5d26 100644
--- a/lib/sqfs/id_table.c
+++ b/lib/sqfs/id_table.c
@@ -16,7 +16,7 @@
#include <string.h>
struct sqfs_id_table_t {
- uint32_t *ids;
+ sqfs_u32 *ids;
size_t num_ids;
size_t max_ids;
};
@@ -32,7 +32,7 @@ void sqfs_id_table_destroy(sqfs_id_table_t *tbl)
free(tbl);
}
-int sqfs_id_table_id_to_index(sqfs_id_table_t *tbl, uint32_t id, uint16_t *out)
+int sqfs_id_table_id_to_index(sqfs_id_table_t *tbl, sqfs_u32 id, sqfs_u16 *out)
{
size_t i, sz;
void *ptr;
@@ -63,8 +63,8 @@ int sqfs_id_table_id_to_index(sqfs_id_table_t *tbl, uint32_t id, uint16_t *out)
return 0;
}
-int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, uint16_t index,
- uint32_t *out)
+int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, sqfs_u16 index,
+ sqfs_u32 *out)
{
if (index >= tbl->num_ids)
return SQFS_ERROR_OUT_OF_BOUNDS;
@@ -76,7 +76,7 @@ int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, uint16_t index,
int sqfs_id_table_read(sqfs_id_table_t *tbl, sqfs_file_t *file,
const sqfs_super_t *super, sqfs_compressor_t *cmp)
{
- uint64_t upper_limit, lower_limit;
+ sqfs_u64 upper_limit, lower_limit;
void *raw_ids;
size_t i;
int ret;
@@ -106,7 +106,7 @@ int sqfs_id_table_read(sqfs_id_table_t *tbl, sqfs_file_t *file,
tbl->num_ids = super->id_count;
tbl->max_ids = super->id_count;
- ret = sqfs_read_table(file, cmp, tbl->num_ids * sizeof(uint32_t),
+ ret = sqfs_read_table(file, cmp, tbl->num_ids * sizeof(sqfs_u32),
super->id_table_start, lower_limit,
upper_limit, &raw_ids);
if (ret)
@@ -123,7 +123,7 @@ int sqfs_id_table_read(sqfs_id_table_t *tbl, sqfs_file_t *file,
int sqfs_id_table_write(sqfs_id_table_t *tbl, sqfs_file_t *file,
sqfs_super_t *super, sqfs_compressor_t *cmp)
{
- uint64_t start;
+ sqfs_u64 start;
size_t i;
int ret;
diff --git a/lib/sqfs/inode.c b/lib/sqfs/inode.c
index d6c013c..334ffd8 100644
--- a/lib/sqfs/inode.c
+++ b/lib/sqfs/inode.c
@@ -28,7 +28,7 @@ static int inverse_type[] = {
};
int sqfs_inode_get_xattr_index(const sqfs_inode_generic_t *inode,
- uint32_t *out)
+ sqfs_u32 *out)
{
switch (inode->base.type) {
case SQFS_INODE_DIR:
@@ -122,7 +122,7 @@ int sqfs_inode_make_extended(sqfs_inode_generic_t *inode)
int sqfs_inode_make_basic(sqfs_inode_generic_t *inode)
{
- uint32_t xattr;
+ sqfs_u32 xattr;
int err;
err = sqfs_inode_get_xattr_index(inode, &xattr);
@@ -187,7 +187,7 @@ int sqfs_inode_make_basic(sqfs_inode_generic_t *inode)
return 0;
}
-int sqfs_inode_set_file_size(sqfs_inode_generic_t *inode, uint64_t size)
+int sqfs_inode_set_file_size(sqfs_inode_generic_t *inode, sqfs_u64 size)
{
if (inode->base.type == SQFS_INODE_EXT_FILE) {
inode->data.file_ext.file_size = size;
@@ -209,7 +209,7 @@ int sqfs_inode_set_file_size(sqfs_inode_generic_t *inode, uint64_t size)
}
int sqfs_inode_set_frag_location(sqfs_inode_generic_t *inode,
- uint32_t index, uint32_t offset)
+ sqfs_u32 index, sqfs_u32 offset)
{
if (inode->base.type == SQFS_INODE_EXT_FILE) {
inode->data.file_ext.fragment_idx = index;
@@ -225,7 +225,7 @@ int sqfs_inode_set_frag_location(sqfs_inode_generic_t *inode,
}
int sqfs_inode_set_file_block_start(sqfs_inode_generic_t *inode,
- uint64_t location)
+ sqfs_u64 location)
{
if (inode->base.type == SQFS_INODE_EXT_FILE) {
inode->data.file_ext.blocks_start = location;
@@ -246,7 +246,7 @@ int sqfs_inode_set_file_block_start(sqfs_inode_generic_t *inode,
return 0;
}
-int sqfs_inode_get_file_size(const sqfs_inode_generic_t *inode, uint64_t *size)
+int sqfs_inode_get_file_size(const sqfs_inode_generic_t *inode, sqfs_u64 *size)
{
if (inode->base.type == SQFS_INODE_EXT_FILE) {
*size = inode->data.file_ext.file_size;
@@ -260,7 +260,7 @@ int sqfs_inode_get_file_size(const sqfs_inode_generic_t *inode, uint64_t *size)
}
int sqfs_inode_get_frag_location(const sqfs_inode_generic_t *inode,
- uint32_t *index, uint32_t *offset)
+ sqfs_u32 *index, sqfs_u32 *offset)
{
if (inode->base.type == SQFS_INODE_EXT_FILE) {
*index = inode->data.file_ext.fragment_idx;
@@ -276,7 +276,7 @@ int sqfs_inode_get_frag_location(const sqfs_inode_generic_t *inode,
}
int sqfs_inode_get_file_block_start(const sqfs_inode_generic_t *inode,
- uint64_t *location)
+ sqfs_u64 *location)
{
if (inode->base.type == SQFS_INODE_EXT_FILE) {
*location = inode->data.file_ext.blocks_start;
diff --git a/lib/sqfs/io_file.c b/lib/sqfs/io_file.c
index bb5ef48..b07ae24 100644
--- a/lib/sqfs/io_file.c
+++ b/lib/sqfs/io_file.c
@@ -20,7 +20,7 @@
typedef struct {
sqfs_file_t base;
- uint64_t size;
+ sqfs_u64 size;
int fd;
} sqfs_file_stdio_t;
@@ -33,7 +33,7 @@ static void stdio_destroy(sqfs_file_t *base)
free(file);
}
-static int stdio_read_at(sqfs_file_t *base, uint64_t offset,
+static int stdio_read_at(sqfs_file_t *base, sqfs_u64 offset,
void *buffer, size_t size)
{
sqfs_file_stdio_t *file = (sqfs_file_stdio_t *)base;
@@ -59,7 +59,7 @@ static int stdio_read_at(sqfs_file_t *base, uint64_t offset,
return 0;
}
-static int stdio_write_at(sqfs_file_t *base, uint64_t offset,
+static int stdio_write_at(sqfs_file_t *base, sqfs_u64 offset,
const void *buffer, size_t size)
{
sqfs_file_stdio_t *file = (sqfs_file_stdio_t *)base;
@@ -88,14 +88,14 @@ static int stdio_write_at(sqfs_file_t *base, uint64_t offset,
return 0;
}
-static uint64_t stdio_get_size(const sqfs_file_t *base)
+static sqfs_u64 stdio_get_size(const sqfs_file_t *base)
{
const sqfs_file_stdio_t *file = (const sqfs_file_stdio_t *)base;
return file->size;
}
-static int stdio_truncate(sqfs_file_t *base, uint64_t size)
+static int stdio_truncate(sqfs_file_t *base, sqfs_u64 size)
{
sqfs_file_stdio_t *file = (sqfs_file_stdio_t *)base;
diff --git a/lib/sqfs/meta_reader.c b/lib/sqfs/meta_reader.c
index 89d698b..d3c3565 100644
--- a/lib/sqfs/meta_reader.c
+++ b/lib/sqfs/meta_reader.c
@@ -19,15 +19,15 @@
#include <string.h>
struct sqfs_meta_reader_t {
- uint64_t start;
- uint64_t limit;
+ sqfs_u64 start;
+ sqfs_u64 limit;
size_t data_used;
/* The location of the current block in the image */
- uint64_t block_offset;
+ sqfs_u64 block_offset;
/* The location of the next block after the current one */
- uint64_t next_block;
+ sqfs_u64 next_block;
/* A byte offset into the uncompressed data of the current block */
size_t offset;
@@ -39,15 +39,15 @@ struct sqfs_meta_reader_t {
sqfs_compressor_t *cmp;
/* The raw data read from the input file */
- uint8_t data[SQFS_META_BLOCK_SIZE];
+ sqfs_u8 data[SQFS_META_BLOCK_SIZE];
/* The uncompressed data read from the input file */
- uint8_t scratch[SQFS_META_BLOCK_SIZE];
+ sqfs_u8 scratch[SQFS_META_BLOCK_SIZE];
};
sqfs_meta_reader_t *sqfs_meta_reader_create(sqfs_file_t *file,
sqfs_compressor_t *cmp,
- uint64_t start, uint64_t limit)
+ sqfs_u64 start, sqfs_u64 limit)
{
sqfs_meta_reader_t *m = calloc(1, sizeof(*m));
@@ -66,11 +66,11 @@ void sqfs_meta_reader_destroy(sqfs_meta_reader_t *m)
free(m);
}
-int sqfs_meta_reader_seek(sqfs_meta_reader_t *m, uint64_t block_start,
+int sqfs_meta_reader_seek(sqfs_meta_reader_t *m, sqfs_u64 block_start,
size_t offset)
{
bool compressed;
- uint16_t header;
+ sqfs_u16 header;
ssize_t ret;
size_t size;
int err;
@@ -127,7 +127,7 @@ int sqfs_meta_reader_seek(sqfs_meta_reader_t *m, uint64_t block_start,
}
void sqfs_meta_reader_get_position(const sqfs_meta_reader_t *m,
- uint64_t *block_start, size_t *offset)
+ sqfs_u64 *block_start, size_t *offset)
{
*block_start = m->block_offset;
*offset = m->offset;
diff --git a/lib/sqfs/meta_writer.c b/lib/sqfs/meta_writer.c
index 2edc91a..a5ce366 100644
--- a/lib/sqfs/meta_writer.c
+++ b/lib/sqfs/meta_writer.c
@@ -22,7 +22,7 @@ typedef struct meta_block_t {
struct meta_block_t *next;
/* possibly compressed data with 2 byte header */
- uint8_t data[SQFS_META_BLOCK_SIZE + 2];
+ sqfs_u8 data[SQFS_META_BLOCK_SIZE + 2];
} meta_block_t;
struct sqfs_meta_writer_t {
@@ -39,7 +39,7 @@ struct sqfs_meta_writer_t {
sqfs_compressor_t *cmp;
/* The raw data chunk that data is appended to */
- uint8_t data[SQFS_META_BLOCK_SIZE];
+ sqfs_u8 data[SQFS_META_BLOCK_SIZE];
int flags;
meta_block_t *list;
@@ -48,8 +48,8 @@ struct sqfs_meta_writer_t {
static int write_block(sqfs_file_t *file, meta_block_t *outblk)
{
- size_t count = le16toh(((uint16_t *)outblk->data)[0]) & 0x7FFF;
- uint64_t off = file->get_size(file);
+ size_t count = le16toh(((sqfs_u16 *)outblk->data)[0]) & 0x7FFF;
+ sqfs_u64 off = file->get_size(file);
return file->write_at(file, off, outblk->data, count + 2);
}
@@ -107,10 +107,10 @@ int sqfs_meta_writer_flush(sqfs_meta_writer_t *m)
}
if (ret > 0) {
- ((uint16_t *)outblk->data)[0] = htole16(ret);
+ ((sqfs_u16 *)outblk->data)[0] = htole16(ret);
count = ret + 2;
} else {
- ((uint16_t *)outblk->data)[0] = htole16(m->offset | 0x8000);
+ ((sqfs_u16 *)outblk->data)[0] = htole16(m->offset | 0x8000);
memcpy(outblk->data + 2, m->data, m->offset);
count = m->offset + 2;
}
@@ -167,8 +167,8 @@ int sqfs_meta_writer_append(sqfs_meta_writer_t *m, const void *data,
}
void sqfs_meta_writer_get_position(const sqfs_meta_writer_t *m,
- uint64_t *block_start,
- uint32_t *offset)
+ sqfs_u64 *block_start,
+ sqfs_u32 *offset)
{
*block_start = m->block_offset;
*offset = m->offset;
diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c
index 5a87a45..1916c96 100644
--- a/lib/sqfs/read_inode.c
+++ b/lib/sqfs/read_inode.c
@@ -61,10 +61,10 @@ static int set_mode(sqfs_inode_t *inode)
return 0;
}
-static uint64_t get_block_count(uint64_t size, uint64_t block_size,
- uint32_t frag_index, uint32_t frag_offset)
+static sqfs_u64 get_block_count(sqfs_u64 size, sqfs_u64 block_size,
+ sqfs_u32 frag_index, sqfs_u32 frag_offset)
{
- uint64_t count = size / block_size;
+ sqfs_u64 count = size / block_size;
if ((size % block_size) != 0 &&
(frag_index == 0xFFFFFFFF || frag_offset == 0xFFFFFFFF)) {
@@ -79,7 +79,7 @@ static int read_inode_file(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
{
sqfs_inode_generic_t *out;
sqfs_inode_file_t file;
- uint64_t i, count;
+ sqfs_u64 i, count;
int err;
err = sqfs_meta_reader_read(ir, &file, sizeof(file));
@@ -94,17 +94,17 @@ static int read_inode_file(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
count = get_block_count(file.file_size, block_size,
file.fragment_index, file.fragment_offset);
- out = alloc_flex(sizeof(*out), sizeof(uint32_t), count);
+ out = alloc_flex(sizeof(*out), sizeof(sqfs_u32), count);
if (out == NULL)
return SQFS_ERROR_ALLOC;
out->base = *base;
out->data.file = file;
- out->block_sizes = (uint32_t *)out->extra;
+ out->block_sizes = (sqfs_u32 *)out->extra;
out->num_file_blocks = count;
err = sqfs_meta_reader_read(ir, out->block_sizes,
- count * sizeof(uint32_t));
+ count * sizeof(sqfs_u32));
if (err) {
free(out);
return err;
@@ -122,7 +122,7 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
{
sqfs_inode_file_ext_t file;
sqfs_inode_generic_t *out;
- uint64_t i, count;
+ sqfs_u64 i, count;
int err;
err = sqfs_meta_reader_read(ir, &file, sizeof(file));
@@ -140,7 +140,7 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
count = get_block_count(file.file_size, block_size,
file.fragment_idx, file.fragment_offset);
- out = alloc_flex(sizeof(*out), sizeof(uint32_t), count);
+ out = alloc_flex(sizeof(*out), sizeof(sqfs_u32), count);
if (out == NULL) {
return errno == EOVERFLOW ? SQFS_ERROR_OVERFLOW :
SQFS_ERROR_ALLOC;
@@ -148,11 +148,11 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
out->base = *base;
out->data.file_ext = file;
- out->block_sizes = (uint32_t *)out->extra;
+ out->block_sizes = (sqfs_u32 *)out->extra;
out->num_file_blocks = count;
err = sqfs_meta_reader_read(ir, out->block_sizes,
- count * sizeof(uint32_t));
+ count * sizeof(sqfs_u32));
if (err) {
free(out);
return err;
@@ -206,7 +206,7 @@ static int read_inode_slink(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
static int read_inode_slink_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
sqfs_inode_generic_t **result)
{
- uint32_t xattr;
+ sqfs_u32 xattr;
int err;
err = read_inode_slink(ir, base, result);
@@ -225,7 +225,7 @@ static int read_inode_slink_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
int sqfs_meta_reader_read_inode(sqfs_meta_reader_t *ir,
const sqfs_super_t *super,
- uint64_t block_start, size_t offset,
+ sqfs_u64 block_start, size_t offset,
sqfs_inode_generic_t **result)
{
sqfs_inode_generic_t *out;
diff --git a/lib/sqfs/read_table.c b/lib/sqfs/read_table.c
index 239607e..4c5a5cc 100644
--- a/lib/sqfs/read_table.c
+++ b/lib/sqfs/read_table.c
@@ -18,11 +18,11 @@
#include <stdlib.h>
int sqfs_read_table(sqfs_file_t *file, sqfs_compressor_t *cmp,
- size_t table_size, uint64_t location, uint64_t lower_limit,
- uint64_t upper_limit, void **out)
+ size_t table_size, sqfs_u64 location, sqfs_u64 lower_limit,
+ sqfs_u64 upper_limit, void **out)
{
size_t diff, block_count, blk_idx = 0;
- uint64_t start, *locations;
+ sqfs_u64 start, *locations;
sqfs_meta_reader_t *m;
void *data, *ptr;
int err;
@@ -37,7 +37,7 @@ int sqfs_read_table(sqfs_file_t *file, sqfs_compressor_t *cmp,
if ((table_size % SQFS_META_BLOCK_SIZE) != 0)
++block_count;
- locations = alloc_array(sizeof(uint64_t), block_count);
+ locations = alloc_array(sizeof(sqfs_u64), block_count);
if (locations == NULL) {
err = SQFS_ERROR_ALLOC;
@@ -45,7 +45,7 @@ int sqfs_read_table(sqfs_file_t *file, sqfs_compressor_t *cmp,
}
err = file->read_at(file, location, locations,
- sizeof(uint64_t) * block_count);
+ sizeof(sqfs_u64) * block_count);
if (err)
goto fail_idx;
diff --git a/lib/sqfs/read_tree.c b/lib/sqfs/read_tree.c
index f32f63c..4672a4e 100644
--- a/lib/sqfs/read_tree.c
+++ b/lib/sqfs/read_tree.c
@@ -44,7 +44,7 @@ static int should_skip(int type, unsigned int flags)
static bool would_be_own_parent(sqfs_tree_node_t *parent, sqfs_tree_node_t *n)
{
- uint32_t inum = n->inode->base.inode_number;
+ sqfs_u32 inum = n->inode->base.inode_number;
while (parent != NULL) {
if (parent->inode->base.inode_number == inum)
diff --git a/lib/sqfs/readdir.c b/lib/sqfs/readdir.c
index 9db316e..6b549b7 100644
--- a/lib/sqfs/readdir.c
+++ b/lib/sqfs/readdir.c
@@ -35,14 +35,14 @@ int sqfs_meta_reader_read_dir_ent(sqfs_meta_reader_t *m,
sqfs_dir_entry_t **result)
{
sqfs_dir_entry_t ent, *out;
- uint16_t *diff_u16;
+ sqfs_u16 *diff_u16;
int err;
err = sqfs_meta_reader_read(m, &ent, sizeof(ent));
if (err)
return err;
- diff_u16 = (uint16_t *)&ent.inode_diff;
+ diff_u16 = (sqfs_u16 *)&ent.inode_diff;
*diff_u16 = le16toh(*diff_u16);
ent.offset = le16toh(ent.offset);
diff --git a/lib/sqfs/super.c b/lib/sqfs/super.c
index ad42c9f..5cd5a87 100644
--- a/lib/sqfs/super.c
+++ b/lib/sqfs/super.c
@@ -16,7 +16,7 @@
#include <string.h>
#include <unistd.h>
-int sqfs_super_init(sqfs_super_t *super, size_t block_size, uint32_t mtime,
+int sqfs_super_init(sqfs_super_t *super, size_t block_size, sqfs_u32 mtime,
E_SQFS_COMPRESSOR compressor)
{
unsigned int i;
diff --git a/lib/sqfs/write_inode.c b/lib/sqfs/write_inode.c
index 422959e..b16ef65 100644
--- a/lib/sqfs/write_inode.c
+++ b/lib/sqfs/write_inode.c
@@ -14,14 +14,14 @@
static int write_block_sizes(sqfs_meta_writer_t *ir,
const sqfs_inode_generic_t *n)
{
- uint32_t sizes[n->num_file_blocks];
+ sqfs_u32 sizes[n->num_file_blocks];
size_t i;
for (i = 0; i < n->num_file_blocks; ++i)
sizes[i] = htole32(n->block_sizes[i]);
return sqfs_meta_writer_append(ir, sizes,
- sizeof(uint32_t) * n->num_file_blocks);
+ sizeof(sqfs_u32) * n->num_file_blocks);
}
int sqfs_meta_writer_write_inode(sqfs_meta_writer_t *ir,
@@ -124,7 +124,7 @@ int sqfs_meta_writer_write_inode(sqfs_meta_writer_t *ir,
.nlink = htole32(n->data.slink_ext.nlink),
.target_size = htole32(n->data.slink_ext.target_size),
};
- uint32_t xattr = htole32(n->data.slink_ext.xattr_idx);
+ sqfs_u32 xattr = htole32(n->data.slink_ext.xattr_idx);
ret = sqfs_meta_writer_append(ir, &slink, sizeof(slink));
if (ret)
diff --git a/lib/sqfs/write_table.c b/lib/sqfs/write_table.c
index 5f11769..c50cf06 100644
--- a/lib/sqfs/write_table.c
+++ b/lib/sqfs/write_table.c
@@ -19,10 +19,10 @@
#include <stdlib.h>
int sqfs_write_table(sqfs_file_t *file, sqfs_compressor_t *cmp,
- const void *data, size_t table_size, uint64_t *start)
+ const void *data, size_t table_size, sqfs_u64 *start)
{
size_t block_count, list_size, diff, blkidx = 0;
- uint64_t off, *locations;
+ sqfs_u64 off, *locations;
sqfs_meta_writer_t *m;
int ret;
@@ -30,7 +30,7 @@ int sqfs_write_table(sqfs_file_t *file, sqfs_compressor_t *cmp,
if ((table_size % SQFS_META_BLOCK_SIZE) != 0)
++block_count;
- locations = alloc_array(sizeof(uint64_t), block_count);
+ locations = alloc_array(sizeof(sqfs_u64), block_count);
if (locations == NULL)
return SQFS_ERROR_ALLOC;
@@ -64,7 +64,7 @@ int sqfs_write_table(sqfs_file_t *file, sqfs_compressor_t *cmp,
/* write location list */
*start = file->get_size(file);
- list_size = sizeof(uint64_t) * block_count;
+ list_size = sizeof(sqfs_u64) * block_count;
off = file->get_size(file);
diff --git a/lib/sqfs/xattr_reader.c b/lib/sqfs/xattr_reader.c
index 4164f66..fb9c36a 100644
--- a/lib/sqfs/xattr_reader.c
+++ b/lib/sqfs/xattr_reader.c
@@ -20,12 +20,12 @@
#include <errno.h>
struct sqfs_xattr_reader_t {
- uint64_t xattr_start;
+ sqfs_u64 xattr_start;
size_t num_id_blocks;
size_t num_ids;
- uint64_t *id_block_starts;
+ sqfs_u64 *id_block_starts;
sqfs_meta_reader_t *idrd;
sqfs_meta_reader_t *kvrd;
@@ -61,7 +61,7 @@ int sqfs_xattr_reader_load_locations(sqfs_xattr_reader_t *xr)
if ((xr->num_ids * sizeof(sqfs_xattr_id_t)) % SQFS_META_BLOCK_SIZE)
xr->num_id_blocks += 1;
- xr->id_block_starts = alloc_array(sizeof(uint64_t), xr->num_id_blocks);
+ xr->id_block_starts = alloc_array(sizeof(sqfs_u64), xr->num_id_blocks);
if (xr->id_block_starts == NULL) {
if (errno == EOVERFLOW)
return SQFS_ERROR_OVERFLOW;
@@ -71,7 +71,7 @@ int sqfs_xattr_reader_load_locations(sqfs_xattr_reader_t *xr)
err = xr->file->read_at(xr->file,
xr->super->xattr_id_table_start + sizeof(idtbl),
xr->id_block_starts,
- sizeof(uint64_t) * xr->num_id_blocks);
+ sizeof(sqfs_u64) * xr->num_id_blocks);
if (err)
goto fail;
@@ -140,7 +140,7 @@ int sqfs_xattr_reader_read_value(sqfs_xattr_reader_t *xr,
{
size_t offset, new_offset, size;
sqfs_xattr_value_t value, *out;
- uint64_t ref, start, new_start;
+ sqfs_u64 ref, start, new_start;
int ret;
ret = sqfs_meta_reader_read(xr->kvrd, &value, sizeof(value));
@@ -200,13 +200,13 @@ fail:
int sqfs_xattr_reader_seek_kv(sqfs_xattr_reader_t *xr,
const sqfs_xattr_id_t *desc)
{
- uint32_t offset = desc->xattr & 0xFFFF;
- uint64_t block = xr->xattr_start + (desc->xattr >> 16);
+ sqfs_u32 offset = desc->xattr & 0xFFFF;
+ sqfs_u64 block = xr->xattr_start + (desc->xattr >> 16);
return sqfs_meta_reader_seek(xr->kvrd, block, offset);
}
-int sqfs_xattr_reader_get_desc(sqfs_xattr_reader_t *xr, uint32_t idx,
+int sqfs_xattr_reader_get_desc(sqfs_xattr_reader_t *xr, sqfs_u32 idx,
sqfs_xattr_id_t *desc)
{
size_t block, offset;