libzfs_impl.h revision 088e9d477eee66081e407fbc5a33c4da25f66f6a
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Common Development and Distribution License, Version 1.0 only
fa9e4066f08beec538e775443c5be79dd423fcabahrens * (the "License"). You may not use this file except in compliance
fa9e4066f08beec538e775443c5be79dd423fcabahrens * with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifndef _LIBFS_IMPL_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define _LIBFS_IMPL_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/dmu.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/fs/zfs.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_ioctl.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_acl.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/nvpair.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <libzfs.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct zfs_handle {
fa9e4066f08beec538e775443c5be79dd423fcabahrens char zfs_name[ZFS_MAXNAMELEN];
fa9e4066f08beec538e775443c5be79dd423fcabahrens zfs_type_t zfs_type;
fa9e4066f08beec538e775443c5be79dd423fcabahrens dmu_objset_stats_t zfs_dmustats;
fa9e4066f08beec538e775443c5be79dd423fcabahrens zfs_stats_t zfs_zplstats;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t zfs_volsize;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t zfs_volblocksize;
fa9e4066f08beec538e775443c5be79dd423fcabahrens char *zfs_mntopts;
fa9e4066f08beec538e775443c5be79dd423fcabahrens};
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct zpool_handle {
fa9e4066f08beec538e775443c5be79dd423fcabahrens char zpool_name[ZPOOL_MAXNAMELEN];
fa9e4066f08beec538e775443c5be79dd423fcabahrens int zpool_state;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t zpool_config_size;
fa9e4066f08beec538e775443c5be79dd423fcabahrens nvlist_t *zpool_config;
088e9d477eee66081e407fbc5a33c4da25f66f6aeschrock nvlist_t *zpool_old_config;
fa9e4066f08beec538e775443c5be79dd423fcabahrens};
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid zfs_error(const char *, ...);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid zfs_fatal(const char *, ...);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid *zfs_malloc(size_t);
fa9e4066f08beec538e775443c5be79dd423fcabahrenschar *zfs_strdup(const char *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid no_memory(void);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define zfs_baderror(err) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens (zfs_fatal(dgettext(TEXT_DOMAIN, \
fa9e4066f08beec538e775443c5be79dd423fcabahrens "internal error: unexpected error %d at line %d of %s"), \
fa9e4066f08beec538e775443c5be79dd423fcabahrens (err), (__LINE__), (__FILE__)))
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensint zfs_fd;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenschar **get_dependents(const char *, size_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensFILE *mnttab_file;
fa9e4066f08beec538e775443c5be79dd423fcabahrensFILE *sharetab_file;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct prop_changelist prop_changelist_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensint changelist_prefix(prop_changelist_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint changelist_postfix(prop_changelist_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid changelist_rename(prop_changelist_t *, const char *, const char *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid changelist_free(prop_changelist_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensprop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint changelist_unshare(prop_changelist_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint changelist_haszonedchild(prop_changelist_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid remove_mountpoint(zfs_handle_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_handle_t *make_dataset_handle(const char *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid set_pool_health(nvlist_t *config);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenszpool_handle_t *zpool_open_silent(const char *pool);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensint zvol_create_link(const char *dataset);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint zvol_remove_link(const char *dataset);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _LIBFS_IMPL_H */