From 9d9d4505f58b6584fe3b261a7686c5d779f77c11 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 1 Sep 2019 23:08:04 +0200 Subject: Internalize the layout of the id_table_t structure As an opaque struct it has a chance to change its layout in the future without breaking ABI compatibiliy. Signed-off-by: David Oberhollenzer --- include/sqfs/id_table.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'include/sqfs') diff --git a/include/sqfs/id_table.h b/include/sqfs/id_table.h index b209785..951c55e 100644 --- a/include/sqfs/id_table.h +++ b/include/sqfs/id_table.h @@ -14,26 +14,16 @@ #include "compress.h" -/* Encapsulates the ID table used by SquashFS */ -typedef struct { - /* Array of unique 32 bit IDs */ - uint32_t *ids; - - /* Number of 32 bit IDs stored in the array */ - size_t num_ids; - - /* Actual size of the array, i.e. maximum available */ - size_t max_ids; -} id_table_t; +typedef struct id_table_t id_table_t; #ifdef __cplusplus extern "C" { #endif -/* Returns 0 on success. Prints error message to stderr on failure. */ -int id_table_init(id_table_t *tbl); +/* Prints error message to stderr on failure. */ +id_table_t *id_table_create(void); -void id_table_cleanup(id_table_t *tbl); +void id_table_destroy(id_table_t *tbl); /* Resolve a 32 bit to a 16 bit table index. Returns 0 on success. Internally prints errors to stderr. */ @@ -49,6 +39,8 @@ int id_table_write(id_table_t *tbl, int outfd, sqfs_super_t *super, int id_table_read(id_table_t *tbl, int fd, sqfs_super_t *super, compressor_t *cmp); +int id_table_index_to_id(const id_table_t *tbl, uint16_t index, uint32_t *out); + #ifdef __cplusplus } #endif -- cgit v1.2.3