mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Small program that converts a dataset id and an object id to a path
Small program that converts a dataset id and an object id to a path Reviewed-by: Prakash Surya <prakash.surya@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Closes #10204
This commit is contained in:
@@ -4362,9 +4362,9 @@ zpool_events_seek(libzfs_handle_t *hdl, uint64_t eid, int zevent_fd)
|
||||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||
char *pathname, size_t len)
|
||||
static void
|
||||
zpool_obj_to_path_impl(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||
char *pathname, size_t len, boolean_t always_unmounted)
|
||||
{
|
||||
zfs_cmd_t zc = {"\0"};
|
||||
boolean_t mounted = B_FALSE;
|
||||
@@ -4391,7 +4391,8 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||
(void) strlcpy(dsname, zc.zc_value, sizeof (dsname));
|
||||
|
||||
/* find out if the dataset is mounted */
|
||||
mounted = is_mounted(zhp->zpool_hdl, dsname, &mntpnt);
|
||||
mounted = !always_unmounted && is_mounted(zhp->zpool_hdl, dsname,
|
||||
&mntpnt);
|
||||
|
||||
/* get the corrupted object's path */
|
||||
(void) strlcpy(zc.zc_name, dsname, sizeof (zc.zc_name));
|
||||
@@ -4412,6 +4413,19 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||
free(mntpnt);
|
||||
}
|
||||
|
||||
void
|
||||
zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||
char *pathname, size_t len)
|
||||
{
|
||||
zpool_obj_to_path_impl(zhp, dsobj, obj, pathname, len, B_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
zpool_obj_to_path_ds(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||
char *pathname, size_t len)
|
||||
{
|
||||
zpool_obj_to_path_impl(zhp, dsobj, obj, pathname, len, B_TRUE);
|
||||
}
|
||||
/*
|
||||
* Wait while the specified activity is in progress in the pool.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user