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

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

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.
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

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

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 2010 Nexenta Systems, Inc. All rights reserved.
24 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2011 by Delphix. All rights reserved.
26 * Copyright (c) 2012 DEY Storage 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 */
31
32#include <ctype.h>

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

4072}
4073#endif /* sun */
4074
4075int
4076zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
4077 zfs_userspace_cb_t func, void *arg)
4078{
4079 zfs_cmd_t zc = { 0 };
25 * Copyright (c) 2011 by Delphix. All rights reserved.
26 * Copyright (c) 2012 DEY Storage 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 */
31
32#include <ctype.h>

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

4072}
4073#endif /* sun */
4074
4075int
4076zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
4077 zfs_userspace_cb_t func, void *arg)
4078{
4079 zfs_cmd_t zc = { 0 };
4080 int error;
4081 zfs_useracct_t buf[100];
4080 zfs_useracct_t buf[100];
4081 libzfs_handle_t *hdl = zhp->zfs_hdl;
4082 int ret;
4082
4083 (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
4084
4085 zc.zc_objset_type = type;
4086 zc.zc_nvlist_dst = (uintptr_t)buf;
4087
4083
4084 (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
4085
4086 zc.zc_objset_type = type;
4087 zc.zc_nvlist_dst = (uintptr_t)buf;
4088
4088 /* CONSTCOND */
4089 while (1) {
4089 for (;;) {
4090 zfs_useracct_t *zua = buf;
4091
4092 zc.zc_nvlist_dst_size = sizeof (buf);
4090 zfs_useracct_t *zua = buf;
4091
4092 zc.zc_nvlist_dst_size = sizeof (buf);
4093 error = ioctl(zhp->zfs_hdl->libzfs_fd,
4094 ZFS_IOC_USERSPACE_MANY, &zc);
4095 if (error || zc.zc_nvlist_dst_size == 0)
4093 if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) {
4094 char errbuf[ZFS_MAXNAMELEN + 32];
4095
4096 (void) snprintf(errbuf, sizeof (errbuf),
4097 dgettext(TEXT_DOMAIN,
4098 "cannot get used/quota for %s"), zc.zc_name);
4099 return (zfs_standard_error_fmt(hdl, errno, errbuf));
4100 }
4101 if (zc.zc_nvlist_dst_size == 0)
4096 break;
4097
4098 while (zc.zc_nvlist_dst_size > 0) {
4102 break;
4103
4104 while (zc.zc_nvlist_dst_size > 0) {
4099 error = func(arg, zua->zu_domain, zua->zu_rid,
4100 zua->zu_space);
4101 if (error != 0)
4102 return (error);
4105 if ((ret = func(arg, zua->zu_domain, zua->zu_rid,
4106 zua->zu_space)) != 0)
4107 return (ret);
4103 zua++;
4104 zc.zc_nvlist_dst_size -= sizeof (zfs_useracct_t);
4105 }
4106 }
4107
4108 zua++;
4109 zc.zc_nvlist_dst_size -= sizeof (zfs_useracct_t);
4110 }
4111 }
4112
4108 return (error);
4113 return (0);
4109}
4110
4111int
4112zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
4113 boolean_t recursive, boolean_t temphold, boolean_t enoent_ok,
4114 int cleanup_fd, uint64_t dsobj, uint64_t createtxg)
4115{
4116 zfs_cmd_t zc = { 0 };

--- 361 unchanged lines hidden ---
4114}
4115
4116int
4117zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
4118 boolean_t recursive, boolean_t temphold, boolean_t enoent_ok,
4119 int cleanup_fd, uint64_t dsobj, uint64_t createtxg)
4120{
4121 zfs_cmd_t zc = { 0 };

--- 361 unchanged lines hidden ---