]>
Commit | Line | Data |
---|---|---|
34dc7c2f BB |
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 | |
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 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | |
23 | * Use is subject to license terms. | |
24 | */ | |
25 | ||
26 | #ifndef _SYS_ZFS_IOCTL_H | |
27 | #define _SYS_ZFS_IOCTL_H | |
28 | ||
b128c09f | 29 | #pragma ident "%Z%%M% %I% %E% SMI" |
34dc7c2f BB |
30 | |
31 | #include <sys/cred.h> | |
32 | #include <sys/dmu.h> | |
33 | #include <sys/zio.h> | |
34 | #include <sys/dsl_deleg.h> | |
35 | ||
36 | #ifdef _KERNEL | |
37 | #include <sys/nvpair.h> | |
38 | #endif /* _KERNEL */ | |
39 | ||
40 | #ifdef __cplusplus | |
41 | extern "C" { | |
42 | #endif | |
43 | ||
44 | /* | |
45 | * Property values for snapdir | |
46 | */ | |
47 | #define ZFS_SNAPDIR_HIDDEN 0 | |
48 | #define ZFS_SNAPDIR_VISIBLE 1 | |
49 | ||
50 | #define DMU_BACKUP_STREAM_VERSION (1ULL) | |
51 | #define DMU_BACKUP_HEADER_VERSION (2ULL) | |
52 | #define DMU_BACKUP_MAGIC 0x2F5bacbacULL | |
53 | ||
54 | #define DRR_FLAG_CLONE (1<<0) | |
55 | #define DRR_FLAG_CI_DATA (1<<1) | |
56 | ||
57 | /* | |
58 | * zfs ioctl command structure | |
59 | */ | |
60 | typedef struct dmu_replay_record { | |
61 | enum { | |
62 | DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, | |
63 | DRR_WRITE, DRR_FREE, DRR_END, | |
64 | } drr_type; | |
65 | uint32_t drr_payloadlen; | |
66 | union { | |
67 | struct drr_begin { | |
68 | uint64_t drr_magic; | |
69 | uint64_t drr_version; | |
70 | uint64_t drr_creation_time; | |
71 | dmu_objset_type_t drr_type; | |
72 | uint32_t drr_flags; | |
73 | uint64_t drr_toguid; | |
74 | uint64_t drr_fromguid; | |
75 | char drr_toname[MAXNAMELEN]; | |
76 | } drr_begin; | |
77 | struct drr_end { | |
78 | zio_cksum_t drr_checksum; | |
79 | } drr_end; | |
80 | struct drr_object { | |
81 | uint64_t drr_object; | |
82 | dmu_object_type_t drr_type; | |
83 | dmu_object_type_t drr_bonustype; | |
84 | uint32_t drr_blksz; | |
85 | uint32_t drr_bonuslen; | |
86 | uint8_t drr_checksum; | |
87 | uint8_t drr_compress; | |
88 | uint8_t drr_pad[6]; | |
89 | /* bonus content follows */ | |
90 | } drr_object; | |
91 | struct drr_freeobjects { | |
92 | uint64_t drr_firstobj; | |
93 | uint64_t drr_numobjs; | |
94 | } drr_freeobjects; | |
95 | struct drr_write { | |
96 | uint64_t drr_object; | |
97 | dmu_object_type_t drr_type; | |
98 | uint32_t drr_pad; | |
99 | uint64_t drr_offset; | |
100 | uint64_t drr_length; | |
101 | /* content follows */ | |
102 | } drr_write; | |
103 | struct drr_free { | |
104 | uint64_t drr_object; | |
105 | uint64_t drr_offset; | |
106 | uint64_t drr_length; | |
107 | } drr_free; | |
108 | } drr_u; | |
109 | } dmu_replay_record_t; | |
110 | ||
111 | typedef struct zinject_record { | |
112 | uint64_t zi_objset; | |
113 | uint64_t zi_object; | |
114 | uint64_t zi_start; | |
115 | uint64_t zi_end; | |
116 | uint64_t zi_guid; | |
117 | uint32_t zi_level; | |
118 | uint32_t zi_error; | |
119 | uint64_t zi_type; | |
120 | uint32_t zi_freq; | |
121 | uint32_t zi_pad; /* pad out to 64 bit alignment */ | |
122 | } zinject_record_t; | |
123 | ||
124 | #define ZINJECT_NULL 0x1 | |
125 | #define ZINJECT_FLUSH_ARC 0x2 | |
126 | #define ZINJECT_UNLOAD_SPA 0x4 | |
127 | ||
128 | typedef struct zfs_share { | |
129 | uint64_t z_exportdata; | |
130 | uint64_t z_sharedata; | |
131 | uint64_t z_sharetype; /* 0 = share, 1 = unshare */ | |
132 | uint64_t z_sharemax; /* max length of share string */ | |
133 | } zfs_share_t; | |
134 | ||
135 | /* | |
136 | * ZFS file systems may behave the usual, POSIX-compliant way, where | |
137 | * name lookups are case-sensitive. They may also be set up so that | |
138 | * all the name lookups are case-insensitive, or so that only some | |
139 | * lookups, the ones that set an FIGNORECASE flag, are case-insensitive. | |
140 | */ | |
141 | typedef enum zfs_case { | |
142 | ZFS_CASE_SENSITIVE, | |
143 | ZFS_CASE_INSENSITIVE, | |
144 | ZFS_CASE_MIXED | |
145 | } zfs_case_t; | |
146 | ||
147 | typedef struct zfs_cmd { | |
148 | char zc_name[MAXPATHLEN]; | |
149 | char zc_value[MAXPATHLEN * 2]; | |
150 | char zc_string[MAXNAMELEN]; | |
151 | uint64_t zc_guid; | |
152 | uint64_t zc_nvlist_conf; /* really (char *) */ | |
153 | uint64_t zc_nvlist_conf_size; | |
154 | uint64_t zc_nvlist_src; /* really (char *) */ | |
155 | uint64_t zc_nvlist_src_size; | |
156 | uint64_t zc_nvlist_dst; /* really (char *) */ | |
157 | uint64_t zc_nvlist_dst_size; | |
158 | uint64_t zc_cookie; | |
159 | uint64_t zc_objset_type; | |
160 | uint64_t zc_perm_action; | |
161 | uint64_t zc_history; /* really (char *) */ | |
162 | uint64_t zc_history_len; | |
163 | uint64_t zc_history_offset; | |
164 | uint64_t zc_obj; | |
165 | zfs_share_t zc_share; | |
166 | dmu_objset_stats_t zc_objset_stats; | |
167 | struct drr_begin zc_begin_record; | |
168 | zinject_record_t zc_inject_record; | |
169 | } zfs_cmd_t; | |
170 | ||
171 | #define ZVOL_MAX_MINOR (1 << 16) | |
172 | #define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1) | |
173 | ||
174 | #ifdef _KERNEL | |
175 | ||
176 | typedef struct zfs_creat { | |
177 | nvlist_t *zct_zplprops; | |
178 | nvlist_t *zct_props; | |
179 | } zfs_creat_t; | |
180 | ||
181 | extern dev_info_t *zfs_dip; | |
182 | ||
183 | extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr); | |
184 | extern int zfs_secpolicy_rename_perms(const char *from, | |
185 | const char *to, cred_t *cr); | |
186 | extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); | |
187 | extern int zfs_busy(void); | |
188 | extern int zfs_unmount_snap(char *, void *); | |
189 | ||
190 | #endif /* _KERNEL */ | |
191 | ||
192 | #ifdef __cplusplus | |
193 | } | |
194 | #endif | |
195 | ||
196 | #endif /* _SYS_ZFS_IOCTL_H */ |