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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _LIBFS_IMPL_H 28 #define _LIBFS_IMPL_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/dmu.h> 33 #include <sys/fs/zfs.h> 34 #include <sys/zfs_ioctl.h> 35 #include <sys/zfs_acl.h> 36 #include <sys/nvpair.h> 37 38 #include <libzfs.h> 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 struct zfs_handle { 45 char zfs_name[ZFS_MAXNAMELEN]; 46 zfs_type_t zfs_type; 47 dmu_objset_stats_t zfs_dmustats; 48 zfs_stats_t zfs_zplstats; 49 uint64_t zfs_volsize; 50 uint64_t zfs_volblocksize; 51 char *zfs_mntopts; 52 }; 53 54 struct zpool_handle { 55 char zpool_name[ZPOOL_MAXNAMELEN]; 56 int zpool_state; 57 size_t zpool_config_size; 58 nvlist_t *zpool_config; 59 nvlist_t *zpool_old_config; 60 }; 61 62 void zfs_error(const char *, ...); 63 void zfs_fatal(const char *, ...); 64 void *zfs_malloc(size_t); 65 char *zfs_strdup(const char *); 66 void no_memory(void); 67 68 #define zfs_baderror(err) \ 69 (zfs_fatal(dgettext(TEXT_DOMAIN, \ 70 "internal error: unexpected error %d at line %d of %s"), \ 71 (err), (__LINE__), (__FILE__))) 72 73 int zfs_fd; 74 75 char **get_dependents(const char *, size_t *); 76 77 FILE *mnttab_file; 78 FILE *sharetab_file; 79 80 typedef struct prop_changelist prop_changelist_t; 81 82 int changelist_prefix(prop_changelist_t *); 83 int changelist_postfix(prop_changelist_t *); 84 void changelist_rename(prop_changelist_t *, const char *, const char *); 85 void changelist_remove(zfs_handle_t *, prop_changelist_t *); 86 void changelist_free(prop_changelist_t *); 87 prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int); 88 int changelist_unshare(prop_changelist_t *); 89 int changelist_haszonedchild(prop_changelist_t *); 90 91 void remove_mountpoint(zfs_handle_t *); 92 93 zfs_handle_t *make_dataset_handle(const char *); 94 void set_pool_health(nvlist_t *config); 95 96 zpool_handle_t *zpool_open_silent(const char *pool); 97 98 int zvol_create_link(const char *dataset); 99 int zvol_remove_link(const char *dataset); 100 101 #ifdef __cplusplus 102 } 103 #endif 104 105 #endif /* _LIBFS_IMPL_H */ 106