aboutsummaryrefslogtreecommitdiff
path: root/include/sqfs/table.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-01 16:28:16 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-01 16:36:38 +0200
commit4ee671b63b18701a29cf9f119e2dc26a055c69c5 (patch)
treee155c9a50948101ffec2b5346edcf9b3d905372e /include/sqfs/table.h
parenta901d77efe116938bdaf5c0fc6075141ebb2bafc (diff)
API cleanup: Shuffle declarations around
Move declarations for stuff that is defined in libsquashfs.so into the public headers and declarations for stuff that isn't, out of there. Also move the meta reader/writer helper functions to their respective headers. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
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 */