Deleted Added
full compact
libzfs_iter.c (248571) libzfs_iter.c (254755)
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.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
26 * Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
27 * All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
25 * Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
26 * All rights reserved.
27 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
28 */
29
30#include <stdio.h>
31#include <stdlib.h>
32#include <strings.h>
33#include <unistd.h>
34#include <stddef.h>
35#include <libintl.h>

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

447 ida->stack = &isf;
448 err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida);
449 if (err == 0) {
450 err = zfs_iter_snapshots(zhp, B_FALSE,
451 iter_dependents_cb, ida);
452 }
453 ida->stack = isf.next;
454 }
28 */
29
30#include <stdio.h>
31#include <stdlib.h>
32#include <strings.h>
33#include <unistd.h>
34#include <stddef.h>
35#include <libintl.h>

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

447 ida->stack = &isf;
448 err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida);
449 if (err == 0) {
450 err = zfs_iter_snapshots(zhp, B_FALSE,
451 iter_dependents_cb, ida);
452 }
453 ida->stack = isf.next;
454 }
455
455 if (!first && err == 0)
456 err = ida->func(zhp, ida->data);
456 if (!first && err == 0)
457 err = ida->func(zhp, ida->data);
458 else
459 zfs_close(zhp);
460
457 return (err);
458}
459
460int
461zfs_iter_dependents(zfs_handle_t *zhp, boolean_t allowrecursion,
462 zfs_iter_f func, void *data)
463{
464 iter_dependents_arg_t ida;
465 ida.allowrecursion = allowrecursion;
466 ida.stack = NULL;
467 ida.func = func;
468 ida.data = data;
469 ida.first = B_TRUE;
470 return (iter_dependents_cb(zfs_handle_dup(zhp), &ida));
471}
461 return (err);
462}
463
464int
465zfs_iter_dependents(zfs_handle_t *zhp, boolean_t allowrecursion,
466 zfs_iter_f func, void *data)
467{
468 iter_dependents_arg_t ida;
469 ida.allowrecursion = allowrecursion;
470 ida.stack = NULL;
471 ida.func = func;
472 ida.data = data;
473 ida.first = B_TRUE;
474 return (iter_dependents_cb(zfs_handle_dup(zhp), &ida));
475}