summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAlexander Eremin <a.eremin@nexenta.com>2012-03-05 13:42:51 +0300
committerAlexander Eremin <a.eremin@nexenta.com>2012-03-05 13:42:51 +0300
commit9b7d742f0ee8ff89c05a8b5275d11359920ec60f (patch)
treece07df701e4178578f42d0698115f3cd51b882dc /usr/src
parent686928d476b99b8b21fe0d4ae0ddcc1936cd0bd6 (diff)
downloadillumos-joyent-9b7d742f0ee8ff89c05a8b5275d11359920ec60f.tar.gz
2131 beadm list -a missing units designation
Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Gordon Ross <gwr@nexenta.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/beadm/beadm.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/usr/src/cmd/beadm/beadm.c b/usr/src/cmd/beadm/beadm.c
index 5be10c10d7..ff986563ce 100644
--- a/usr/src/cmd/beadm/beadm.c
+++ b/usr/src/cmd/beadm/beadm.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -88,8 +88,7 @@ enum be_fmt {
BE_FMT_DEFAULT,
BE_FMT_DATASET,
BE_FMT_SNAPSHOT,
- BE_FMT_ALL,
- BE_NUM_FMTS
+ BE_FMT_ALL
};
/*
@@ -116,8 +115,6 @@ static const be_command_t be_command_tbl[] = {
{ NULL, NULL },
};
-static struct hdr_info hdrs[BE_NUM_FMTS] = { 0 };
-
static void
usage(void)
{
@@ -358,21 +355,13 @@ count_widths(enum be_fmt be_fmt, struct hdr_info *hdr, be_node_list_t *be_nodes)
}
static void
-print_be_nodes(const char *be_name, boolean_t parsable, be_node_list_t *nodes)
+print_be_nodes(const char *be_name, boolean_t parsable, struct hdr_info *hdr,
+ be_node_list_t *nodes)
{
char buf[64];
char datetime[DT_BUF_LEN];
- struct hdr_info *hdr = NULL;
- enum be_fmt be_fmt = BE_FMT_DEFAULT;
be_node_list_t *cur_be;
- if (!parsable) {
- hdr = hdrs;
- init_hdr_cols(be_fmt, hdr);
- count_widths(be_fmt, hdr, nodes);
- print_hdr(hdr);
- }
-
for (cur_be = nodes; cur_be != NULL; cur_be = cur_be->be_next_node) {
char active[3] = "-\0";
int ai = 0;
@@ -488,20 +477,12 @@ print_be_snapshots(be_node_list_t *be, struct hdr_info *hdr, boolean_t parsable)
static void
print_fmt_nodes(const char *be_name, enum be_fmt be_fmt, boolean_t parsable,
- be_node_list_t *nodes)
+ struct hdr_info *hdr, be_node_list_t *nodes)
{
char buf[64];
char datetime[DT_BUF_LEN];
- struct hdr_info *hdr = NULL;
be_node_list_t *cur_be;
- hdr = hdrs + be_fmt;
- init_hdr_cols(be_fmt, hdr);
- count_widths(be_fmt, hdr, nodes);
-
- if (!parsable)
- print_hdr(hdr);
-
for (cur_be = nodes; cur_be != NULL; cur_be = cur_be->be_next_node) {
char active[3] = "-\0";
int ai = 0;
@@ -559,6 +540,7 @@ static void
print_nodes(const char *be_name, boolean_t dsets, boolean_t snaps,
boolean_t parsable, be_node_list_t *be_nodes)
{
+ struct hdr_info hdr;
enum be_fmt be_fmt = BE_FMT_DEFAULT;
if (dsets)
@@ -566,10 +548,16 @@ print_nodes(const char *be_name, boolean_t dsets, boolean_t snaps,
if (snaps)
be_fmt |= BE_FMT_SNAPSHOT;
+ if (!parsable) {
+ init_hdr_cols(be_fmt, &hdr);
+ count_widths(be_fmt, &hdr, be_nodes);
+ print_hdr(&hdr);
+ }
+
if (be_fmt == BE_FMT_DEFAULT)
- print_be_nodes(be_name, parsable, be_nodes);
+ print_be_nodes(be_name, parsable, &hdr, be_nodes);
else
- print_fmt_nodes(be_name, be_fmt, parsable, be_nodes);
+ print_fmt_nodes(be_name, be_fmt, parsable, &hdr, be_nodes);
}
static boolean_t