diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-10-03 15:21:35 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-10-03 15:24:08 +0200 |
commit | 5e7ce8c83dd1ded633b2a1bbeea37cbb53f743f0 (patch) | |
tree | 8dcd7d96a01b9d8a49b3d977de3ffe03cb9e026f /lib/sqfshelper/serialize_fstree.c | |
parent | 1ac7243a2164796f915e0c28853a21f3927ce865 (diff) |
Add a counter-part to sqfs_inode_get_xattr_index
Combines all the type depenend attribute setting and inode type
promotion into a single function.
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.c | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/lib/sqfshelper/serialize_fstree.c b/lib/sqfshelper/serialize_fstree.c index 66fa054..7a03dc9 100644 --- a/lib/sqfshelper/serialize_fstree.c +++ b/lib/sqfshelper/serialize_fstree.c @@ -52,47 +52,23 @@ static sqfs_inode_generic_t *tree_node_to_inode(tree_node_t *node) inode->base.type = get_type(node); - if (node->xattr_idx != 0xFFFFFFFF) - sqfs_inode_make_extended(inode); - switch (inode->base.type) { case SQFS_INODE_FIFO: case SQFS_INODE_SOCKET: inode->data.ipc.nlink = 1; break; - case SQFS_INODE_EXT_FIFO: - case SQFS_INODE_EXT_SOCKET: - inode->data.ipc_ext.nlink = 1; - inode->data.ipc_ext.xattr_idx = node->xattr_idx; - break; case SQFS_INODE_SLINK: inode->data.slink.nlink = 1; inode->data.slink.target_size = extra; break; - case SQFS_INODE_EXT_SLINK: - inode->data.slink_ext.nlink = 1; - inode->data.slink_ext.target_size = extra; - inode->data.slink_ext.xattr_idx = node->xattr_idx; - break; case SQFS_INODE_BDEV: case SQFS_INODE_CDEV: inode->data.dev.nlink = 1; inode->data.dev.devno = node->data.devno; break; - case SQFS_INODE_EXT_BDEV: - case SQFS_INODE_EXT_CDEV: - inode->data.dev_ext.nlink = 1; - inode->data.dev_ext.devno = node->data.devno; - inode->data.dev_ext.xattr_idx = node->xattr_idx; - break; - default: - goto fail; } return inode; -fail: - free(inode); - return NULL; } static sqfs_inode_generic_t *write_dir_entries(sqfs_dir_writer_t *dirw, @@ -163,11 +139,6 @@ int sqfs_serialize_fstree(sqfs_file_t *file, sqfs_super_t *super, fstree_t *fs, } else if (S_ISREG(n->mode)) { inode = n->data.file.user_ptr; n->data.file.user_ptr = NULL; - - if (n->xattr_idx != 0xFFFFFFFF) { - sqfs_inode_make_extended(inode); - inode->data.file_ext.xattr_idx = n->xattr_idx; - } } else { inode = tree_node_to_inode(n); } @@ -179,6 +150,8 @@ int sqfs_serialize_fstree(sqfs_file_t *file, sqfs_super_t *super, fstree_t *fs, inode->base.mod_time = n->mod_time; inode->base.inode_number = n->inode_num; + sqfs_inode_set_xattr_index(inode, n->xattr_idx); + if (sqfs_id_table_id_to_index(idtbl, n->uid, &inode->base.uid_idx)) { goto fail_id; |