zfs_ioctl.h revision 98110f08fa182032082d98be2ddb9391fcd62bf1
/*
* 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
* 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
*/
/*
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
*/
#ifndef _SYS_ZFS_IOCTL_H
#define _SYS_ZFS_IOCTL_H
#include <sys/dsl_deleg.h>
#include <sys/zfs_stat.h>
#ifdef _KERNEL
#endif /* _KERNEL */
#ifdef __cplusplus
extern "C" {
#endif
/*
* The structures in this file are passed between userland and the
* kernel. Userland may be running a 32-bit process, while the kernel
* is 64-bit. Therefore, these structures need to compile the same in
* 32-bit and 64-bit. This means not using type "long", and adding
* explicit padding so that the 32-bit structure will not be packed more
* tightly than the 64-bit structure (which requires 64-bit alignment).
*/
/*
* Property values for snapdir
*/
#define ZFS_SNAPDIR_HIDDEN 0
#define ZFS_SNAPDIR_VISIBLE 1
/*
* Field manipulation macros for the drr_versioninfo field of the
* send stream header.
*/
/*
* Header types for zfs send streams.
*/
typedef enum drr_headertype {
DMU_SUBSTREAM = 0x1,
DMU_COMPOUNDSTREAM = 0x2
/*
* Feature flags for zfs send streams (flags in drr_versioninfo)
*/
#define DMU_BACKUP_FEATURE_DEDUP (1<<0)
/* flags #3 - #15 are reserved for incompatible closed-source implementations */
/* flag #18 is reserved for a Delphix feature */
/*
* Mask of all supported backup features
*/
#define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP | \
/* Are all features in the given flag word currently supported? */
#define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))
/*
* The drr_versioninfo field of the dmu_replay_record has the
* following layout:
*
* 64 56 48 40 32 24 16 8 0
* +-------+-------+-------+-------+-------+-------+-------+-------+
* | reserved | feature-flags |C|S|
* +-------+-------+-------+-------+-------+-------+-------+-------+
*
* The low order two bits indicate the header type: SUBSTREAM (0x1)
* or COMPOUNDSTREAM (0x2). Using two bits for this is historical:
* this field used to be a version number, where the two version types
* were 1 and 2. Using two bits for this allows earlier versions of
* the code to be able to recognize send streams that don't use any
* of the features indicated by feature flags.
*/
#define DMU_BACKUP_MAGIC 0x2F5bacbacULL
#define DRR_FLAG_CLONE (1<<0)
/*
* flags in the drr_checksumflags field in the DRR_WRITE and
* DRR_WRITE_BYREF blocks
*/
#define DRR_CHECKSUM_DEDUP (1<<0)
/*
* zfs ioctl command structure
*/
typedef struct dmu_replay_record {
enum {
} drr_type;
union {
struct drr_begin {
char drr_toname[MAXNAMELEN];
} drr_begin;
struct drr_end {
} drr_end;
struct drr_object {
/* bonus content follows */
} drr_object;
struct drr_freeobjects {
struct drr_write {
/* content follows */
} drr_write;
struct drr_free {
} drr_free;
struct drr_write_byref {
/* where to put the data */
/* where to find the prior copy of the data */
/* properties of the data */
struct drr_spill {
/* spill data follows */
} drr_spill;
struct drr_write_embedded {
/* logical length, should equal blocksize */
/* (possibly compressed) content follows */
/*
* Nore: drr_checksum is overlaid with all record types
* except DRR_BEGIN. Therefore its (non-pad) members
* must not overlap with members from the other structs.
* We accomplish this by putting its members at the very
* end of the struct.
*/
struct drr_checksum {
/*
* fletcher-4 checksum of everything preceding the
* checksum.
*/
} drr_checksum;
} drr_u;
/* diff record range types */
typedef enum diff_type {
DDR_NONE = 0x1,
DDR_INUSE = 0x2,
DDR_FREE = 0x4
} diff_type_t;
/*
* The diff reports back ranges of free or in-use objects.
*/
typedef struct dmu_diff_record {
typedef struct zinject_record {
char zi_func[MAXNAMELEN];
#define ZINJECT_NULL 0x1
#define ZINJECT_FLUSH_ARC 0x2
#define ZINJECT_UNLOAD_SPA 0x4
typedef enum zinject_type {
typedef struct zfs_share {
} zfs_share_t;
/*
* ZFS file systems may behave the usual, POSIX-compliant way, where
* name lookups are case-sensitive. They may also be set up so that
* all the name lookups are case-insensitive, or so that only some
* lookups, the ones that set an FIGNORECASE flag, are case-insensitive.
*/
typedef enum zfs_case {
} zfs_case_t;
typedef struct zfs_cmd {
int zc_pad2;
/*
* The following members are for legacy ioctls which haven't been
* converted to the new method.
*/
char zc_string[MAXNAMELEN];
struct drr_begin zc_begin_record;
int zc_cleanup_fd;
} zfs_cmd_t;
typedef struct zfs_useracct {
char zu_domain[256];
#define ZPOOL_EXPORT_AFTER_SPLIT 0x1
#ifdef _KERNEL
typedef struct zfs_creat {
} zfs_creat_t;
extern dev_info_t *zfs_dip;
extern int zfs_secpolicy_rename_perms(const char *from,
extern int zfs_busy(void);
extern int zfs_unmount_snap(const char *);
extern void zfs_destroy_unmount_origin(const char *);
/*
* ZFS minor numbers can refer to either a control device instance or
* a zvol. Depending on the value of zss_type, zss_data points to either
* a zvol_state_t or a zfs_onexit_t.
*/
enum zfs_soft_state_type {
};
typedef struct zfs_soft_state {
enum zfs_soft_state_type zss_type;
void *zss_data;
enum zfs_soft_state_type which);
extern minor_t zfsdev_minor_alloc(void);
extern void *zfsdev_state;
extern kmutex_t zfsdev_state_lock;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ZFS_IOCTL_H */