zdb: Always print symlink target
When zdb is printing paths, also print the symlink target if it exists. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Ahrens <matt@delphix.com> Signed-off-by: Justin Keogh <commits@v6y.net> Closes #9925
This commit is contained in:
parent
948f0c4419
commit
12f7b90c93
@ -2419,6 +2419,23 @@ dump_znode_sa_xattr(sa_handle_t *hdl)
|
||||
free(sa_xattr_packed);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_znode_symlink(sa_handle_t *hdl)
|
||||
{
|
||||
int sa_symlink_size = 0;
|
||||
char linktarget[MAXPATHLEN];
|
||||
linktarget[0] = '\0';
|
||||
int error;
|
||||
|
||||
error = sa_size(hdl, sa_attr_table[ZPL_SYMLINK], &sa_symlink_size);
|
||||
if (error || sa_symlink_size == 0) {
|
||||
return;
|
||||
}
|
||||
if (sa_lookup(hdl, sa_attr_table[ZPL_SYMLINK],
|
||||
&linktarget, sa_symlink_size) == 0)
|
||||
(void) printf("\ttarget %s\n", linktarget);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
dump_znode(objset_t *os, uint64_t object, void *data, size_t size)
|
||||
@ -2483,6 +2500,9 @@ dump_znode(objset_t *os, uint64_t object, void *data, size_t size)
|
||||
}
|
||||
(void) printf("\tpath %s\n", path);
|
||||
}
|
||||
|
||||
if (S_ISLNK(mode))
|
||||
dump_znode_symlink(hdl);
|
||||
dump_uidgid(os, uid, gid);
|
||||
(void) printf("\tatime %s", ctime(&z_atime));
|
||||
(void) printf("\tmtime %s", ctime(&z_mtime));
|
||||
|
Loading…
Reference in New Issue
Block a user