libbe(3)/bectl(8): Kill off the 'add' functionality for now
The mostly-undocumented 'add' functionality, from initial read-through, is intended for construction of deep ("bdrewery style") boot environments. However, it's mostly broken at this point. `#if SOON` it out on both sides so that we're not exposing a broken API/feature. Work will resume on it in due time.
This commit is contained in:
parent
c4b7f80c48
commit
92afc1f6f9
@ -44,9 +44,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include "be.h"
|
||||
#include "be_impl.h"
|
||||
|
||||
#if SOON
|
||||
static int be_create_child_noent(libbe_handle_t *lbh, const char *active,
|
||||
const char *child_path);
|
||||
static int be_create_child_cloned(libbe_handle_t *lbh, const char *active);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Iterator function for locating the rootfs amongst the children of the
|
||||
@ -725,6 +727,7 @@ be_import(libbe_handle_t *lbh, const char *bootenv, int fd)
|
||||
return (be_destroy(lbh, nbuf, 0));
|
||||
}
|
||||
|
||||
#if SOON
|
||||
static int
|
||||
be_create_child_noent(libbe_handle_t *lbh, const char *active,
|
||||
const char *child_path)
|
||||
@ -778,7 +781,7 @@ be_create_child_noent(libbe_handle_t *lbh, const char *active,
|
||||
static int
|
||||
be_create_child_cloned(libbe_handle_t *lbh, const char *active)
|
||||
{
|
||||
char buf[BE_MAXPATHLEN];
|
||||
char buf[BE_MAXPATHLEN], tmp[BE_MAXPATHLEN];;
|
||||
zfs_handle_t *zfs;
|
||||
int err;
|
||||
|
||||
@ -788,10 +791,12 @@ be_create_child_cloned(libbe_handle_t *lbh, const char *active)
|
||||
* Establish if the existing path is a zfs dataset or just
|
||||
* the subdirectory of one
|
||||
*/
|
||||
strlcpy(buf, "/tmp/be_snap.XXXXX", sizeof(buf));
|
||||
if (mktemp(buf) == NULL)
|
||||
strlcpy(tmp, "tmp/be_snap.XXXXX", sizeof(tmp));
|
||||
if (mktemp(tmp) == NULL)
|
||||
return (set_error(lbh, BE_ERR_UNKNOWN));
|
||||
|
||||
be_root_concat(lbh, tmp, buf);
|
||||
printf("Here %s?\n", buf);
|
||||
if ((err = zfs_snapshot(lbh->lzh, buf, false, NULL)) != 0) {
|
||||
switch (err) {
|
||||
case EZFS_INVALIDNAME:
|
||||
@ -865,6 +870,7 @@ be_add_child(libbe_handle_t *lbh, const char *child_path, bool cp_if_exists)
|
||||
return (be_create_child_cloned(lbh, active));
|
||||
return (set_error(lbh, BE_ERR_EXISTS));
|
||||
}
|
||||
#endif /* SOON */
|
||||
|
||||
static int
|
||||
be_set_nextboot(libbe_handle_t *lbh, nvlist_t *config, uint64_t pool_guid,
|
||||
|
@ -123,7 +123,9 @@ bool be_exists(libbe_handle_t *, char *);
|
||||
int be_export(libbe_handle_t *, const char *, int fd);
|
||||
int be_import(libbe_handle_t *, const char *, int fd);
|
||||
|
||||
#if SOON
|
||||
int be_add_child(libbe_handle_t *, const char *, bool);
|
||||
#endif
|
||||
void be_nicenum(uint64_t num, char *buf, size_t buflen);
|
||||
|
||||
#endif /* _LIBBE_H */
|
||||
|
@ -51,7 +51,9 @@ static int bectl_cmd_create(int argc, char *argv[]);
|
||||
static int bectl_cmd_destroy(int argc, char *argv[]);
|
||||
static int bectl_cmd_export(int argc, char *argv[]);
|
||||
static int bectl_cmd_import(int argc, char *argv[]);
|
||||
#if SOON
|
||||
static int bectl_cmd_add(int argc, char *argv[]);
|
||||
#endif
|
||||
static int bectl_cmd_mount(int argc, char *argv[]);
|
||||
static int bectl_cmd_rename(int argc, char *argv[]);
|
||||
static int bectl_cmd_unmount(int argc, char *argv[]);
|
||||
@ -72,7 +74,9 @@ usage(bool explicit)
|
||||
"\tbectl destroy [-F] beName | beName@snapshot⟩\n"
|
||||
"\tbectl export sourceBe\n"
|
||||
"\tbectl import targetBe\n"
|
||||
#if SOON
|
||||
"\tbectl add (path)*\n"
|
||||
#endif
|
||||
"\tbectl jail [ -o key=value | -u key ]... bootenv\n"
|
||||
"\tbectl list [-a] [-D] [-H] [-s]\n"
|
||||
"\tbectl mount beName [mountpoint]\n"
|
||||
@ -100,7 +104,9 @@ static struct command_map_entry command_map[] =
|
||||
{ "destroy", bectl_cmd_destroy },
|
||||
{ "export", bectl_cmd_export },
|
||||
{ "import", bectl_cmd_import },
|
||||
#if SOON
|
||||
{ "add", bectl_cmd_add },
|
||||
#endif
|
||||
{ "jail", bectl_cmd_jail },
|
||||
{ "list", bectl_cmd_list },
|
||||
{ "mount", bectl_cmd_mount },
|
||||
@ -295,7 +301,7 @@ bectl_cmd_import(int argc, char *argv[])
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
||||
#if SOON
|
||||
static int
|
||||
bectl_cmd_add(int argc, char *argv[])
|
||||
{
|
||||
@ -313,7 +319,7 @@ bectl_cmd_add(int argc, char *argv[])
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
bectl_cmd_destroy(int argc, char *argv[])
|
||||
|
Loading…
x
Reference in New Issue
Block a user