beadm.c (40ccc6ad48401a6fe660d7d49d6f60e9320403c9) beadm.c (4adca7e7219d20c7ca20933b5006222e781ff0e9)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

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

20 */
21
22/*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26/*
27 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

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

20 */
21
22/*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26/*
27 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
28 * Copyright 2015 Toomas Soome <tsoome@me.com>
28 */
29
30/*
31 * System includes
32 */
33
34#include <assert.h>
35#include <stdio.h>

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

126 "\tbeadm activate [-v] beName\n"
127 "\tbeadm create [-a] [-d BE_desc]\n"
128 "\t\t[-o property=value] ... [-p zpool] \n"
129 "\t\t[-e nonActiveBe | beName@snapshot] [-v] beName\n"
130 "\tbeadm create [-d BE_desc]\n"
131 "\t\t[-o property=value] ... [-p zpool] [-v] beName@snapshot\n"
132 "\tbeadm destroy [-Ffsv] beName \n"
133 "\tbeadm destroy [-Fv] beName@snapshot \n"
29 */
30
31/*
32 * System includes
33 */
34
35#include <assert.h>
36#include <stdio.h>

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

127 "\tbeadm activate [-v] beName\n"
128 "\tbeadm create [-a] [-d BE_desc]\n"
129 "\t\t[-o property=value] ... [-p zpool] \n"
130 "\t\t[-e nonActiveBe | beName@snapshot] [-v] beName\n"
131 "\tbeadm create [-d BE_desc]\n"
132 "\t\t[-o property=value] ... [-p zpool] [-v] beName@snapshot\n"
133 "\tbeadm destroy [-Ffsv] beName \n"
134 "\tbeadm destroy [-Fv] beName@snapshot \n"
134 "\tbeadm list [[-a] | [-d] [-s]] [-H] [-v] [beName]\n"
135 "\tbeadm list [[-a] | [-d] [-s]] [-H]\n"
136 "\t\t[-k|-K date | name | space] [-v] [beName]\n"
135 "\tbeadm mount [-s ro|rw] [-v] beName [mountpoint]\n"
136 "\tbeadm unmount [-fv] beName | mountpoint\n"
137 "\tbeadm umount [-fv] beName | mountpoint\n"
138 "\tbeadm rename [-v] origBeName newBeName\n"
139 "\tbeadm rollback [-v] beName snapshot\n"
140 "\tbeadm rollback [-v] beName@snapshot\n"));
141}
142

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

1080 be_node_list_t *be_nodes = NULL;
1081 boolean_t all = B_FALSE;
1082 boolean_t dsets = B_FALSE;
1083 boolean_t snaps = B_FALSE;
1084 boolean_t parsable = B_FALSE;
1085 int err = 1;
1086 int c = 0;
1087 char *be_name = NULL;
137 "\tbeadm mount [-s ro|rw] [-v] beName [mountpoint]\n"
138 "\tbeadm unmount [-fv] beName | mountpoint\n"
139 "\tbeadm umount [-fv] beName | mountpoint\n"
140 "\tbeadm rename [-v] origBeName newBeName\n"
141 "\tbeadm rollback [-v] beName snapshot\n"
142 "\tbeadm rollback [-v] beName@snapshot\n"));
143}
144

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

1082 be_node_list_t *be_nodes = NULL;
1083 boolean_t all = B_FALSE;
1084 boolean_t dsets = B_FALSE;
1085 boolean_t snaps = B_FALSE;
1086 boolean_t parsable = B_FALSE;
1087 int err = 1;
1088 int c = 0;
1089 char *be_name = NULL;
1090 be_sort_t order = BE_SORT_UNSPECIFIED;
1088
1091
1089 while ((c = getopt(argc, argv, "adsvH")) != -1) {
1092 while ((c = getopt(argc, argv, "adk:svHK:")) != -1) {
1090 switch (c) {
1091 case 'a':
1092 all = B_TRUE;
1093 break;
1094 case 'd':
1095 dsets = B_TRUE;
1096 break;
1093 switch (c) {
1094 case 'a':
1095 all = B_TRUE;
1096 break;
1097 case 'd':
1098 dsets = B_TRUE;
1099 break;
1100 case 'k':
1101 case 'K':
1102 if (order != BE_SORT_UNSPECIFIED) {
1103 (void) fprintf(stderr, _("Sort key can be "
1104 "specified only once.\n"));
1105 usage();
1106 return (1);
1107 }
1108 if (strcmp(optarg, "date") == 0) {
1109 if (c == 'k')
1110 order = BE_SORT_DATE;
1111 else
1112 order = BE_SORT_DATE_REV;
1113 break;
1114 }
1115 if (strcmp(optarg, "name") == 0) {
1116 if (c == 'k')
1117 order = BE_SORT_NAME;
1118 else
1119 order = BE_SORT_NAME_REV;
1120 break;
1121 }
1122 if (strcmp(optarg, "space") == 0) {
1123 if (c == 'k')
1124 order = BE_SORT_SPACE;
1125 else
1126 order = BE_SORT_SPACE_REV;
1127 break;
1128 }
1129 (void) fprintf(stderr, _("Unknown sort key: %s\n"),
1130 optarg);
1131 usage();
1132 return (1);
1097 case 's':
1098 snaps = B_TRUE;
1099 break;
1100 case 'v':
1101 libbe_print_errors(B_TRUE);
1102 break;
1103 case 'H':
1104 parsable = B_TRUE;

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

1133
1134 if (argc == 1)
1135 be_name = argv[0];
1136
1137 err = be_list(be_name, &be_nodes);
1138
1139 switch (err) {
1140 case BE_SUCCESS:
1133 case 's':
1134 snaps = B_TRUE;
1135 break;
1136 case 'v':
1137 libbe_print_errors(B_TRUE);
1138 break;
1139 case 'H':
1140 parsable = B_TRUE;

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

1169
1170 if (argc == 1)
1171 be_name = argv[0];
1172
1173 err = be_list(be_name, &be_nodes);
1174
1175 switch (err) {
1176 case BE_SUCCESS:
1177 /* the default sort is ascending date, no need to sort twice */
1178 if (order == BE_SORT_UNSPECIFIED)
1179 order = BE_SORT_DATE;
1180
1181 if (order != BE_SORT_DATE)
1182 be_sort(&be_nodes, order);
1183
1141 print_nodes(be_name, dsets, snaps, parsable, be_nodes);
1142 break;
1143 case BE_ERR_BE_NOENT:
1144 if (be_name == NULL)
1145 (void) fprintf(stderr, _("No boot environments found "
1146 "on this system.\n"));
1147 else {
1148 (void) fprintf(stderr, _("%s does not exist or appear "

--- 376 unchanged lines hidden ---
1184 print_nodes(be_name, dsets, snaps, parsable, be_nodes);
1185 break;
1186 case BE_ERR_BE_NOENT:
1187 if (be_name == NULL)
1188 (void) fprintf(stderr, _("No boot environments found "
1189 "on this system.\n"));
1190 else {
1191 (void) fprintf(stderr, _("%s does not exist or appear "

--- 376 unchanged lines hidden ---