mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
libzfs: pool: zpool_vdev_name: use libzfs_envvar_is_set
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13413
This commit is contained in:
parent
e9072c76f8
commit
ca3b105cd9
@ -4123,10 +4123,10 @@ char *
|
|||||||
zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||||
int name_flags)
|
int name_flags)
|
||||||
{
|
{
|
||||||
char *path, *type, *env;
|
char *path, *type;
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
char buf[PATH_BUF_LEN];
|
char buf[PATH_BUF_LEN];
|
||||||
char tmpbuf[PATH_BUF_LEN];
|
char tmpbuf[PATH_BUF_LEN * 2];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vdev_name will be "root"/"root-0" for the root vdev, but it is the
|
* vdev_name will be "root"/"root-0" for the root vdev, but it is the
|
||||||
@ -4136,19 +4136,11 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
|||||||
if (zhp != NULL && strcmp(type, "root") == 0)
|
if (zhp != NULL && strcmp(type, "root") == 0)
|
||||||
return (zfs_strdup(hdl, zpool_get_name(zhp)));
|
return (zfs_strdup(hdl, zpool_get_name(zhp)));
|
||||||
|
|
||||||
env = getenv("ZPOOL_VDEV_NAME_PATH");
|
if (libzfs_envvar_is_set("ZPOOL_VDEV_NAME_PATH"))
|
||||||
if (env && (strtoul(env, NULL, 0) > 0 ||
|
|
||||||
!strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2)))
|
|
||||||
name_flags |= VDEV_NAME_PATH;
|
name_flags |= VDEV_NAME_PATH;
|
||||||
|
if (libzfs_envvar_is_set("ZPOOL_VDEV_NAME_GUID"))
|
||||||
env = getenv("ZPOOL_VDEV_NAME_GUID");
|
|
||||||
if (env && (strtoul(env, NULL, 0) > 0 ||
|
|
||||||
!strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2)))
|
|
||||||
name_flags |= VDEV_NAME_GUID;
|
name_flags |= VDEV_NAME_GUID;
|
||||||
|
if (libzfs_envvar_is_set("ZPOOL_VDEV_NAME_FOLLOW_LINKS"))
|
||||||
env = getenv("ZPOOL_VDEV_NAME_FOLLOW_LINKS");
|
|
||||||
if (env && (strtoul(env, NULL, 0) > 0 ||
|
|
||||||
!strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2)))
|
|
||||||
name_flags |= VDEV_NAME_FOLLOW_LINKS;
|
name_flags |= VDEV_NAME_FOLLOW_LINKS;
|
||||||
|
|
||||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, &value) == 0 ||
|
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, &value) == 0 ||
|
||||||
|
Loading…
Reference in New Issue
Block a user