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

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

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

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

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) 2011 by Delphix. 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.
28 */
29
30#include <stdio.h>
31#include <stdlib.h>
32#include <strings.h>
33#include <unistd.h>

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

303 *
304 * If a snapshot can not be opened, continue trying to open the others, but
305 * return ENOENT at the end.
306 */
307int
308zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
309 zfs_iter_f func, void *arg)
310{
26 * Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
27 * All rights reserved.
28 */
29
30#include <stdio.h>
31#include <stdlib.h>
32#include <strings.h>
33#include <unistd.h>

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

303 *
304 * If a snapshot can not be opened, continue trying to open the others, but
305 * return ENOENT at the end.
306 */
307int
308zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
309 zfs_iter_f func, void *arg)
310{
311 char buf[ZFS_MAXNAMELEN];
312 char *comma_separated, *cp;
311 char *buf, *comma_separated, *cp;
313 int err = 0;
314 int ret = 0;
315
312 int err = 0;
313 int ret = 0;
314
316 (void) strlcpy(buf, spec_orig, sizeof (buf));
315 buf = zfs_strdup(fs_zhp->zfs_hdl, spec_orig);
317 cp = buf;
318
319 while ((comma_separated = strsep(&cp, ",")) != NULL) {
320 char *pct = strchr(comma_separated, '%');
321 if (pct != NULL) {
322 snapspec_arg_t ssa = { 0 };
323 ssa.ssa_func = func;
324 ssa.ssa_arg = arg;

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

366 continue;
367 }
368 err = func(snap_zhp, arg);
369 if (ret == 0)
370 ret = err;
371 }
372 }
373
316 cp = buf;
317
318 while ((comma_separated = strsep(&cp, ",")) != NULL) {
319 char *pct = strchr(comma_separated, '%');
320 if (pct != NULL) {
321 snapspec_arg_t ssa = { 0 };
322 ssa.ssa_func = func;
323 ssa.ssa_arg = arg;

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

365 continue;
366 }
367 err = func(snap_zhp, arg);
368 if (ret == 0)
369 ret = err;
370 }
371 }
372
373 free(buf);
374 return (ret);
375}
376
377/*
378 * Iterate over all children, snapshots and filesystems
379 */
380int
381zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, void *data)

--- 90 unchanged lines hidden ---
374 return (ret);
375}
376
377/*
378 * Iterate over all children, snapshots and filesystems
379 */
380int
381zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, void *data)

--- 90 unchanged lines hidden ---