diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-05-01 02:33:20 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-05-02 12:40:06 +0200 |
commit | fd22d7851e08ab6c9b57f5857062a9e4cfdc41cc (patch) | |
tree | 285ef4a6990ebc38a91495e1453ed1bbcf2f0feb /lib/sqfs/id_table.c | |
parent | 9eec700a703f62e27768f37a1c6c0e859212320c (diff) |
cleanup round
- remove debug prints
- move id table write out to id table code
- dummy remove wrapper function for fragment table
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/id_table.c')
-rw-r--r-- | lib/sqfs/id_table.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c index cd31360..4cc12c6 100644 --- a/lib/sqfs/id_table.c +++ b/lib/sqfs/id_table.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ #include "id_table.h" +#include "table.h" #include <stdlib.h> #include <string.h> @@ -50,3 +51,23 @@ int id_table_id_to_index(id_table_t *tbl, uint32_t id, uint16_t *out) tbl->ids[tbl->num_ids++] = id; return 0; } + +int id_table_write(id_table_t *tbl, int outfd, sqfs_super_t *super, + compressor_t *cmp) +{ + size_t i; + int ret; + + for (i = 0; i < tbl->num_ids; ++i) + tbl->ids[i] = htole32(tbl->ids[i]); + + super->id_count = tbl->num_ids; + + ret = sqfs_write_table(outfd, super, tbl->ids, sizeof(tbl->ids[0]), + tbl->num_ids, &super->id_table_start, cmp); + + for (i = 0; i < tbl->num_ids; ++i) + tbl->ids[i] = le32toh(tbl->ids[i]); + + return ret; +} |