aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-07-25 16:00:48 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-07-25 16:00:48 +0000
commit734e362fa1a843128dc1f437ef16427084cdf46f (patch)
tree0ac21bab705d0fe2be33e25e04a5d0b503a076ec /lib
parent4831c931dd0f2f854971c62921f29710037a7e7e (diff)
downloadsrc-734e362fa1a843128dc1f437ef16427084cdf46f.tar.gz
src-734e362fa1a843128dc1f437ef16427084cdf46f.zip
libbe(3)/bectl(8): Provide and use proper alloc/free for property lists
Notes
Notes: svn path=/projects/bectl/; revision=336715
Diffstat (limited to 'lib')
-rw-r--r--lib/libbe/be.h1
-rw-r--r--lib/libbe/be_info.c7
-rw-r--r--lib/libbe/libbe.38
3 files changed, 16 insertions, 0 deletions
diff --git a/lib/libbe/be.h b/lib/libbe/be.h
index 1b3218c206a4..f532718b81d6 100644
--- a/lib/libbe/be.h
+++ b/lib/libbe/be.h
@@ -67,6 +67,7 @@ const char *be_nextboot_path(libbe_handle_t *);
const char *be_root_path(libbe_handle_t *);
int be_get_bootenv_props(libbe_handle_t *, nvlist_t *);
+int be_prop_list_alloc(nvlist_t **be_list);
void be_prop_list_free(nvlist_t *be_list);
int be_activate(libbe_handle_t *, char *, bool);
diff --git a/lib/libbe/be_info.c b/lib/libbe/be_info.c
index 3f638163a783..7cb014086db0 100644
--- a/lib/libbe/be_info.c
+++ b/lib/libbe/be_info.c
@@ -207,6 +207,13 @@ prop_list_builder(prop_data_t *data)
}
+int
+be_prop_list_alloc(nvlist_t **be_list)
+{
+
+ return (nvlist_alloc(be_list, NV_UNIQUE_NAME, KM_SLEEP));
+}
+
/*
* frees property list and its children
*/
diff --git a/lib/libbe/libbe.3 b/lib/libbe/libbe.3
index 2ddb2b0a0c58..db94dca78467 100644
--- a/lib/libbe/libbe.3
+++ b/lib/libbe/libbe.3
@@ -129,6 +129,14 @@ of state to be retained, such as errors from previous operations.
.Ft int
.Fn be_add_child "libbe_handle_t *, char *, bool" ;
.Pp
+.Ft int
+.Fn be_prop_list_alloc "nvlist_t **" ;
+.Pp
+.Ft int
+.Fn be_get_bootenv_props "libbe_handle_t *, nvlist_t *" ;
+.Pp
+.Ft void
+.Fn be_prop_list_free "nvlist_t *" ;
.\" .Ft void
.\" .Fn mp_mfree "MINT *mp" ;
.\" .Bd -ragged -offset indent