diff options
Diffstat (limited to 'usr/src/lib/libzfs/common')
| -rw-r--r-- | usr/src/lib/libzfs/common/libzfs.h | 2 | ||||
| -rw-r--r-- | usr/src/lib/libzfs/common/libzfs_pool.c | 36 | ||||
| -rw-r--r-- | usr/src/lib/libzfs/common/mapfile-vers | 2 | 
3 files changed, 38 insertions, 2 deletions
| diff --git a/usr/src/lib/libzfs/common/libzfs.h b/usr/src/lib/libzfs/common/libzfs.h index bdc24ac6ef..f69cb861c4 100644 --- a/usr/src/lib/libzfs/common/libzfs.h +++ b/usr/src/lib/libzfs/common/libzfs.h @@ -823,6 +823,8 @@ extern int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **,   * Label manipulation.   */  extern int zpool_clear_label(int); +extern int zpool_set_bootenv(zpool_handle_t *, const nvlist_t *); +extern int zpool_get_bootenv(zpool_handle_t *, nvlist_t **);  /* is this zvol valid for use as a dump device? */  extern int zvol_check_dump_config(char *); diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c index c3603884b6..e56628e2be 100644 --- a/usr/src/lib/libzfs/common/libzfs_pool.c +++ b/usr/src/lib/libzfs/common/libzfs_pool.c @@ -21,7 +21,7 @@  /*   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2020 by Delphix. All rights reserved.   * Copyright 2019 Joyent, Inc.   * Copyright 2016 Nexenta Systems, Inc.   * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com> @@ -397,7 +397,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,   * Assuming bootfs is a valid dataset name.   */  static boolean_t -bootfs_name_valid(const char *pool, char *bootfs) +bootfs_name_valid(const char *pool, const char *bootfs)  {  	int len = strlen(pool);  	if (bootfs[0] == '\0') @@ -4414,6 +4414,38 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,  	free(mntpnt);  } +int +zpool_set_bootenv(zpool_handle_t *zhp, const nvlist_t *envmap) +{ +	int error = lzc_set_bootenv(zhp->zpool_name, envmap); +	if (error != 0) { +		(void) zpool_standard_error_fmt(zhp->zpool_hdl, error, +		    dgettext(TEXT_DOMAIN, +		    "error setting bootenv in pool '%s'"), zhp->zpool_name); +	} + +	return (error); +} + +int +zpool_get_bootenv(zpool_handle_t *zhp, nvlist_t **nvlp) +{ +	nvlist_t *nvl; +	int error; + +	nvl = NULL; +	error = lzc_get_bootenv(zhp->zpool_name, &nvl); +	if (error != 0) { +		(void) zpool_standard_error_fmt(zhp->zpool_hdl, error, +		    dgettext(TEXT_DOMAIN, +		    "error getting bootenv in pool '%s'"), zhp->zpool_name); +	} else { +		*nvlp = nvl; +	} + +	return (error); +} +  /*   * Read the EFI label from the config, if a label does not exist then   * pass back the error to the caller. If the caller has passed a non-NULL diff --git a/usr/src/lib/libzfs/common/mapfile-vers b/usr/src/lib/libzfs/common/mapfile-vers index 5ad0f9d4eb..0174e1a3f3 100644 --- a/usr/src/lib/libzfs/common/mapfile-vers +++ b/usr/src/lib/libzfs/common/mapfile-vers @@ -205,6 +205,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {  	zpool_find_vdev;  	zpool_find_vdev_by_physpath;  	zpool_fru_set; +	zpool_get_bootenv;  	zpool_get_config;  	zpool_get_errlog;  	zpool_get_features; @@ -244,6 +245,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {  	zpool_reguid;  	zpool_reopen;  	zpool_scan; +	zpool_set_bootenv;  	zpool_set_prop;  	zpool_skip_pool;  	zpool_state_to_name; | 
