]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / sys / cddl / contrib / opensolaris / common / zfs / zfs_ioctl_compat.h
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 2010 Martin Matuska <mm@FreeBSD.org>.  All rights reserved.
23  * Use is subject to license terms.
24  */
25
26 #ifndef _SYS_ZFS_IOCTL_COMPAT_H
27 #define _SYS_ZFS_IOCTL_COMPAT_H
28
29 #include <sys/cred.h>
30 #include <sys/dmu.h>
31 #include <sys/zio.h>
32 #include <sys/dsl_deleg.h>
33 #include <sys/zfs_ioctl.h>
34
35 #ifdef _KERNEL
36 #include <sys/nvpair.h>
37 #endif  /* _KERNEL */
38
39 #ifdef  __cplusplus
40 extern "C" {
41 #endif
42
43 #define ZFS_CMD_COMPAT_NONE     0
44 #define ZFS_CMD_COMPAT_V15      1
45
46 #define ZFS_IOC_COMPAT_PASS     254
47 #define ZFS_IOC_COMPAT_FAIL     255
48
49 typedef struct zinject_record_v15 {
50         uint64_t        zi_objset;
51         uint64_t        zi_object;
52         uint64_t        zi_start;
53         uint64_t        zi_end;
54         uint64_t        zi_guid;
55         uint32_t        zi_level;
56         uint32_t        zi_error;
57         uint64_t        zi_type;
58         uint32_t        zi_freq;
59         uint32_t        zi_failfast;
60 } zinject_record_v15_t;
61
62 typedef struct zfs_cmd_v15 {
63         char            zc_name[MAXPATHLEN];
64         char            zc_value[MAXPATHLEN];
65         char            zc_string[MAXNAMELEN];
66         uint64_t        zc_guid;
67         uint64_t        zc_nvlist_conf;         /* really (char *) */
68         uint64_t        zc_nvlist_conf_size;
69         uint64_t        zc_nvlist_src;          /* really (char *) */
70         uint64_t        zc_nvlist_src_size;
71         uint64_t        zc_nvlist_dst;          /* really (char *) */
72         uint64_t        zc_nvlist_dst_size;
73         uint64_t        zc_cookie;
74         uint64_t        zc_objset_type;
75         uint64_t        zc_perm_action;
76         uint64_t        zc_history;             /* really (char *) */
77         uint64_t        zc_history_len;
78         uint64_t        zc_history_offset;
79         uint64_t        zc_obj;
80         zfs_share_t     zc_share;
81         uint64_t        zc_jailid;
82         dmu_objset_stats_t zc_objset_stats;
83         struct drr_begin zc_begin_record;
84         zinject_record_v15_t zc_inject_record;
85 } zfs_cmd_v15_t;
86
87 #ifdef _KERNEL
88 unsigned static long zfs_ioctl_v15_to_v28[] = {
89         0,      /*  0 ZFS_IOC_POOL_CREATE */
90         1,      /*  1 ZFS_IOC_POOL_DESTROY */
91         2,      /*  2 ZFS_IOC_POOL_IMPORT */
92         3,      /*  3 ZFS_IOC_POOL_EXPORT */
93         4,      /*  4 ZFS_IOC_POOL_CONFIGS */
94         5,      /*  5 ZFS_IOC_POOL_STATS */
95         6,      /*  6 ZFS_IOC_POOL_TRYIMPORT */
96         7,      /*  7 ZFS_IOC_POOL_SCRUB */
97         8,      /*  8 ZFS_IOC_POOL_FREEZE */
98         9,      /*  9 ZFS_IOC_POOL_UPGRADE */
99         10,     /* 10 ZFS_IOC_POOL_GET_HISTORY */
100         11,     /* 11 ZFS_IOC_VDEV_ADD */
101         12,     /* 12 ZFS_IOC_VDEV_REMOVE */
102         13,     /* 13 ZFS_IOC_VDEV_SET_STATE */
103         14,     /* 14 ZFS_IOC_VDEV_ATTACH */
104         15,     /* 15 ZFS_IOC_VDEV_DETACH */
105         16,     /* 16 ZFS_IOC_VDEV_SETPATH */
106         18,     /* 17 ZFS_IOC_OBJSET_STATS */
107         19,     /* 18 ZFS_IOC_OBJSET_ZPLPROPS */
108         20,     /* 19 ZFS_IOC_DATASET_LIST_NEXT */
109         21,     /* 20 ZFS_IOC_SNAPSHOT_LIST_NEXT */
110         22,     /* 21 ZFS_IOC_SET_PROP */
111         ZFS_IOC_COMPAT_PASS,    /* 22 ZFS_IOC_CREATE_MINOR */
112         ZFS_IOC_COMPAT_PASS,    /* 23 ZFS_IOC_REMOVE_MINOR */
113         23,     /* 24 ZFS_IOC_CREATE */
114         24,     /* 25 ZFS_IOC_DESTROY */
115         25,     /* 26 ZFS_IOC_ROLLBACK */
116         26,     /* 27 ZFS_IOC_RENAME */
117         27,     /* 28 ZFS_IOC_RECV */
118         28,     /* 29 ZFS_IOC_SEND */
119         29,     /* 30 ZFS_IOC_INJECT_FAULT */
120         30,     /* 31 ZFS_IOC_CLEAR_FAULT */
121         31,     /* 32 ZFS_IOC_INJECT_LIST_NEXT */
122         32,     /* 33 ZFS_IOC_ERROR_LOG */
123         33,     /* 34 ZFS_IOC_CLEAR */
124         34,     /* 35 ZFS_IOC_PROMOTE */
125         35,     /* 36 ZFS_IOC_DESTROY_SNAPS */
126         36,     /* 37 ZFS_IOC_SNAPSHOT */
127         37,     /* 38 ZFS_IOC_DSOBJ_TO_DSNAME */
128         38,     /* 39 ZFS_IOC_OBJ_TO_PATH */
129         39,     /* 40 ZFS_IOC_POOL_SET_PROPS */
130         40,     /* 41 ZFS_IOC_POOL_GET_PROPS */
131         41,     /* 42 ZFS_IOC_SET_FSACL */
132         42,     /* 43 ZFS_IOC_GET_FSACL */
133         ZFS_IOC_COMPAT_PASS,    /* 44 ZFS_IOC_ISCSI_PERM_CHECK */
134         43,     /* 45 ZFS_IOC_SHARE */
135         44,     /* 46 ZFS_IOC_IHNERIT_PROP */
136         58,     /* 47 ZFS_IOC_JAIL */
137         59,     /* 48 ZFS_IOC_UNJAIL */
138         45,     /* 49 ZFS_IOC_SMB_ACL */
139         46,     /* 50 ZFS_IOC_USERSPACE_ONE */
140         47,     /* 51 ZFS_IOC_USERSPACE_MANY */
141         48,     /* 52 ZFS_IOC_USERSPACE_UPGRADE */
142         17,     /* 53 ZFS_IOC_SETFRU */
143 };
144
145 #else   /* KERNEL */
146 unsigned static long zfs_ioctl_v28_to_v15[] = {
147         0,      /*  0 ZFS_IOC_POOL_CREATE */
148         1,      /*  1 ZFS_IOC_POOL_DESTROY */
149         2,      /*  2 ZFS_IOC_POOL_IMPORT */
150         3,      /*  3 ZFS_IOC_POOL_EXPORT */
151         4,      /*  4 ZFS_IOC_POOL_CONFIGS */
152         5,      /*  5 ZFS_IOC_POOL_STATS */
153         6,      /*  6 ZFS_IOC_POOL_TRYIMPORT */
154         7,      /*  7 ZFS_IOC_POOL_SCAN */
155         8,      /*  8 ZFS_IOC_POOL_FREEZE */
156         9,      /*  9 ZFS_IOC_POOL_UPGRADE */
157         10,     /* 10 ZFS_IOC_POOL_GET_HISTORY */
158         11,     /* 11 ZFS_IOC_VDEV_ADD */
159         12,     /* 12 ZFS_IOC_VDEV_REMOVE */
160         13,     /* 13 ZFS_IOC_VDEV_SET_STATE */
161         14,     /* 14 ZFS_IOC_VDEV_ATTACH */
162         15,     /* 15 ZFS_IOC_VDEV_DETACH */
163         16,     /* 16 ZFS_IOC_VDEV_SETPATH */
164         53,     /* 17 ZFS_IOC_VDEV_SETFRU */
165         17,     /* 18 ZFS_IOC_OBJSET_STATS */
166         18,     /* 19 ZFS_IOC_OBJSET_ZPLPROPS */
167         19,     /* 20 ZFS_IOC_DATASET_LIST_NEXT */
168         20,     /* 21 ZFS_IOC_SNAPSHOT_LIST_NEXT */
169         21,     /* 22 ZFS_IOC_SET_PROP */
170         24,     /* 23 ZFS_IOC_CREATE */
171         25,     /* 24 ZFS_IOC_DESTROY */
172         26,     /* 25 ZFS_IOC_ROLLBACK */
173         27,     /* 26 ZFS_IOC_RENAME */
174         28,     /* 27 ZFS_IOC_RECV */
175         29,     /* 28 ZFS_IOC_SEND */
176         30,     /* 39 ZFS_IOC_INJECT_FAULT */
177         31,     /* 30 ZFS_IOC_CLEAR_FAULT */
178         32,     /* 31 ZFS_IOC_INJECT_LIST_NEXT */
179         33,     /* 32 ZFS_IOC_ERROR_LOG */
180         34,     /* 33 ZFS_IOC_CLEAR */
181         35,     /* 34 ZFS_IOC_PROMOTE */
182         36,     /* 35 ZFS_IOC_DESTROY_SNAPS */
183         37,     /* 36 ZFS_IOC_SNAPSHOT */
184         38,     /* 37 ZFS_IOC_DSOBJ_TO_DSNAME */
185         39,     /* 38 ZFS_IOC_OBJ_TO_PATH */
186         40,     /* 39 ZFS_IOC_POOL_SET_PROPS */
187         41,     /* 40 ZFS_IOC_POOL_GET_PROPS */
188         42,     /* 41 ZFS_IOC_SET_FSACL */
189         43,     /* 42 ZFS_IOC_GET_FSACL */
190         45,     /* 43 ZFS_IOC_SHARE */
191         46,     /* 44 ZFS_IOC_IHNERIT_PROP */
192         49,     /* 45 ZFS_IOC_SMB_ACL */
193         50,     /* 46 ZFS_IOC_USERSPACE_ONE */
194         51,     /* 47 ZFS_IOC_USERSPACE_MANY */
195         52,     /* 48 ZFS_IOC_USERSPACE_UPGRADE */
196         ZFS_IOC_COMPAT_FAIL,    /* 49 ZFS_IOC_HOLD */
197         ZFS_IOC_COMPAT_FAIL,    /* 50 ZFS_IOC_RELEASE */
198         ZFS_IOC_COMPAT_FAIL,    /* 51 ZFS_IOC_GET_HOLDS */
199         ZFS_IOC_COMPAT_FAIL,    /* 52 ZFS_IOC_OBJSET_RECVD_PROPS */
200         ZFS_IOC_COMPAT_FAIL,    /* 53 ZFS_IOC_VDEV_SPLIT */
201         ZFS_IOC_COMPAT_FAIL,    /* 54 ZFS_IOC_NEXT_OBJ */
202         ZFS_IOC_COMPAT_FAIL,    /* 55 ZFS_IOC_DIFF */
203         ZFS_IOC_COMPAT_FAIL,    /* 56 ZFS_IOC_TMP_SNAPSHOT */
204         ZFS_IOC_COMPAT_FAIL,    /* 57 ZFS_IOC_OBJ_TO_STATS */
205         47,     /* 58 ZFS_IOC_JAIL */
206         48,     /* 59 ZFS_IOC_UNJAIL */
207 };
208 #endif  /* ! _KERNEL */
209
210 #ifdef _KERNEL
211 void zfs_ioctl_compat_pre(zfs_cmd_t *, int *, const int);
212 void zfs_ioctl_compat_post(zfs_cmd_t *, const int, const int);
213 #else
214 int zcmd_ioctl_compat(int, unsigned long, zfs_cmd_t *, const int);
215 #endif  /* _KERNEL */
216 void zfs_cmd_compat_get(zfs_cmd_t *, caddr_t, const int);
217 void zfs_cmd_compat_put(zfs_cmd_t *, caddr_t, const int);
218
219 #ifdef  __cplusplus
220 }
221 #endif
222
223 #endif  /* _SYS_ZFS_IOCTL_COMPAT_H */