Mercurial > illumos > illumos-gate
changeset 13633:7d8ad953b304
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>
author | Alexander Eremin <a.eremin@nexenta.com> |
---|---|
date | Mon, 05 Mar 2012 13:42:51 +0300 |
parents | ab0e9bcbdf3e |
children | 44267816c977 |
files | usr/src/cmd/beadm/beadm.c |
diffstat | 1 files changed, 14 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/beadm/beadm.c Tue Jun 21 04:40:44 2011 -0700 +++ b/usr/src/cmd/beadm/beadm.c Mon Mar 05 13:42:51 2012 +0300 @@ -24,7 +24,7 @@ */ /* - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. */ /* @@ -88,8 +88,7 @@ BE_FMT_DEFAULT, BE_FMT_DATASET, BE_FMT_SNAPSHOT, - BE_FMT_ALL, - BE_NUM_FMTS + BE_FMT_ALL }; /* @@ -116,8 +115,6 @@ { NULL, NULL }, }; -static struct hdr_info hdrs[BE_NUM_FMTS] = { 0 }; - static void usage(void) { @@ -358,21 +355,13 @@ } 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 @@ 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 @@ 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 @@ 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