diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-08-01 14:43:04 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-08-01 15:48:42 +0200 |
commit | acfef038be1db770c33476bbb33b53558ddabc91 (patch) | |
tree | 3a681779e25f180f67d4244c3f0972b796526045 /unpack/rdsquashfs.c | |
parent | b6f8bbbd4d3c344c220f884ad5629ab3576e9105 (diff) |
Add option to rdsquashfs to dump extended attributes for an inode
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/rdsquashfs.c')
-rw-r--r-- | unpack/rdsquashfs.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/unpack/rdsquashfs.c b/unpack/rdsquashfs.c index 4b2dc6c..5eb10f2 100644 --- a/unpack/rdsquashfs.c +++ b/unpack/rdsquashfs.c @@ -6,6 +6,21 @@ */ #include "rdsquashfs.h" +static void dump_xattrs(fstree_t *fs, tree_xattr_t *xattr) +{ + const char *key, *value; + size_t i; + + for (i = 0; i < xattr->num_attr; ++i) { + key = str_table_get_string(&fs->xattr_keys, + xattr->attr[i].key_index); + value = str_table_get_string(&fs->xattr_values, + xattr->attr[i].value_index); + + printf("%s=%s\n", key, value); + } +} + int main(int argc, char **argv) { int status = EXIT_FAILURE; @@ -106,6 +121,10 @@ int main(int argc, char **argv) case OP_DESCRIBE: describe_tree(fs.root, opt.unpack_root); break; + case OP_RDATTR: + if (n->xattr != NULL) + dump_xattrs(&fs, n->xattr); + break; } status = EXIT_SUCCESS; |