summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-04 18:02:44 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-04 18:02:44 +0200
commit407a2baae5622b05f1e9c4137448a973fd648736 (patch)
tree475a668f763dfc83f08c7df7d811c7e141759bb9 /include
parentf780c9542d2c96cb0ae00a8de8d67b9a8fd278cd (diff)
Split fstree inode serialization, move independend part to libsquashfs.so
This commit adds a function to libsquashfs.so for writing generic inodes to a meta writer and another function to libsqfshelper.a that turns a tree node to an inode. That way, the tree serialization code can be expressed in terms of those functions and a bulk of the independend code can be moved over to libsquashfs.so Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/highlevel.h18
-rw-r--r--include/sqfs/inode.h4
2 files changed, 8 insertions, 14 deletions
diff --git a/include/highlevel.h b/include/highlevel.h
index 576f686..379430d 100644
--- a/include/highlevel.h
+++ b/include/highlevel.h
@@ -103,20 +103,6 @@ int sqfs_reader_open(sqfs_reader_t *rd, const char *filename,
/* Cleanup after a successfull sqfs_reader_open */
void sqfs_reader_close(sqfs_reader_t *rd);
-/*
- High level helper function to serialize a tree_node_t to a squashfs inode
- and write it to a meta data writer.
-
- The inode is written to `im`. If it is a directory node, the directory
- contents are written to `dm` using meta_writer_write_dir. The given
- id_table_t is used to store the uid and gid on the fly and write the
- coresponding indices to the inode structure.
-
- Returns 0 on success. Prints error messages to stderr on failure.
- */
-int meta_writer_write_inode(fstree_t *fs, id_table_t *idtbl, meta_writer_t *im,
- sqfs_dir_writer_t *dirw, tree_node_t *node);
-
void compressor_print_available(void);
E_SQFS_COMPRESSOR compressor_get_default(void);
@@ -129,4 +115,8 @@ void compressor_print_help(E_SQFS_COMPRESSOR id);
int xattr_reader_restore_node(xattr_reader_t *xr, fstree_t *fs,
tree_node_t *node, uint32_t xattr);
+sqfs_inode_generic_t *tree_node_to_inode(fstree_t *fs, id_table_t *idtbl,
+ tree_node_t *node,
+ size_t *file_num_blocks);
+
#endif /* HIGHLEVEL_H */
diff --git a/include/sqfs/inode.h b/include/sqfs/inode.h
index 6fb56b6..1f50b2a 100644
--- a/include/sqfs/inode.h
+++ b/include/sqfs/inode.h
@@ -10,6 +10,7 @@
#include "config.h"
#include "sqfs/meta_reader.h"
+#include "sqfs/meta_writer.h"
#include <stdint.h>
@@ -141,6 +142,9 @@ sqfs_inode_generic_t *meta_reader_read_inode(meta_reader_t *ir,
uint64_t block_start,
size_t offset);
+int meta_writer_write_inode(meta_writer_t *ir, sqfs_inode_generic_t *n,
+ size_t file_num_blocks);
+
#ifdef __cplusplus
}
#endif