Deleted Added
full compact
libzfs_iter.c (307046) libzfs_iter.c (307108)
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

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

192 fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
193 fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
194
195 if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
196 goto out;
197
198 for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
199 pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
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

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

192 fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
193 fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
194
195 if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
196 goto out;
197
198 for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
199 pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
200 char name[ZFS_MAXNAMELEN];
200 char name[ZFS_MAX_DATASET_NAME_LEN];
201 char *bmark_name;
202 nvlist_t *bmark_props;
203
204 bmark_name = nvpair_name(pair);
205 bmark_props = fnvpair_value_nvlist(pair);
206
207 (void) snprintf(name, sizeof (name), "%s#%s", zhp->zfs_name,
208 bmark_name);

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

380 *pct = '\0';
381 ssa.ssa_last = pct + 1;
382
383 /*
384 * If there is a lastname specified, make sure it
385 * exists.
386 */
387 if (ssa.ssa_last[0] != '\0') {
201 char *bmark_name;
202 nvlist_t *bmark_props;
203
204 bmark_name = nvpair_name(pair);
205 bmark_props = fnvpair_value_nvlist(pair);
206
207 (void) snprintf(name, sizeof (name), "%s#%s", zhp->zfs_name,
208 bmark_name);

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

380 *pct = '\0';
381 ssa.ssa_last = pct + 1;
382
383 /*
384 * If there is a lastname specified, make sure it
385 * exists.
386 */
387 if (ssa.ssa_last[0] != '\0') {
388 char snapname[ZFS_MAXNAMELEN];
388 char snapname[ZFS_MAX_DATASET_NAME_LEN];
389 (void) snprintf(snapname, sizeof (snapname),
390 "%s@%s", zfs_get_name(fs_zhp),
391 ssa.ssa_last);
392 if (!zfs_dataset_exists(fs_zhp->zfs_hdl,
393 snapname, ZFS_TYPE_SNAPSHOT)) {
394 ret = ENOENT;
395 continue;
396 }
397 }
398
399 err = zfs_iter_snapshots_sorted(fs_zhp,
400 snapspec_cb, &ssa);
401 if (ret == 0)
402 ret = err;
403 if (ret == 0 && (!ssa.ssa_seenfirst ||
404 (ssa.ssa_last[0] != '\0' && !ssa.ssa_seenlast))) {
405 ret = ENOENT;
406 }
407 } else {
389 (void) snprintf(snapname, sizeof (snapname),
390 "%s@%s", zfs_get_name(fs_zhp),
391 ssa.ssa_last);
392 if (!zfs_dataset_exists(fs_zhp->zfs_hdl,
393 snapname, ZFS_TYPE_SNAPSHOT)) {
394 ret = ENOENT;
395 continue;
396 }
397 }
398
399 err = zfs_iter_snapshots_sorted(fs_zhp,
400 snapspec_cb, &ssa);
401 if (ret == 0)
402 ret = err;
403 if (ret == 0 && (!ssa.ssa_seenfirst ||
404 (ssa.ssa_last[0] != '\0' && !ssa.ssa_seenlast))) {
405 ret = ENOENT;
406 }
407 } else {
408 char snapname[ZFS_MAXNAMELEN];
408 char snapname[ZFS_MAX_DATASET_NAME_LEN];
409 zfs_handle_t *snap_zhp;
410 (void) snprintf(snapname, sizeof (snapname), "%s@%s",
411 zfs_get_name(fs_zhp), comma_separated);
412 snap_zhp = make_dataset_handle(fs_zhp->zfs_hdl,
413 snapname);
414 if (snap_zhp == NULL) {
415 ret = ENOENT;
416 continue;

--- 110 unchanged lines hidden ---
409 zfs_handle_t *snap_zhp;
410 (void) snprintf(snapname, sizeof (snapname), "%s@%s",
411 zfs_get_name(fs_zhp), comma_separated);
412 snap_zhp = make_dataset_handle(fs_zhp->zfs_hdl,
413 snapname);
414 if (snap_zhp == NULL) {
415 ret = ENOENT;
416 continue;

--- 110 unchanged lines hidden ---