summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/serialize_fstree.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-03 12:54:15 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-04 15:10:43 +0200
commitf780c9542d2c96cb0ae00a8de8d67b9a8fd278cd (patch)
tree8bde83d298124bd9ec8bb678e76a578ec62b10a7 /lib/sqfshelper/serialize_fstree.c
parent949edd852d959c6350c4544632740e700c734b4f (diff)
Add fstree independend directory writer to libsquashfs.so
This commit adds a directory writer to libsquashfs that wrapps a meta data writer and provides a higher-level interface for writing directory entries. Under the hood it enforces the rules that squashfs insists upon. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfshelper/serialize_fstree.c')
-rw-r--r--lib/sqfshelper/serialize_fstree.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqfshelper/serialize_fstree.c b/lib/sqfshelper/serialize_fstree.c
index e6eccea..53e2236 100644
--- a/lib/sqfshelper/serialize_fstree.c
+++ b/lib/sqfshelper/serialize_fstree.c
@@ -16,6 +16,7 @@
int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
compressor_t *cmp, id_table_t *idtbl)
{
+ sqfs_dir_writer_t *dirwr;
meta_writer_t *im, *dm;
uint32_t offset;
uint64_t block;
@@ -30,8 +31,12 @@ int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
if (dm == NULL)
goto out_im;
+ dirwr = sqfs_dir_writer_create(dm);
+ if (dirwr == NULL)
+ goto out_dm;
+
for (i = 2; i < fs->inode_tbl_size; ++i) {
- if (meta_writer_write_inode(fs, idtbl, im, dm,
+ if (meta_writer_write_inode(fs, idtbl, im, dirwr,
fs->inode_table[i])) {
goto out;
}
@@ -58,6 +63,8 @@ int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
ret = 0;
out:
+ sqfs_dir_writer_destroy(dirwr);
+out_dm:
meta_writer_destroy(dm);
out_im:
meta_writer_destroy(im);