socsvn commit: r324008 - soc2017/kneitinger/libbe-head/lib/libbe
kneitinger at FreeBSD.org
kneitinger at FreeBSD.org
Tue Jun 27 04:22:22 UTC 2017
Author: kneitinger
Date: Tue Jun 27 04:22:20 2017
New Revision: 324008
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=324008
Log:
Add libbe functions for getting the name/path oft he active bootenv, and the
path of the root bootenv dataset
Modified:
soc2017/kneitinger/libbe-head/lib/libbe/be.c
soc2017/kneitinger/libbe-head/lib/libbe/be.h
Modified: soc2017/kneitinger/libbe-head/lib/libbe/be.c
==============================================================================
--- soc2017/kneitinger/libbe-head/lib/libbe/be.c Tue Jun 27 03:57:31 2017 (r324007)
+++ soc2017/kneitinger/libbe-head/lib/libbe/be.c Tue Jun 27 04:22:20 2017 (r324008)
@@ -128,3 +128,35 @@
libzfs_fini(lbh->lzh);
free(lbh);
}
+
+
+/*
+ * Returns the name of the active boot environment
+ */
+const char *
+be_get_active_name(libbe_handle_t *lbh)
+{
+ const char *full_path = zfs_get_name(lbh->be_active);
+
+ return (strrchr(full_path, '/') + 1);
+}
+
+
+/*
+ * Returns full path of the active boot environment
+ */
+const char *
+be_get_active_path(libbe_handle_t *lbh)
+{
+ return (zfs_get_name(lbh->be_active));
+}
+
+
+/*
+ * Returns the path of the boot environment root dataset
+ */
+const char *
+be_get_root_path(libbe_handle_t *lbh)
+{
+ return (zfs_get_name(lbh->be_root));
+}
Modified: soc2017/kneitinger/libbe-head/lib/libbe/be.h
==============================================================================
--- soc2017/kneitinger/libbe-head/lib/libbe/be.h Tue Jun 27 03:57:31 2017 (r324007)
+++ soc2017/kneitinger/libbe-head/lib/libbe/be.h Tue Jun 27 04:22:20 2017 (r324008)
@@ -56,6 +56,13 @@
libbe_handle_t *libbe_init(void);
void libbe_close(libbe_handle_t *);
+/* Bootenv information functions */
+const char *be_get_active_name(libbe_handle_t *);
+const char *be_get_active_path(libbe_handle_t *);
+const char *be_get_root_path(libbe_handle_t *);
+
+/* Bootenv manipulation functions */
+
/* Error related functions */
int libbe_errno(libbe_handle_t *);
More information about the svn-soc-all
mailing list