diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-01 23:08:04 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-01 23:08:36 +0200 |
commit | 9d9d4505f58b6584fe3b261a7686c5d779f77c11 (patch) | |
tree | 7f1a086abc273c55c4d3a9cf96144715e3d15329 /include | |
parent | 307107ecd2fc3ffbf6fe91497daf767700f3572f (diff) |
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/sqfs/id_table.h | 20 |
1 files changed, 6 insertions, 14 deletions
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 |