zfs_ioctl.h revision 2c2961f8403049d948b9f3e6c35d6488b6b7e1aa
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * or http://www.opensolaris.org/os/licensing.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#ifndef _SYS_ZFS_IOCTL_H
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define _SYS_ZFS_IOCTL_H
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#include <sys/cred.h>
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#include <sys/dmu.h>
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#include <sys/zio.h>
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#include <sys/dsl_deleg.h>
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#ifdef _KERNEL
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#include <sys/nvpair.h>
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#endif /* _KERNEL */
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#ifdef __cplusplus
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeeextern "C" {
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#endif
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee/*
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * Property values for snapdir
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define ZFS_SNAPDIR_HIDDEN 0
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define ZFS_SNAPDIR_VISIBLE 1
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define DMU_BACKUP_STREAM_VERSION (1ULL)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define DMU_BACKUP_HEADER_VERSION (2ULL)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define DMU_BACKUP_MAGIC 0x2F5bacbacULL
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define DRR_FLAG_CLONE (1<<0)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define DRR_FLAG_CI_DATA (1<<1)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * zfs ioctl command structure
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahltypedef struct dmu_replay_record {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl enum {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
9512fe850e98fdd448c638ca63fdd92a8a510255ahl DRR_WRITE, DRR_FREE, DRR_END,
9512fe850e98fdd448c638ca63fdd92a8a510255ahl } drr_type;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint32_t drr_payloadlen;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl union {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct drr_begin {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint64_t drr_magic;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint64_t drr_version;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint64_t drr_creation_time;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl dmu_objset_type_t drr_type;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint32_t drr_flags;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint64_t drr_toguid;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint64_t drr_fromguid;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl char drr_toname[MAXNAMELEN];
9512fe850e98fdd448c638ca63fdd92a8a510255ahl } drr_begin;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct drr_end {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl zio_cksum_t drr_checksum;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl } drr_end;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct drr_object {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl uint64_t drr_object;
dmu_object_type_t drr_type;
dmu_object_type_t drr_bonustype;
uint32_t drr_blksz;
uint32_t drr_bonuslen;
uint8_t drr_checksum;
uint8_t drr_compress;
uint8_t drr_pad[6];
/* bonus content follows */
} drr_object;
struct drr_freeobjects {
uint64_t drr_firstobj;
uint64_t drr_numobjs;
} drr_freeobjects;
struct drr_write {
uint64_t drr_object;
dmu_object_type_t drr_type;
uint32_t drr_pad;
uint64_t drr_offset;
uint64_t drr_length;
/* content follows */
} drr_write;
struct drr_free {
uint64_t drr_object;
uint64_t drr_offset;
uint64_t drr_length;
} drr_free;
} drr_u;
} dmu_replay_record_t;
typedef struct zinject_record {
uint64_t zi_objset;
uint64_t zi_object;
uint64_t zi_start;
uint64_t zi_end;
uint64_t zi_guid;
uint32_t zi_level;
uint32_t zi_error;
uint64_t zi_type;
uint32_t zi_freq;
uint32_t zi_pad; /* pad out to 64 bit alignment */
} zinject_record_t;
#define ZINJECT_NULL 0x1
#define ZINJECT_FLUSH_ARC 0x2
#define ZINJECT_UNLOAD_SPA 0x4
typedef struct zfs_share {
uint64_t z_exportdata;
uint64_t z_sharedata;
uint64_t z_sharetype; /* 0 = share, 1 = unshare */
uint64_t z_sharemax; /* max length of share string */
} 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_SENSITIVE,
ZFS_CASE_INSENSITIVE,
ZFS_CASE_MIXED
} zfs_case_t;
typedef struct zfs_cmd {
char zc_name[MAXPATHLEN];
char zc_value[MAXPATHLEN * 2];
char zc_string[MAXNAMELEN];
uint64_t zc_guid;
uint64_t zc_nvlist_conf; /* really (char *) */
uint64_t zc_nvlist_conf_size;
uint64_t zc_nvlist_src; /* really (char *) */
uint64_t zc_nvlist_src_size;
uint64_t zc_nvlist_dst; /* really (char *) */
uint64_t zc_nvlist_dst_size;
uint64_t zc_cookie;
uint64_t zc_objset_type;
uint64_t zc_perm_action;
uint64_t zc_history; /* really (char *) */
uint64_t zc_history_len;
uint64_t zc_history_offset;
uint64_t zc_obj;
zfs_share_t zc_share;
dmu_objset_stats_t zc_objset_stats;
struct drr_begin zc_begin_record;
zinject_record_t zc_inject_record;
} zfs_cmd_t;
#define ZVOL_MAX_MINOR (1 << 16)
#define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1)
#ifdef _KERNEL
typedef struct zfs_creat {
nvlist_t *zct_zplprops;
nvlist_t *zct_props;
} zfs_creat_t;
extern dev_info_t *zfs_dip;
extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
extern int zfs_secpolicy_rename_perms(const char *from,
const char *to, cred_t *cr);
extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
extern int zfs_busy(void);
extern int zfs_unmount_snap(char *, void *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ZFS_IOCTL_H */