diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-10 21:20:00 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-10 21:24:46 +0200 |
commit | 395e301d554a233dd00a3c7abff4880ad7e681a1 (patch) | |
tree | 5c5ea9186d0181b6751c39c4670f7a3122309098 /include | |
parent | 856e8ae89a3ba86526b71bc811573c7e10d161d4 (diff) |
Generate a flat inode table from the fstree ahead of time
Instead of allocating inode numbers as we go, generate and populat an
inode table from the fstree ahead of time. This makes processing nodes
a little bit simpler and we will need that table anyway for NFS export
support later on.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/fstree.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/fstree.h b/include/fstree.h index 3c9e2af..284792b 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -130,7 +130,6 @@ struct tree_node_t { Generated on the fly when writing inodes. */ uint64_t inode_ref; - /* Inode number. Generated on the fly when writing inodes. */ uint32_t inode_num; /* Type specific data. Pointers are into payload area blow. */ @@ -151,12 +150,16 @@ struct fstree_t { uint32_t default_mode; uint32_t default_mtime; size_t block_size; + size_t inode_tbl_size; str_table_t xattr_keys; str_table_t xattr_values; tree_node_t *root; tree_xattr_t *xattr; + + /* linear array of tree nodes. inode number is array index */ + tree_node_t **inode_table; }; /* @@ -248,4 +251,7 @@ void fstree_sort(fstree_t *fs); Returns 0 on success. Internally prints errors to stderr. */ int fstree_relabel_selinux(fstree_t *fs, const char *filename); +/* Returns 0 on success. Prints to stderr on failure */ +int fstree_gen_inode_table(fstree_t *fs); + #endif /* FSTREE_H */ |