1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * This file and its contents are supplied under the terms of the 4 * Common Development and Distribution License ("CDDL"), version 1.0. 5 * You may only use this file in accordance with the terms of version 6 * 1.0 of the CDDL. 7 * 8 * A full copy of the text of the CDDL should have accompanied this 9 * source. A copy of the CDDL is also available via the Internet at 10 * http://www.illumos.org/license/CDDL. 11 */ 12 /* 13 * Copyright 2020 Toomas Soome <tsoome@me.com> 14 */ 15 16 #include <sys/types.h> 17 #include <string.h> 18 #include <libzfs.h> 19 #include <libzfsbootenv.h> 20 21 /* 22 * Output bootenv information. 23 */ 24 int lzbe_bootenv_print(const char * pool,const char * nvlist,FILE * of)25lzbe_bootenv_print(const char *pool, const char *nvlist, FILE *of) 26 { 27 nvlist_t *nv; 28 int rv = -1; 29 30 if (pool == NULL || *pool == '\0' || of == NULL) 31 return (rv); 32 33 rv = lzbe_nvlist_get(pool, nvlist, (void **)&nv); 34 if (rv == 0) { 35 nvlist_print(of, nv); 36 nvlist_free(nv); 37 } 38 39 return (rv); 40 } 41