aboutsummaryrefslogtreecommitdiff
path: root/tar/tar2sqfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-19 16:10:39 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-22 22:07:44 +0100
commit1466f1f8571aca423156ee7ef4094a0c082f88d7 (patch)
tree76863754fe3a0546ec8279da97cbeae7700b0abc /tar/tar2sqfs.c
parent0a6c5d7fa2f276b8e155d69bea17650bad46f089 (diff)
Add basic support for handling and serializing hard links
In libfstree, add a function to add a hard link to the fstree. The hard links stores the target in the data.target field, canonicalizes the target and sets a sentinel mode. A second function is used to resolve link, i.e. replacing it with a direct pointer, setting another sentinel mode and increasing the targets link count. The post process function tries to resolve unresolved hard links and only allocates inode numbers for nodes that aren't hard links. If the target node of a hard link does not have an inode number yet, the two need to be swapped, since this is also the order in which they are serialized. The serialization function in libcommon simply has to skip hard link nodes and when writing directory entries, use the inode num/ref of the target node. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar/tar2sqfs.c')
-rw-r--r--tar/tar2sqfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index a13b84e..63933eb 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -551,7 +551,8 @@ int main(int argc, char **argv)
if (process_tar_ball())
goto out;
- fstree_post_process(&sqfs.fs);
+ if (fstree_post_process(&sqfs.fs))
+ goto out;
if (sqfs_writer_finish(&sqfs, &cfg))
goto out;