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 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
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 (c) 2011 Pawel Jakub Dawidek. All rights reserved.
25 * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
26 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
27 * Copyright (c) 2013 Steven Hartland. All rights reserved.
28 * Copyright (c) 2014 Integros [integros.com]
29 * Copyright 2016 Nexenta Systems, Inc.
30 * Copyright (c) 2017 Datto Inc.
31 */
32
33 #ifndef _LIBZFS_H
34 #define _LIBZFS_H
35
36 #include <assert.h>
37 #include <libnvpair.h>
38 #include <sys/mnttab.h>
39 #include <sys/param.h>
40 #include <sys/types.h>
41 #include <sys/varargs.h>
42 #include <sys/fs/zfs.h>
43 #include <sys/avl.h>
44 #include <ucred.h>
45 #include <libzfs_core.h>
543 const char *, const char *, zprop_source_t, const char *,
544 const char *);
545
546 /*
547 * Iterator functions.
548 */
549 typedef int (*zfs_iter_f)(zfs_handle_t *, void *);
550 extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *);
551 extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *);
552 extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
553 extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
554 extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
555 extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
556 extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
557 extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
558
559 typedef struct get_all_cb {
560 zfs_handle_t **cb_handles;
561 size_t cb_alloc;
562 size_t cb_used;
563 boolean_t cb_verbose;
564 int (*cb_getone)(zfs_handle_t *, void *);
565 } get_all_cb_t;
566
567 void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *);
568 int libzfs_dataset_cmp(const void *, const void *);
569
570 /*
571 * Functions to create and destroy datasets.
572 */
573 extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
574 nvlist_t *);
575 extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
576 extern int zfs_destroy(zfs_handle_t *, boolean_t);
577 extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
578 extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
579 extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
580 extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
581 extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
582 nvlist_t *props);
583 extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
584 extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);
585
586 typedef struct sendflags {
587 /* print informational messages (ie, -v was specified) */
588 boolean_t verbose;
|
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 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
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 (c) 2011 Pawel Jakub Dawidek. All rights reserved.
25 * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
26 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
27 * Copyright (c) 2013 Steven Hartland. All rights reserved.
28 * Copyright (c) 2014 Integros [integros.com]
29 * Copyright 2016 Nexenta Systems, Inc.
30 * Copyright (c) 2017 Datto Inc.
31 */
32
33 #ifndef _LIBZFS_H
34 #define _LIBZFS_H
35
36 #include <assert.h>
37 #include <libnvpair.h>
38 #include <sys/mnttab.h>
39 #include <sys/param.h>
40 #include <sys/types.h>
41 #include <sys/varargs.h>
42 #include <sys/fs/zfs.h>
43 #include <sys/avl.h>
44 #include <ucred.h>
45 #include <libzfs_core.h>
543 const char *, const char *, zprop_source_t, const char *,
544 const char *);
545
546 /*
547 * Iterator functions.
548 */
549 typedef int (*zfs_iter_f)(zfs_handle_t *, void *);
550 extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *);
551 extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *);
552 extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
553 extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
554 extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
555 extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
556 extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
557 extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
558
559 typedef struct get_all_cb {
560 zfs_handle_t **cb_handles;
561 size_t cb_alloc;
562 size_t cb_used;
563 } get_all_cb_t;
564
565 void zfs_foreach_mountpoint(libzfs_handle_t *, zfs_handle_t **, size_t,
566 zfs_iter_f, void *, boolean_t);
567 void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *);
568
569 /*
570 * Functions to create and destroy datasets.
571 */
572 extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
573 nvlist_t *);
574 extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
575 extern int zfs_destroy(zfs_handle_t *, boolean_t);
576 extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
577 extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
578 extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
579 extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
580 extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
581 nvlist_t *props);
582 extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
583 extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);
584
585 typedef struct sendflags {
586 /* print informational messages (ie, -v was specified) */
587 boolean_t verbose;
|