Date: Tue, 27 Jun 2017 04:22:21 GMT From: kneitinger@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r324008 - soc2017/kneitinger/libbe-head/lib/libbe Message-ID: <201706270422.v5R4MLe6047243@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706270422.v5R4MLe6047243>
