summaryrefslogtreecommitdiff
path: root/include/highlevel.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-10 22:55:22 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-10 22:56:53 +0200
commit4d2e87b767d1e025699286783c23926ec5eff857 (patch)
tree9df2b8dc99ce41fc3ecbda95d1d755bb3fc826c7 /include/highlevel.h
parent0742ee3943192434d69092f11946f791f0f25502 (diff)
Rename table.h to highlevel.h
The idea is to move various higher level helper functions there. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/highlevel.h')
-rw-r--r--include/highlevel.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/highlevel.h b/include/highlevel.h
new file mode 100644
index 0000000..e69e337
--- /dev/null
+++ b/include/highlevel.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+#ifndef HIGHLEVEL_H
+#define HIGHLEVEL_H
+
+#include "squashfs.h"
+#include "compress.h"
+#include "id_table.h"
+#include "fstree.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 'count'
+ blocks of data from 'data' to it, each 'entsize' bytes in size. For each
+ meta data block, it remembers the 64 bit start address, writes out all
+ addresses to an uncompressed address list and returns the location where
+ the address list starts.
+
+ Returns 0 on success. Internally prints error messages to stderr.
+ */
+int sqfs_write_table(int outfd, sqfs_super_t *super, const void *data,
+ size_t entsize, size_t count, uint64_t *startblock,
+ compressor_t *cmp);
+
+/*
+ High level helper function to serialize an entire file system tree to
+ a squashfs inode table and directory table.
+
+ The data is written to the given file descriptor and the super block is
+ update accordingly (inode and directory table start and total size).
+
+ The function internally creates two meta data writers and uses
+ meta_writer_write_inode to serialize the inode table of the fstree.
+
+ Returns 0 on success. Prints error messages to stderr on failure.
+ */
+int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
+ compressor_t *cmp, id_table_t *idtbl);
+
+#endif /* HIGHLEVEL_H */