summaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-22 00:21:29 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-22 00:26:37 +0200
commit64484ae0ff4d1bf52f618093bf3fc43a86745573 (patch)
tree15e8cc1f8895f08b12a93b600d0397edefcc531c /mkfs
parent79e67f767bb34448c75312a538dc9f06a365448f (diff)
simplify SELinux labeling
This commit moves the SELinux label code after the tree is sorted and the inode table is generated. Sorting helps to make sure that the tree will always be traversed in a defined, deterministic order and likewise the creation of xattrs happens in a defined, deterministic order. Second, we can now use the inode table instead of having to implement a recursive tree traversal yet again. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/mkfs.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index 2219989..08744f8 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -109,6 +109,13 @@ int main(int argc, char **argv)
goto out_fstree;
}
+ fstree_sort(&fs);
+
+ if (fstree_gen_inode_table(&fs))
+ goto out_fstree;
+
+ super.inode_count = fs.inode_tbl_size - 2;
+
#ifdef WITH_SELINUX
if (opt.selinux != NULL) {
if (fstree_relabel_selinux(&fs, opt.selinux))
@@ -118,13 +125,6 @@ int main(int argc, char **argv)
fstree_xattr_deduplicate(&fs);
- fstree_sort(&fs);
-
- if (fstree_gen_inode_table(&fs))
- goto out_fstree;
-
- super.inode_count = fs.inode_tbl_size - 2;
-
cmp = compressor_create(super.compression_id, true, super.block_size,
opt.comp_extra);
if (cmp == NULL) {