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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or https://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
23 #ifndef _ZFS_IOCTL_IMPL_H_
24 #define _ZFS_IOCTL_IMPL_H_
26 extern kmutex_t zfsdev_state_lock
;
27 extern uint64_t zfs_max_nvlist_src_size
;
29 typedef int zfs_ioc_legacy_func_t(zfs_cmd_t
*);
30 typedef int zfs_ioc_func_t(const char *, nvlist_t
*, nvlist_t
*);
31 typedef int zfs_secpolicy_func_t(zfs_cmd_t
*, nvlist_t
*, cred_t
*);
34 POOL_CHECK_NONE
= 1 << 0,
35 POOL_CHECK_SUSPENDED
= 1 << 1,
36 POOL_CHECK_READONLY
= 1 << 2,
37 } zfs_ioc_poolcheck_t
;
44 } zfs_ioc_namecheck_t
;
47 * IOC Keys are used to document and validate user->kernel interface inputs.
48 * See zfs_keys_recv_new for an example declaration. Any key name that is not
49 * listed will be rejected as input.
51 * The keyname 'optional' is always allowed, and must be an nvlist if present.
52 * Arguments which older kernels can safely ignore can be placed under the
55 * When adding new keys to an existing ioc for new functionality, consider:
56 * - adding an entry into zfs_sysfs.c zfs_features[] list
57 * - updating the libzfs_input_check.c test utility
59 * Note: in the ZK_WILDCARDLIST case, the name serves as documentation
60 * for the expected name (bookmark, snapshot, property, etc) but there
61 * is no validation in the preflight zfs_check_input_nvpairs() check.
64 ZK_OPTIONAL
= 1 << 0, /* pair is optional */
65 ZK_WILDCARDLIST
= 1 << 1, /* one or more unspecified key names */
68 typedef struct zfs_ioc_key
{
69 const char *zkey_name
;
70 data_type_t zkey_type
;
71 ioc_key_flag_t zkey_flags
;
74 int zfs_secpolicy_config(zfs_cmd_t
*, nvlist_t
*, cred_t
*);
76 void zfs_ioctl_register_dataset_nolog(zfs_ioc_t
, zfs_ioc_legacy_func_t
*,
77 zfs_secpolicy_func_t
*, zfs_ioc_poolcheck_t
);
79 void zfs_ioctl_register(const char *, zfs_ioc_t
, zfs_ioc_func_t
*,
80 zfs_secpolicy_func_t
*, zfs_ioc_namecheck_t
, zfs_ioc_poolcheck_t
,
81 boolean_t
, boolean_t
, const zfs_ioc_key_t
*, size_t);
83 uint64_t zfs_max_nvlist_src_size_os(void);
84 void zfs_ioctl_update_mount_cache(const char *dsname
);
85 void zfs_ioctl_init_os(void);
87 boolean_t
zfs_vfs_held(zfsvfs_t
*);
88 int zfs_vfs_ref(zfsvfs_t
**);
89 void zfs_vfs_rele(zfsvfs_t
*);
91 long zfsdev_ioctl_common(uint_t
, zfs_cmd_t
*, int);
92 int zfsdev_attach(void);
93 void zfsdev_detach(void);
94 void zfsdev_private_set_state(void *, zfsdev_state_t
*);
95 zfsdev_state_t
*zfsdev_private_get_state(void *);
96 int zfsdev_state_init(void *);
97 void zfsdev_state_destroy(void *);
98 int zfs_kmod_init(void);
99 void zfs_kmod_fini(void);