summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/tree_node_to_inode.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-28 23:08:39 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-28 23:34:17 +0200
commitd758950ac88c2c6759d1616ac8be2c70c9dcf761 (patch)
treee96860712abea784525a2b7feb3a690b443e1372 /lib/sqfshelper/tree_node_to_inode.c
parent9bcb6edfe419d390acddc2ed7d0c04d37b753ac3 (diff)
Replace fstree/sqfshelper xattr code with sqfs_xattr_writer_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfshelper/tree_node_to_inode.c')
-rw-r--r--lib/sqfshelper/tree_node_to_inode.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/lib/sqfshelper/tree_node_to_inode.c b/lib/sqfshelper/tree_node_to_inode.c
index d75e959..bafaaf7 100644
--- a/lib/sqfshelper/tree_node_to_inode.c
+++ b/lib/sqfshelper/tree_node_to_inode.c
@@ -18,26 +18,11 @@
static int get_type(tree_node_t *node)
{
switch (node->mode & S_IFMT) {
- case S_IFSOCK:
- if (node->xattr != NULL)
- return SQFS_INODE_EXT_SOCKET;
- return SQFS_INODE_SOCKET;
- case S_IFIFO:
- if (node->xattr != NULL)
- return SQFS_INODE_EXT_FIFO;
- return SQFS_INODE_FIFO;
- case S_IFLNK:
- if (node->xattr != NULL)
- return SQFS_INODE_EXT_SLINK;
- return SQFS_INODE_SLINK;
- case S_IFBLK:
- if (node->xattr != NULL)
- return SQFS_INODE_EXT_BDEV;
- return SQFS_INODE_BDEV;
- case S_IFCHR:
- if (node->xattr != NULL)
- return SQFS_INODE_EXT_CDEV;
- return SQFS_INODE_CDEV;
+ case S_IFSOCK: return SQFS_INODE_SOCKET;
+ case S_IFIFO: return SQFS_INODE_FIFO;
+ case S_IFLNK: return SQFS_INODE_SLINK;
+ case S_IFBLK: return SQFS_INODE_BDEV;
+ case S_IFCHR: return SQFS_INODE_CDEV;
}
assert(0);
}
@@ -47,7 +32,6 @@ sqfs_inode_generic_t *tree_node_to_inode(sqfs_id_table_t *idtbl,
{
sqfs_inode_generic_t *inode;
sqfs_u16 uid_idx, gid_idx;
- sqfs_u32 xattr = 0xFFFFFFFF;
size_t extra = 0;
if (S_ISREG(node->mode)) {
@@ -78,8 +62,8 @@ sqfs_inode_generic_t *tree_node_to_inode(sqfs_id_table_t *idtbl,
if (sqfs_id_table_id_to_index(idtbl, node->gid, &gid_idx))
goto fail;
- if (node->xattr != NULL)
- xattr = node->xattr->index;
+ if (node->xattr_idx != 0xFFFFFFFF)
+ sqfs_inode_make_extended(inode);
inode->base.mode = node->mode;
inode->base.uid_idx = uid_idx;
@@ -95,7 +79,7 @@ sqfs_inode_generic_t *tree_node_to_inode(sqfs_id_table_t *idtbl,
case SQFS_INODE_EXT_FIFO:
case SQFS_INODE_EXT_SOCKET:
inode->data.ipc_ext.nlink = 1;
- inode->data.ipc_ext.xattr_idx = xattr;
+ inode->data.ipc_ext.xattr_idx = node->xattr_idx;
break;
case SQFS_INODE_SLINK:
inode->data.slink.nlink = 1;
@@ -104,7 +88,7 @@ sqfs_inode_generic_t *tree_node_to_inode(sqfs_id_table_t *idtbl,
case SQFS_INODE_EXT_SLINK:
inode->data.slink_ext.nlink = 1;
inode->data.slink_ext.target_size = extra;
- inode->data.slink_ext.xattr_idx = xattr;
+ inode->data.slink_ext.xattr_idx = node->xattr_idx;
break;
case SQFS_INODE_BDEV:
case SQFS_INODE_CDEV:
@@ -115,15 +99,12 @@ sqfs_inode_generic_t *tree_node_to_inode(sqfs_id_table_t *idtbl,
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 = xattr;
+ inode->data.dev_ext.xattr_idx = node->xattr_idx;
break;
case SQFS_INODE_FILE:
- if (xattr != 0xFFFFFFFF) {
- sqfs_inode_make_extended(inode);
- inode->data.file_ext.xattr_idx = xattr;
- }
break;
case SQFS_INODE_EXT_FILE:
+ inode->data.file_ext.xattr_idx = node->xattr_idx;
break;
default:
goto fail;