mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
OpenZFS restructuring - zfs_ioctl
Refactor the zfs ioctls in to platform dependent and independent bits. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Sean Eric Fagan <sef@ixsystems.com> Signed-off-by: Matthew Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@ixsystems.com> Closes #9301
This commit is contained in:
committed by
Brian Behlendorf
parent
3768db24ab
commit
7bb0c29468
@@ -194,8 +194,6 @@ typedef struct zfid_long {
|
||||
#define SHORT_FID_LEN (sizeof (zfid_short_t) - sizeof (uint16_t))
|
||||
#define LONG_FID_LEN (sizeof (zfid_long_t) - sizeof (uint16_t))
|
||||
|
||||
extern uint_t zfs_fsyncer_key;
|
||||
|
||||
extern int zfs_suspend_fs(zfsvfs_t *zfsvfs);
|
||||
extern int zfs_resume_fs(zfsvfs_t *zfsvfs, struct dsl_dataset *ds);
|
||||
extern int zfs_end_fs(zfsvfs_t *zfsvfs, struct dsl_dataset *ds);
|
||||
|
||||
@@ -124,6 +124,7 @@ COMMON_H = \
|
||||
|
||||
KERNEL_H = \
|
||||
$(top_srcdir)/include/sys/zfs_ioctl.h \
|
||||
$(top_srcdir)/include/sys/zfs_ioctl_impl.h \
|
||||
$(top_srcdir)/include/sys/zfs_onexit.h \
|
||||
$(top_srcdir)/include/sys/zvol.h \
|
||||
$(top_srcdir)/include/sys/zvol_impl.h
|
||||
|
||||
@@ -39,6 +39,8 @@ extern "C" {
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/refcount.h>
|
||||
|
||||
extern uint_t rrw_tsd_key;
|
||||
|
||||
/*
|
||||
* A reader-writer lock implementation that allows re-entrant reads, but
|
||||
* still gives writers priority on "new" reads.
|
||||
|
||||
@@ -549,6 +549,9 @@ extern void *zfsdev_get_state(minor_t minor, enum zfsdev_state_type which);
|
||||
extern int zfsdev_getminor(struct file *filp, minor_t *minorp);
|
||||
extern minor_t zfsdev_minor_alloc(void);
|
||||
|
||||
extern uint_t zfs_fsyncer_key;
|
||||
extern uint_t zfs_allow_log_key;
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZFS_IOCTL_IMPL_H_
|
||||
#define _ZFS_IOCTL_IMPL_H_
|
||||
|
||||
extern kmutex_t zfsdev_state_lock;
|
||||
extern zfsdev_state_t *zfsdev_state_list;
|
||||
|
||||
typedef int zfs_ioc_legacy_func_t(zfs_cmd_t *);
|
||||
typedef int zfs_ioc_func_t(const char *, nvlist_t *, nvlist_t *);
|
||||
typedef int zfs_secpolicy_func_t(zfs_cmd_t *, nvlist_t *, cred_t *);
|
||||
|
||||
typedef enum {
|
||||
POOL_CHECK_NONE = 1 << 0,
|
||||
POOL_CHECK_SUSPENDED = 1 << 1,
|
||||
POOL_CHECK_READONLY = 1 << 2,
|
||||
} zfs_ioc_poolcheck_t;
|
||||
|
||||
typedef enum {
|
||||
NO_NAME,
|
||||
POOL_NAME,
|
||||
DATASET_NAME,
|
||||
ENTITY_NAME
|
||||
} zfs_ioc_namecheck_t;
|
||||
|
||||
/*
|
||||
* IOC Keys are used to document and validate user->kernel interface inputs.
|
||||
* See zfs_keys_recv_new for an example declaration. Any key name that is not
|
||||
* listed will be rejected as input.
|
||||
*
|
||||
* The keyname 'optional' is always allowed, and must be an nvlist if present.
|
||||
* Arguments which older kernels can safely ignore can be placed under the
|
||||
* "optional" key.
|
||||
*
|
||||
* When adding new keys to an existing ioc for new functionality, consider:
|
||||
* - adding an entry into zfs_sysfs.c zfs_features[] list
|
||||
* - updating the libzfs_input_check.c test utility
|
||||
*
|
||||
* Note: in the ZK_WILDCARDLIST case, the name serves as documentation
|
||||
* for the expected name (bookmark, snapshot, property, etc) but there
|
||||
* is no validation in the preflight zfs_check_input_nvpairs() check.
|
||||
*/
|
||||
typedef enum {
|
||||
ZK_OPTIONAL = 1 << 0, /* pair is optional */
|
||||
ZK_WILDCARDLIST = 1 << 1, /* one or more unspecified key names */
|
||||
} ioc_key_flag_t;
|
||||
|
||||
typedef struct zfs_ioc_key {
|
||||
const char *zkey_name;
|
||||
data_type_t zkey_type;
|
||||
ioc_key_flag_t zkey_flags;
|
||||
} zfs_ioc_key_t;
|
||||
|
||||
int zfs_secpolicy_config(zfs_cmd_t *, nvlist_t *, cred_t *);
|
||||
|
||||
void zfs_ioctl_register_dataset_nolog(zfs_ioc_t, zfs_ioc_legacy_func_t *,
|
||||
zfs_secpolicy_func_t *, zfs_ioc_poolcheck_t);
|
||||
|
||||
void zfs_ioctl_register(const char *, zfs_ioc_t, zfs_ioc_func_t *,
|
||||
zfs_secpolicy_func_t *, zfs_ioc_namecheck_t, zfs_ioc_poolcheck_t,
|
||||
boolean_t, boolean_t, const zfs_ioc_key_t *, size_t);
|
||||
|
||||
void zfs_ioctl_init_os(void);
|
||||
|
||||
int zfs_vfs_ref(zfsvfs_t **);
|
||||
|
||||
long zfsdev_ioctl_common(uint_t, unsigned long);
|
||||
int zfsdev_attach(void);
|
||||
void zfsdev_detach(void);
|
||||
int zfs_kmod_init(void);
|
||||
void zfs_kmod_fini(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user