config/dracut/90zfs: handle cases where hostid(1) returns all zeros
[zfs.git] / include / sys / zfs_ioctl_impl.h
blob787475cf396c24294b342b01253889237bd91154
1 /*
2 * CDDL HEADER START
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 http://www.opensolaris.org/os/licensing.
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]
19 * CDDL HEADER END
23 #ifndef _ZFS_IOCTL_IMPL_H_
24 #define _ZFS_IOCTL_IMPL_H_
26 extern kmutex_t zfsdev_state_lock;
27 extern zfsdev_state_t *zfsdev_state_list;
28 extern unsigned long zfs_max_nvlist_src_size;
30 typedef int zfs_ioc_legacy_func_t(zfs_cmd_t *);
31 typedef int zfs_ioc_func_t(const char *, nvlist_t *, nvlist_t *);
32 typedef int zfs_secpolicy_func_t(zfs_cmd_t *, nvlist_t *, cred_t *);
34 typedef enum {
35 POOL_CHECK_NONE = 1 << 0,
36 POOL_CHECK_SUSPENDED = 1 << 1,
37 POOL_CHECK_READONLY = 1 << 2,
38 } zfs_ioc_poolcheck_t;
40 typedef enum {
41 NO_NAME,
42 POOL_NAME,
43 DATASET_NAME,
44 ENTITY_NAME
45 } zfs_ioc_namecheck_t;
48 * IOC Keys are used to document and validate user->kernel interface inputs.
49 * See zfs_keys_recv_new for an example declaration. Any key name that is not
50 * listed will be rejected as input.
52 * The keyname 'optional' is always allowed, and must be an nvlist if present.
53 * Arguments which older kernels can safely ignore can be placed under the
54 * "optional" key.
56 * When adding new keys to an existing ioc for new functionality, consider:
57 * - adding an entry into zfs_sysfs.c zfs_features[] list
58 * - updating the libzfs_input_check.c test utility
60 * Note: in the ZK_WILDCARDLIST case, the name serves as documentation
61 * for the expected name (bookmark, snapshot, property, etc) but there
62 * is no validation in the preflight zfs_check_input_nvpairs() check.
64 typedef enum {
65 ZK_OPTIONAL = 1 << 0, /* pair is optional */
66 ZK_WILDCARDLIST = 1 << 1, /* one or more unspecified key names */
67 } ioc_key_flag_t;
69 typedef struct zfs_ioc_key {
70 const char *zkey_name;
71 data_type_t zkey_type;
72 ioc_key_flag_t zkey_flags;
73 } zfs_ioc_key_t;
75 int zfs_secpolicy_config(zfs_cmd_t *, nvlist_t *, cred_t *);
77 void zfs_ioctl_register_dataset_nolog(zfs_ioc_t, zfs_ioc_legacy_func_t *,
78 zfs_secpolicy_func_t *, zfs_ioc_poolcheck_t);
80 void zfs_ioctl_register(const char *, zfs_ioc_t, zfs_ioc_func_t *,
81 zfs_secpolicy_func_t *, zfs_ioc_namecheck_t, zfs_ioc_poolcheck_t,
82 boolean_t, boolean_t, const zfs_ioc_key_t *, size_t);
84 uint64_t zfs_max_nvlist_src_size_os(void);
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 int zfs_kmod_init(void);
95 void zfs_kmod_fini(void);
97 #endif