Print this page
*** NO COMMENTS ***


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  28  */
  29 
  30 /*
  31  * System includes
  32  */
  33 
  34 #include <assert.h>
  35 #include <stdio.h>
  36 #include <strings.h>
  37 #include <libzfs.h>
  38 #include <locale.h>
  39 #include <langinfo.h>
  40 #include <stdlib.h>
  41 #include <wchar.h>
  42 #include <sys/types.h>
  43 
  44 #include "libbe.h"
  45 
  46 #ifndef lint
  47 #define _(x) gettext(x)


 369                 const char *name = cur_be->be_node_name;
 370                 const char *mntpt = cur_be->be_mntpt;
 371                 be_snapshot_list_t *snap = NULL;
 372                 uint64_t used = cur_be->be_space_used;
 373                 time_t creation = cur_be->be_node_creation;
 374                 struct tm *tm;
 375 
 376                 if (be_name != NULL && strcmp(be_name, name) != 0)
 377                         continue;
 378 
 379                 if (parsable)
 380                         active[0] = '\0';
 381 
 382                 tm = localtime(&creation);
 383                 (void) strftime(datetime, DT_BUF_LEN, datetime_fmt, tm);
 384 
 385                 for (snap = cur_be->be_node_snapshots; snap != NULL;
 386                     snap = snap->be_next_snapshot)
 387                         used += snap->be_snapshot_space_used;
 388 



 389                 if (cur_be->be_active)
 390                         active[ai++] = 'N';
 391                 if (cur_be->be_active_on_boot)



 392                         active[ai] = 'R';

 393 
 394                 nicenum(used, buf, sizeof (buf));
 395                 if (parsable)
 396                         (void) printf("%s;%s;%s;%s;%llu;%s;%ld\n",
 397                             name,
 398                             cur_be->be_uuid_str,
 399                             active,
 400                             (cur_be->be_mounted ? mntpt: ""),
 401                             used,
 402                             cur_be->be_policy_type,
 403                             creation);
 404                 else
 405                         (void) printf("%-*s %-*s %-*s %-*s %-*s %-*s\n",
 406                             hdr->cols[0].width, name,
 407                             hdr->cols[1].width, active,
 408                             hdr->cols[2].width, (cur_be->be_mounted ? mntpt:
 409                             "-"),
 410                             hdr->cols[3].width, buf,
 411                             hdr->cols[4].width, cur_be->be_policy_type,
 412                             hdr->cols[5].width, datetime);




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  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  */
  29 
  30 /*
  31  * System includes
  32  */
  33 
  34 #include <assert.h>
  35 #include <stdio.h>
  36 #include <strings.h>
  37 #include <libzfs.h>
  38 #include <locale.h>
  39 #include <langinfo.h>
  40 #include <stdlib.h>
  41 #include <wchar.h>
  42 #include <sys/types.h>
  43 
  44 #include "libbe.h"
  45 
  46 #ifndef lint
  47 #define _(x) gettext(x)


 369                 const char *name = cur_be->be_node_name;
 370                 const char *mntpt = cur_be->be_mntpt;
 371                 be_snapshot_list_t *snap = NULL;
 372                 uint64_t used = cur_be->be_space_used;
 373                 time_t creation = cur_be->be_node_creation;
 374                 struct tm *tm;
 375 
 376                 if (be_name != NULL && strcmp(be_name, name) != 0)
 377                         continue;
 378 
 379                 if (parsable)
 380                         active[0] = '\0';
 381 
 382                 tm = localtime(&creation);
 383                 (void) strftime(datetime, DT_BUF_LEN, datetime_fmt, tm);
 384 
 385                 for (snap = cur_be->be_node_snapshots; snap != NULL;
 386                     snap = snap->be_next_snapshot)
 387                         used += snap->be_snapshot_space_used;
 388 
 389                 if (!cur_be->be_global_active)
 390                         active[ai++] = 'x';
 391 
 392                 if (cur_be->be_active)
 393                         active[ai++] = 'N';
 394                 if (cur_be->be_active_on_boot) {
 395                         if (!cur_be->be_global_active)
 396                                 active[ai] = 'b';
 397                         else
 398                                 active[ai] = 'R';
 399                 }
 400 
 401                 nicenum(used, buf, sizeof (buf));
 402                 if (parsable)
 403                         (void) printf("%s;%s;%s;%s;%llu;%s;%ld\n",
 404                             name,
 405                             cur_be->be_uuid_str,
 406                             active,
 407                             (cur_be->be_mounted ? mntpt: ""),
 408                             used,
 409                             cur_be->be_policy_type,
 410                             creation);
 411                 else
 412                         (void) printf("%-*s %-*s %-*s %-*s %-*s %-*s\n",
 413                             hdr->cols[0].width, name,
 414                             hdr->cols[1].width, active,
 415                             hdr->cols[2].width, (cur_be->be_mounted ? mntpt:
 416                             "-"),
 417                             hdr->cols[3].width, buf,
 418                             hdr->cols[4].width, cur_be->be_policy_type,
 419                             hdr->cols[5].width, datetime);