Deleted Added
full compact
libzfs_dataset.c (256281) libzfs_dataset.c (263405)
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

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

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 by Delphix. All rights reserved.
25 * Copyright (c) 2012 DEY Storage 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

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

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 by Delphix. All rights reserved.
25 * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
26 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
27 * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
28 * All rights reserved.
29 * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
30 * Copyright (c) 2013 Steven Hartland. All rights reserved.
26 * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
27 * All rights reserved.
28 * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
29 * Copyright (c) 2013 Steven Hartland. All rights reserved.
30 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
31 */
32
33#include <ctype.h>
34#include <errno.h>
35#include <libintl.h>
36#include <math.h>
37#include <stdio.h>
38#include <stdlib.h>

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

3877 * for new unique user properties and add them to the list.
3878 *
3879 * - For non fixed-width properties, keep track of the maximum width seen
3880 * so that we can size the column appropriately. If the user has
3881 * requested received property values, we also need to compute the width
3882 * of the RECEIVED column.
3883 */
3884int
31 */
32
33#include <ctype.h>
34#include <errno.h>
35#include <libintl.h>
36#include <math.h>
37#include <stdio.h>
38#include <stdlib.h>

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

3877 * for new unique user properties and add them to the list.
3878 *
3879 * - For non fixed-width properties, keep track of the maximum width seen
3880 * so that we can size the column appropriately. If the user has
3881 * requested received property values, we also need to compute the width
3882 * of the RECEIVED column.
3883 */
3884int
3885zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
3885zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received,
3886 boolean_t literal)
3886{
3887 libzfs_handle_t *hdl = zhp->zfs_hdl;
3888 zprop_list_t *entry;
3889 zprop_list_t **last, **start;
3890 nvlist_t *userprops, *propval;
3891 nvpair_t *elem;
3892 char *strval;
3893 char buf[ZFS_MAXPROPLEN];

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

3939 }
3940 }
3941 }
3942
3943 /*
3944 * Now go through and check the width of any non-fixed columns
3945 */
3946 for (entry = *plp; entry != NULL; entry = entry->pl_next) {
3887{
3888 libzfs_handle_t *hdl = zhp->zfs_hdl;
3889 zprop_list_t *entry;
3890 zprop_list_t **last, **start;
3891 nvlist_t *userprops, *propval;
3892 nvpair_t *elem;
3893 char *strval;
3894 char buf[ZFS_MAXPROPLEN];

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

3940 }
3941 }
3942 }
3943
3944 /*
3945 * Now go through and check the width of any non-fixed columns
3946 */
3947 for (entry = *plp; entry != NULL; entry = entry->pl_next) {
3947 if (entry->pl_fixed)
3948 if (entry->pl_fixed && !literal)
3948 continue;
3949
3950 if (entry->pl_prop != ZPROP_INVAL) {
3951 if (zfs_prop_get(zhp, entry->pl_prop,
3949 continue;
3950
3951 if (entry->pl_prop != ZPROP_INVAL) {
3952 if (zfs_prop_get(zhp, entry->pl_prop,
3952 buf, sizeof (buf), NULL, NULL, 0, B_FALSE) == 0) {
3953 buf, sizeof (buf), NULL, NULL, 0, literal) == 0) {
3953 if (strlen(buf) > entry->pl_width)
3954 entry->pl_width = strlen(buf);
3955 }
3956 if (received && zfs_prop_get_recvd(zhp,
3957 zfs_prop_to_name(entry->pl_prop),
3954 if (strlen(buf) > entry->pl_width)
3955 entry->pl_width = strlen(buf);
3956 }
3957 if (received && zfs_prop_get_recvd(zhp,
3958 zfs_prop_to_name(entry->pl_prop),
3958 buf, sizeof (buf), B_FALSE) == 0)
3959 buf, sizeof (buf), literal) == 0)
3959 if (strlen(buf) > entry->pl_recvd_width)
3960 entry->pl_recvd_width = strlen(buf);
3961 } else {
3962 if (nvlist_lookup_nvlist(userprops, entry->pl_user_prop,
3963 &propval) == 0) {
3964 verify(nvlist_lookup_string(propval,
3965 ZPROP_VALUE, &strval) == 0);
3966 if (strlen(strval) > entry->pl_width)
3967 entry->pl_width = strlen(strval);
3968 }
3969 if (received && zfs_prop_get_recvd(zhp,
3970 entry->pl_user_prop,
3960 if (strlen(buf) > entry->pl_recvd_width)
3961 entry->pl_recvd_width = strlen(buf);
3962 } else {
3963 if (nvlist_lookup_nvlist(userprops, entry->pl_user_prop,
3964 &propval) == 0) {
3965 verify(nvlist_lookup_string(propval,
3966 ZPROP_VALUE, &strval) == 0);
3967 if (strlen(strval) > entry->pl_width)
3968 entry->pl_width = strlen(strval);
3969 }
3970 if (received && zfs_prop_get_recvd(zhp,
3971 entry->pl_user_prop,
3971 buf, sizeof (buf), B_FALSE) == 0)
3972 buf, sizeof (buf), literal) == 0)
3972 if (strlen(buf) > entry->pl_recvd_width)
3973 entry->pl_recvd_width = strlen(buf);
3974 }
3975 }
3976
3977 return (0);
3978}
3979

--- 653 unchanged lines hidden ---
3973 if (strlen(buf) > entry->pl_recvd_width)
3974 entry->pl_recvd_width = strlen(buf);
3975 }
3976 }
3977
3978 return (0);
3979}
3980

--- 653 unchanged lines hidden ---