diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2018-11-19 02:12:08 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2018-11-19 02:12:08 +0000 |
commit | cc624025b462a013629c52adc7db6adacf2d42f8 (patch) | |
tree | 958608b250d507458baae2b710d372f7567f7346 /lib/libbe/be_info.c | |
parent | 2a24f4d91173a900eb3a8ad21b2a1549d9979e33 (diff) | |
download | src-cc624025b462a013629c52adc7db6adacf2d42f8.tar.gz src-cc624025b462a013629c52adc7db6adacf2d42f8.zip |
bectl(3)/libbe(3): Allow BE root to be specified
Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:
- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
since it defaults to the rootfs and cross-pool cloning doesn't work like
that (IIRC)
Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.
bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt
this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18029
Notes
Notes:
svn path=/head/; revision=340592
Diffstat (limited to 'lib/libbe/be_info.c')
-rw-r--r-- | lib/libbe/be_info.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libbe/be_info.c b/lib/libbe/be_info.c index 8a6038009b82..e8869e6f94c8 100644 --- a/lib/libbe/be_info.c +++ b/lib/libbe/be_info.c @@ -42,7 +42,10 @@ const char * be_active_name(libbe_handle_t *lbh) { - return (strrchr(lbh->rootfs, '/') + sizeof(char)); + if (*lbh->rootfs != '\0') + return (strrchr(lbh->rootfs, '/') + sizeof(char)); + else + return (lbh->rootfs); } @@ -63,7 +66,10 @@ const char * be_nextboot_name(libbe_handle_t *lbh) { - return (strrchr(lbh->bootfs, '/') + sizeof(char)); + if (*lbh->bootfs != '\0') + return (strrchr(lbh->bootfs, '/') + sizeof(char)); + else + return (lbh->bootfs); } |