summaryrefslogtreecommitdiff
path: root/include/sqfs/id_table.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-01 14:35:03 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-01 14:35:03 +0200
commit9533dc84d7addf792db4f4702b6fc7d7ddd20e78 (patch)
tree1efcf0fbc9fa590ea7aa6e6ac74cd34f71355a3a /include/sqfs/id_table.h
parent79c333899d318bf9b1eec3837833c7f0229d1906 (diff)
Install libsquashfs.so headers on the system in "sqfs" subdirectory
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs/id_table.h')
-rw-r--r--include/sqfs/id_table.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/sqfs/id_table.h b/include/sqfs/id_table.h
new file mode 100644
index 0000000..dcc8a18
--- /dev/null
+++ b/include/sqfs/id_table.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * id_table.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef ID_TABLE_H
+#define ID_TABLE_H
+
+#include "config.h"
+
+#include <stdint.h>
+#include <stddef.h>
+
+#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;
+
+/* Returns 0 on success. Prints error message to stderr on failure. */
+int id_table_init(id_table_t *tbl);
+
+void id_table_cleanup(id_table_t *tbl);
+
+/* Resolve a 32 bit to a 16 bit table index.
+ Returns 0 on success. Internally prints errors to stderr. */
+int id_table_id_to_index(id_table_t *tbl, uint32_t id, uint16_t *out);
+
+/* Write an ID table to a SquashFS image.
+ Returns 0 on success. Internally prints error message to stderr. */
+int id_table_write(id_table_t *tbl, int outfd, sqfs_super_t *super,
+ compressor_t *cmp);
+
+/* Read an ID table from a SquashFS image.
+ Returns 0 on success. Internally prints error messages to stderr. */
+int id_table_read(id_table_t *tbl, int fd, sqfs_super_t *super,
+ compressor_t *cmp);
+
+#endif /* ID_TABLE_H */