bectl.c (b29bf2f84ea838b1b7dad4e80858b637395930ae) bectl.c (734e362fa1a843128dc1f437ef16427084cdf46f)
1/*
2 * be.c
3 *
4 * Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 14 unchanged lines hidden (view full) ---

23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/param.h>
30#include <sys/jail.h>
1/*
2 * be.c
3 *
4 * Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 14 unchanged lines hidden (view full) ---

23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/param.h>
30#include <sys/jail.h>
31#include <sys/malloc.h>
32#include <sys/mount.h>
33#include <errno.h>
34#include <stdbool.h>
35#include <stdio.h>
36#include <stdint.h>
37#include <stdlib.h>
38#include <string.h>
39#include <sysexits.h>

--- 373 unchanged lines hidden (view full) ---

413
414static int
415bectl_cmd_list(int argc, char *argv[])
416{
417 nvlist_t *props;
418 int opt;
419 bool show_all_datasets, show_space, hide_headers, show_snaps;
420
31#include <sys/mount.h>
32#include <errno.h>
33#include <stdbool.h>
34#include <stdio.h>
35#include <stdint.h>
36#include <stdlib.h>
37#include <string.h>
38#include <sysexits.h>

--- 373 unchanged lines hidden (view full) ---

412
413static int
414bectl_cmd_list(int argc, char *argv[])
415{
416 nvlist_t *props;
417 int opt;
418 bool show_all_datasets, show_space, hide_headers, show_snaps;
419
420 props = NULL;
421 show_all_datasets = show_space = hide_headers = show_snaps = false;
422 while ((opt = getopt(argc, argv, "aDHs")) != -1) {
423 switch (opt) {
424 case 'a':
425 show_all_datasets = true;
426 break;
427 case 'D':
428 show_space = true;

--- 14 unchanged lines hidden (view full) ---

443 argc -= optind;
444
445 if (argc != 0) {
446 fprintf(stderr, "bectl list: extra argument provided\n");
447 return (usage(false));
448 }
449
450
421 show_all_datasets = show_space = hide_headers = show_snaps = false;
422 while ((opt = getopt(argc, argv, "aDHs")) != -1) {
423 switch (opt) {
424 case 'a':
425 show_all_datasets = true;
426 break;
427 case 'D':
428 show_space = true;

--- 14 unchanged lines hidden (view full) ---

443 argc -= optind;
444
445 if (argc != 0) {
446 fprintf(stderr, "bectl list: extra argument provided\n");
447 return (usage(false));
448 }
449
450
451 if (nvlist_alloc(&props, NV_UNIQUE_NAME, M_WAITOK) != 0) {
451 if (be_prop_list_alloc(&props) != 0) {
452 fprintf(stderr, "bectl list: failed to allocate prop nvlist\n");
453 return (1);
454 }
455 if (be_get_bootenv_props(be, props) != 0) {
456 /* XXX TODO: Real errors */
457 fprintf(stderr, "bectl list: failed to fetch boot environments\n");
458 return (1);
459 }
460
461 dump_nvlist(props, 0);
452 fprintf(stderr, "bectl list: failed to allocate prop nvlist\n");
453 return (1);
454 }
455 if (be_get_bootenv_props(be, props) != 0) {
456 /* XXX TODO: Real errors */
457 fprintf(stderr, "bectl list: failed to fetch boot environments\n");
458 return (1);
459 }
460
461 dump_nvlist(props, 0);
462 nvlist_free(props);
462 be_prop_list_free(props);
463
464 return (0);
465}
466
467
468static int
469bectl_cmd_mount(int argc, char *argv[])
470{

--- 190 unchanged lines hidden ---
463
464 return (0);
465}
466
467
468static int
469bectl_cmd_mount(int argc, char *argv[])
470{

--- 190 unchanged lines hidden ---