summaryrefslogtreecommitdiff
path: root/include/sqfs/table.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sqfs/table.h')
-rw-r--r--include/sqfs/table.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/sqfs/table.h b/include/sqfs/table.h
new file mode 100644
index 0000000..b1b0c2d
--- /dev/null
+++ b/include/sqfs/table.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * table.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef SQFS_TABLE_H
+#define SQFS_TABLE_H
+
+#include "sqfs/compress.h"
+#include "sqfs/super.h"
+
+#include <stdint.h>
+#include <stddef.h>
+
+/*
+ Convenience function for writing meta data to a SquashFS image
+
+ This function internally creates a meta data writer and writes the given
+ 'data' blob with 'table_size' bytes to disk, neatly partitioned into meta
+ data blocks. For each meta data block, it remembers the 64 bit start address,
+ writes out all addresses to an uncompressed list and returns the location
+ where the address list starts in 'start'.
+
+ Returns 0 on success. Internally prints error messages to stderr.
+ */
+int sqfs_write_table(int outfd, sqfs_super_t *super, compressor_t *cmp,
+ const void *data, size_t table_size, uint64_t *start);
+
+void *sqfs_read_table(int fd, compressor_t *cmp, size_t table_size,
+ uint64_t location, uint64_t lower_limit,
+ uint64_t upper_limit);
+
+#endif /* SQFS_TABLE_H */