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
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) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
26 */
27
28 /*
29 * Internal utility routines for the ZFS library.
30 */
31
32 #include <errno.h>
33 #include <fcntl.h>
34 #include <libintl.h>
35 #include <stdarg.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <strings.h>
39 #include <unistd.h>
40 #include <ctype.h>
41 #include <math.h>
42 #include <sys/mnttab.h>
43 #include <sys/mntent.h>
44 #include <sys/types.h>
45
945 (void) printf("%s", title);
946 else
947 (void) printf("%-*s ",
948 cbp->cb_colwidths[cbp->cb_columns[i]],
949 title);
950 }
951 }
952 (void) printf("\n");
953 }
954
955 /*
956 * Display a single line of output, according to the settings in the callback
957 * structure.
958 */
959 void
960 zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
961 const char *propname, const char *value, zprop_source_t sourcetype,
962 const char *source, const char *recvd_value)
963 {
964 int i;
965 const char *str;
966 char buf[128];
967
968 /*
969 * Ignore those source types that the user has chosen to ignore.
970 */
971 if ((sourcetype & cbp->cb_sources) == 0)
972 return;
973
974 if (cbp->cb_first)
975 zprop_print_headers(cbp, cbp->cb_type);
976
977 for (i = 0; i < ZFS_GET_NCOLS; i++) {
978 switch (cbp->cb_columns[i]) {
979 case GET_COL_NAME:
980 str = name;
981 break;
982
983 case GET_COL_PROPERTY:
984 str = propname;
985 break;
|
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
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) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
26 * Copyright 2014 RackTop Systems.
27 */
28
29 /*
30 * Internal utility routines for the ZFS library.
31 */
32
33 #include <errno.h>
34 #include <fcntl.h>
35 #include <libintl.h>
36 #include <stdarg.h>
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <strings.h>
40 #include <unistd.h>
41 #include <ctype.h>
42 #include <math.h>
43 #include <sys/mnttab.h>
44 #include <sys/mntent.h>
45 #include <sys/types.h>
46
946 (void) printf("%s", title);
947 else
948 (void) printf("%-*s ",
949 cbp->cb_colwidths[cbp->cb_columns[i]],
950 title);
951 }
952 }
953 (void) printf("\n");
954 }
955
956 /*
957 * Display a single line of output, according to the settings in the callback
958 * structure.
959 */
960 void
961 zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
962 const char *propname, const char *value, zprop_source_t sourcetype,
963 const char *source, const char *recvd_value)
964 {
965 int i;
966 const char *str = NULL;
967 char buf[128];
968
969 /*
970 * Ignore those source types that the user has chosen to ignore.
971 */
972 if ((sourcetype & cbp->cb_sources) == 0)
973 return;
974
975 if (cbp->cb_first)
976 zprop_print_headers(cbp, cbp->cb_type);
977
978 for (i = 0; i < ZFS_GET_NCOLS; i++) {
979 switch (cbp->cb_columns[i]) {
980 case GET_COL_NAME:
981 str = name;
982 break;
983
984 case GET_COL_PROPERTY:
985 str = propname;
986 break;
|