summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-10-19 20:35:05 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-10-19 20:35:05 +0300
commit3af33e7764bf21bc070c2d8535b4851a26a959e3 (patch)
treec1d9c73bea7f20959636e7d2b37938b11be4fe82
parent1277d7f92c1007add04fcc6d183fdfc0ba95260c (diff)
downloadillumos-packaging-3af33e7764bf21bc070c2d8535b4851a26a959e3.tar.gz
Added basic ABI sanity test
-rwxr-xr-xuts/debian/abi-check17
-rw-r--r--uts/debian/refs/usr/include/sys/fs/zfs.h949
-rw-r--r--uts/debian/refs/usr/include/sys/lofi.h305
-rw-r--r--uts/debian/refs/usr/include/sys/syscall.h526
-rw-r--r--uts/debian/refs/usr/include/sys/zfs_ioctl.h420
-rwxr-xr-xuts/debian/rules1
6 files changed, 2218 insertions, 0 deletions
diff --git a/uts/debian/abi-check b/uts/debian/abi-check
new file mode 100755
index 0000000..383069d
--- /dev/null
+++ b/uts/debian/abi-check
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+ref="$1"
+new="$2"
+
+for f in $(cd "$ref" && find -type f); do
+ diff -dub "$ref/$f" "$new/$f" || {
+ echo "File \`$f' has changed, please review," >&2
+ echo "then update $new/$f -> $ref/$f" >&2
+ exit 255
+ }
+done
+
+exit 0
+
diff --git a/uts/debian/refs/usr/include/sys/fs/zfs.h b/uts/debian/refs/usr/include/sys/fs/zfs.h
new file mode 100644
index 0000000..bc9f057
--- /dev/null
+++ b/uts/debian/refs/usr/include/sys/fs/zfs.h
@@ -0,0 +1,949 @@
+/*
+ * 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
+ */
+
+/*
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+/* Portions Copyright 2010 Robert Milkowski */
+
+#ifndef _SYS_FS_ZFS_H
+#define _SYS_FS_ZFS_H
+
+#include <sys/time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Types and constants shared between userland and the kernel.
+ */
+
+/*
+ * Each dataset can be one of the following types. These constants can be
+ * combined into masks that can be passed to various functions.
+ */
+typedef enum {
+ ZFS_TYPE_FILESYSTEM = (1 << 0),
+ ZFS_TYPE_SNAPSHOT = (1 << 1),
+ ZFS_TYPE_VOLUME = (1 << 2),
+ ZFS_TYPE_POOL = (1 << 3),
+ ZFS_TYPE_BOOKMARK = (1 << 4)
+} zfs_type_t;
+
+typedef enum dmu_objset_type {
+ DMU_OST_NONE,
+ DMU_OST_META,
+ DMU_OST_ZFS,
+ DMU_OST_ZVOL,
+ DMU_OST_OTHER, /* For testing only! */
+ DMU_OST_ANY, /* Be careful! */
+ DMU_OST_NUMTYPES
+} dmu_objset_type_t;
+
+#define ZFS_TYPE_DATASET \
+ (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
+
+#define ZAP_MAXNAMELEN 256
+#define ZAP_MAXVALUELEN (1024 * 8)
+#define ZAP_OLDMAXVALUELEN 1024
+
+/*
+ * Dataset properties are identified by these constants and must be added to
+ * the end of this list to ensure that external consumers are not affected
+ * by the change. If you make any changes to this list, be sure to update
+ * the property table in usr/src/common/zfs/zfs_prop.c.
+ */
+typedef enum {
+ ZFS_PROP_TYPE,
+ ZFS_PROP_CREATION,
+ ZFS_PROP_USED,
+ ZFS_PROP_AVAILABLE,
+ ZFS_PROP_REFERENCED,
+ ZFS_PROP_COMPRESSRATIO,
+ ZFS_PROP_MOUNTED,
+ ZFS_PROP_ORIGIN,
+ ZFS_PROP_QUOTA,
+ ZFS_PROP_RESERVATION,
+ ZFS_PROP_VOLSIZE,
+ ZFS_PROP_VOLBLOCKSIZE,
+ ZFS_PROP_RECORDSIZE,
+ ZFS_PROP_MOUNTPOINT,
+ ZFS_PROP_SHARENFS,
+ ZFS_PROP_CHECKSUM,
+ ZFS_PROP_COMPRESSION,
+ ZFS_PROP_ATIME,
+ ZFS_PROP_DEVICES,
+ ZFS_PROP_EXEC,
+ ZFS_PROP_SETUID,
+ ZFS_PROP_READONLY,
+ ZFS_PROP_ZONED,
+ ZFS_PROP_SNAPDIR,
+ ZFS_PROP_ACLMODE,
+ ZFS_PROP_ACLINHERIT,
+ ZFS_PROP_CREATETXG, /* not exposed to the user */
+ ZFS_PROP_NAME, /* not exposed to the user */
+ ZFS_PROP_CANMOUNT,
+ ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */
+ ZFS_PROP_XATTR,
+ ZFS_PROP_NUMCLONES, /* not exposed to the user */
+ ZFS_PROP_COPIES,
+ ZFS_PROP_VERSION,
+ ZFS_PROP_UTF8ONLY,
+ ZFS_PROP_NORMALIZE,
+ ZFS_PROP_CASE,
+ ZFS_PROP_VSCAN,
+ ZFS_PROP_NBMAND,
+ ZFS_PROP_SHARESMB,
+ ZFS_PROP_REFQUOTA,
+ ZFS_PROP_REFRESERVATION,
+ ZFS_PROP_GUID,
+ ZFS_PROP_PRIMARYCACHE,
+ ZFS_PROP_SECONDARYCACHE,
+ ZFS_PROP_USEDSNAP,
+ ZFS_PROP_USEDDS,
+ ZFS_PROP_USEDCHILD,
+ ZFS_PROP_USEDREFRESERV,
+ ZFS_PROP_USERACCOUNTING, /* not exposed to the user */
+ ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */
+ ZFS_PROP_DEFER_DESTROY,
+ ZFS_PROP_USERREFS,
+ ZFS_PROP_LOGBIAS,
+ ZFS_PROP_UNIQUE, /* not exposed to the user */
+ ZFS_PROP_OBJSETID, /* not exposed to the user */
+ ZFS_PROP_DEDUP,
+ ZFS_PROP_MLSLABEL,
+ ZFS_PROP_SYNC,
+ ZFS_PROP_REFRATIO,
+ ZFS_PROP_WRITTEN,
+ ZFS_PROP_CLONES,
+ ZFS_PROP_LOGICALUSED,
+ ZFS_PROP_LOGICALREFERENCED,
+ ZFS_PROP_INCONSISTENT, /* not exposed to the user */
+ ZFS_PROP_FILESYSTEM_LIMIT,
+ ZFS_PROP_SNAPSHOT_LIMIT,
+ ZFS_PROP_FILESYSTEM_COUNT,
+ ZFS_PROP_SNAPSHOT_COUNT,
+ ZFS_PROP_REDUNDANT_METADATA,
+ ZFS_PROP_PREV_SNAP,
+ ZFS_PROP_RECEIVE_RESUME_TOKEN,
+ ZFS_NUM_PROPS
+} zfs_prop_t;
+
+typedef enum {
+ ZFS_PROP_USERUSED,
+ ZFS_PROP_USERQUOTA,
+ ZFS_PROP_GROUPUSED,
+ ZFS_PROP_GROUPQUOTA,
+ ZFS_NUM_USERQUOTA_PROPS
+} zfs_userquota_prop_t;
+
+extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
+
+/*
+ * Pool properties are identified by these constants and must be added to the
+ * end of this list to ensure that external consumers are not affected
+ * by the change. If you make any changes to this list, be sure to update
+ * the property table in usr/src/common/zfs/zpool_prop.c.
+ */
+typedef enum {
+ ZPOOL_PROP_NAME,
+ ZPOOL_PROP_SIZE,
+ ZPOOL_PROP_CAPACITY,
+ ZPOOL_PROP_ALTROOT,
+ ZPOOL_PROP_HEALTH,
+ ZPOOL_PROP_GUID,
+ ZPOOL_PROP_VERSION,
+ ZPOOL_PROP_BOOTFS,
+ ZPOOL_PROP_DELEGATION,
+ ZPOOL_PROP_AUTOREPLACE,
+ ZPOOL_PROP_CACHEFILE,
+ ZPOOL_PROP_FAILUREMODE,
+ ZPOOL_PROP_LISTSNAPS,
+ ZPOOL_PROP_AUTOEXPAND,
+ ZPOOL_PROP_DEDUPDITTO,
+ ZPOOL_PROP_DEDUPRATIO,
+ ZPOOL_PROP_FREE,
+ ZPOOL_PROP_ALLOCATED,
+ ZPOOL_PROP_READONLY,
+ ZPOOL_PROP_COMMENT,
+ ZPOOL_PROP_EXPANDSZ,
+ ZPOOL_PROP_FREEING,
+ ZPOOL_PROP_FRAGMENTATION,
+ ZPOOL_PROP_LEAKED,
+ ZPOOL_PROP_MAXBLOCKSIZE,
+ ZPOOL_NUM_PROPS
+} zpool_prop_t;
+
+/* Small enough to not hog a whole line of printout in zpool(1M). */
+#define ZPROP_MAX_COMMENT 32
+
+#define ZPROP_CONT -2
+#define ZPROP_INVAL -1
+
+#define ZPROP_VALUE "value"
+#define ZPROP_SOURCE "source"
+
+typedef enum {
+ ZPROP_SRC_NONE = 0x1,
+ ZPROP_SRC_DEFAULT = 0x2,
+ ZPROP_SRC_TEMPORARY = 0x4,
+ ZPROP_SRC_LOCAL = 0x8,
+ ZPROP_SRC_INHERITED = 0x10,
+ ZPROP_SRC_RECEIVED = 0x20
+} zprop_source_t;
+
+#define ZPROP_SRC_ALL 0x3f
+
+#define ZPROP_SOURCE_VAL_RECVD "$recvd"
+#define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS"
+/*
+ * Dataset flag implemented as a special entry in the props zap object
+ * indicating that the dataset has received properties on or after
+ * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
+ * just as it did in earlier versions, and thereafter, local properties are
+ * preserved.
+ */
+#define ZPROP_HAS_RECVD "$hasrecvd"
+
+typedef enum {
+ ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
+ ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
+} zprop_errflags_t;
+
+typedef int (*zprop_func)(int, void *);
+
+/*
+ * Properties to be set on the root file system of a new pool
+ * are stuffed into their own nvlist, which is then included in
+ * the properties nvlist with the pool properties.
+ */
+#define ZPOOL_ROOTFS_PROPS "root-props-nvl"
+
+/*
+ * Dataset property functions shared between libzfs and kernel.
+ */
+const char *zfs_prop_default_string(zfs_prop_t);
+uint64_t zfs_prop_default_numeric(zfs_prop_t);
+boolean_t zfs_prop_readonly(zfs_prop_t);
+boolean_t zfs_prop_inheritable(zfs_prop_t);
+boolean_t zfs_prop_setonce(zfs_prop_t);
+const char *zfs_prop_to_name(zfs_prop_t);
+zfs_prop_t zfs_name_to_prop(const char *);
+boolean_t zfs_prop_user(const char *);
+boolean_t zfs_prop_userquota(const char *);
+boolean_t zfs_prop_written(const char *);
+int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
+int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
+uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
+boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
+
+/*
+ * Pool property functions shared between libzfs and kernel.
+ */
+zpool_prop_t zpool_name_to_prop(const char *);
+const char *zpool_prop_to_name(zpool_prop_t);
+const char *zpool_prop_default_string(zpool_prop_t);
+uint64_t zpool_prop_default_numeric(zpool_prop_t);
+boolean_t zpool_prop_readonly(zpool_prop_t);
+boolean_t zpool_prop_feature(const char *);
+boolean_t zpool_prop_unsupported(const char *name);
+int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
+int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
+uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
+
+/*
+ * Definitions for the Delegation.
+ */
+typedef enum {
+ ZFS_DELEG_WHO_UNKNOWN = 0,
+ ZFS_DELEG_USER = 'u',
+ ZFS_DELEG_USER_SETS = 'U',
+ ZFS_DELEG_GROUP = 'g',
+ ZFS_DELEG_GROUP_SETS = 'G',
+ ZFS_DELEG_EVERYONE = 'e',
+ ZFS_DELEG_EVERYONE_SETS = 'E',
+ ZFS_DELEG_CREATE = 'c',
+ ZFS_DELEG_CREATE_SETS = 'C',
+ ZFS_DELEG_NAMED_SET = 's',
+ ZFS_DELEG_NAMED_SET_SETS = 'S'
+} zfs_deleg_who_type_t;
+
+typedef enum {
+ ZFS_DELEG_NONE = 0,
+ ZFS_DELEG_PERM_LOCAL = 1,
+ ZFS_DELEG_PERM_DESCENDENT = 2,
+ ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
+ ZFS_DELEG_PERM_CREATE = 4
+} zfs_deleg_inherit_t;
+
+#define ZFS_DELEG_PERM_UID "uid"
+#define ZFS_DELEG_PERM_GID "gid"
+#define ZFS_DELEG_PERM_GROUPS "groups"
+
+#define ZFS_MLSLABEL_DEFAULT "none"
+
+#define ZFS_SMB_ACL_SRC "src"
+#define ZFS_SMB_ACL_TARGET "target"
+
+typedef enum {
+ ZFS_CANMOUNT_OFF = 0,
+ ZFS_CANMOUNT_ON = 1,
+ ZFS_CANMOUNT_NOAUTO = 2
+} zfs_canmount_type_t;
+
+typedef enum {
+ ZFS_LOGBIAS_LATENCY = 0,
+ ZFS_LOGBIAS_THROUGHPUT = 1
+} zfs_logbias_op_t;
+
+typedef enum zfs_share_op {
+ ZFS_SHARE_NFS = 0,
+ ZFS_UNSHARE_NFS = 1,
+ ZFS_SHARE_SMB = 2,
+ ZFS_UNSHARE_SMB = 3
+} zfs_share_op_t;
+
+typedef enum zfs_smb_acl_op {
+ ZFS_SMB_ACL_ADD,
+ ZFS_SMB_ACL_REMOVE,
+ ZFS_SMB_ACL_RENAME,
+ ZFS_SMB_ACL_PURGE
+} zfs_smb_acl_op_t;
+
+typedef enum zfs_cache_type {
+ ZFS_CACHE_NONE = 0,
+ ZFS_CACHE_METADATA = 1,
+ ZFS_CACHE_ALL = 2
+} zfs_cache_type_t;
+
+typedef enum {
+ ZFS_SYNC_STANDARD = 0,
+ ZFS_SYNC_ALWAYS = 1,
+ ZFS_SYNC_DISABLED = 2
+} zfs_sync_type_t;
+
+typedef enum {
+ ZFS_REDUNDANT_METADATA_ALL,
+ ZFS_REDUNDANT_METADATA_MOST
+} zfs_redundant_metadata_type_t;
+
+/*
+ * On-disk version number.
+ */
+#define SPA_VERSION_1 1ULL
+#define SPA_VERSION_2 2ULL
+#define SPA_VERSION_3 3ULL
+#define SPA_VERSION_4 4ULL
+#define SPA_VERSION_5 5ULL
+#define SPA_VERSION_6 6ULL
+#define SPA_VERSION_7 7ULL
+#define SPA_VERSION_8 8ULL
+#define SPA_VERSION_9 9ULL
+#define SPA_VERSION_10 10ULL
+#define SPA_VERSION_11 11ULL
+#define SPA_VERSION_12 12ULL
+#define SPA_VERSION_13 13ULL
+#define SPA_VERSION_14 14ULL
+#define SPA_VERSION_15 15ULL
+#define SPA_VERSION_16 16ULL
+#define SPA_VERSION_17 17ULL
+#define SPA_VERSION_18 18ULL
+#define SPA_VERSION_19 19ULL
+#define SPA_VERSION_20 20ULL
+#define SPA_VERSION_21 21ULL
+#define SPA_VERSION_22 22ULL
+#define SPA_VERSION_23 23ULL
+#define SPA_VERSION_24 24ULL
+#define SPA_VERSION_25 25ULL
+#define SPA_VERSION_26 26ULL
+#define SPA_VERSION_27 27ULL
+#define SPA_VERSION_28 28ULL
+#define SPA_VERSION_5000 5000ULL
+
+/*
+ * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
+ * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
+ * and do the appropriate changes. Also bump the version number in
+ * usr/src/grub/capability.
+ */
+#define SPA_VERSION SPA_VERSION_5000
+#define SPA_VERSION_STRING "5000"
+
+/*
+ * Symbolic names for the changes that caused a SPA_VERSION switch.
+ * Used in the code when checking for presence or absence of a feature.
+ * Feel free to define multiple symbolic names for each version if there
+ * were multiple changes to on-disk structures during that version.
+ *
+ * NOTE: When checking the current SPA_VERSION in your code, be sure
+ * to use spa_version() since it reports the version of the
+ * last synced uberblock. Checking the in-flight version can
+ * be dangerous in some cases.
+ */
+#define SPA_VERSION_INITIAL SPA_VERSION_1
+#define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
+#define SPA_VERSION_SPARES SPA_VERSION_3
+#define SPA_VERSION_RAIDZ2 SPA_VERSION_3
+#define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3
+#define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
+#define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
+#define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
+#define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
+#define SPA_VERSION_BOOTFS SPA_VERSION_6
+#define SPA_VERSION_SLOGS SPA_VERSION_7
+#define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8
+#define SPA_VERSION_FUID SPA_VERSION_9
+#define SPA_VERSION_REFRESERVATION SPA_VERSION_9
+#define SPA_VERSION_REFQUOTA SPA_VERSION_9
+#define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9
+#define SPA_VERSION_L2CACHE SPA_VERSION_10
+#define SPA_VERSION_NEXT_CLONES SPA_VERSION_11
+#define SPA_VERSION_ORIGIN SPA_VERSION_11
+#define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
+#define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
+#define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
+#define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
+#define SPA_VERSION_USERSPACE SPA_VERSION_15
+#define SPA_VERSION_STMF_PROP SPA_VERSION_16
+#define SPA_VERSION_RAIDZ3 SPA_VERSION_17
+#define SPA_VERSION_USERREFS SPA_VERSION_18
+#define SPA_VERSION_HOLES SPA_VERSION_19
+#define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20
+#define SPA_VERSION_DEDUP SPA_VERSION_21
+#define SPA_VERSION_RECVD_PROPS SPA_VERSION_22
+#define SPA_VERSION_SLIM_ZIL SPA_VERSION_23
+#define SPA_VERSION_SA SPA_VERSION_24
+#define SPA_VERSION_SCAN SPA_VERSION_25
+#define SPA_VERSION_DIR_CLONES SPA_VERSION_26
+#define SPA_VERSION_DEADLISTS SPA_VERSION_26
+#define SPA_VERSION_FAST_SNAP SPA_VERSION_27
+#define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28
+#define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28
+#define SPA_VERSION_FEATURES SPA_VERSION_5000
+
+#define SPA_VERSION_IS_SUPPORTED(v) \
+ (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
+ ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
+
+/*
+ * ZPL version - rev'd whenever an incompatible on-disk format change
+ * occurs. This is independent of SPA/DMU/ZAP versioning. You must
+ * also update the version_table[] and help message in zfs_prop.c.
+ *
+ * When changing, be sure to teach GRUB how to read the new format!
+ * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
+ */
+#define ZPL_VERSION_1 1ULL
+#define ZPL_VERSION_2 2ULL
+#define ZPL_VERSION_3 3ULL
+#define ZPL_VERSION_4 4ULL
+#define ZPL_VERSION_5 5ULL
+#define ZPL_VERSION ZPL_VERSION_5
+#define ZPL_VERSION_STRING "5"
+
+#define ZPL_VERSION_INITIAL ZPL_VERSION_1
+#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
+#define ZPL_VERSION_FUID ZPL_VERSION_3
+#define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
+#define ZPL_VERSION_SYSATTR ZPL_VERSION_3
+#define ZPL_VERSION_USERSPACE ZPL_VERSION_4
+#define ZPL_VERSION_SA ZPL_VERSION_5
+
+/* Rewind request information */
+#define ZPOOL_NO_REWIND 1 /* No policy - default behavior */
+#define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */
+#define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */
+#define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */
+#define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */
+#define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */
+#define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */
+
+typedef struct zpool_rewind_policy {
+ uint32_t zrp_request; /* rewind behavior requested */
+ uint64_t zrp_maxmeta; /* max acceptable meta-data errors */
+ uint64_t zrp_maxdata; /* max acceptable data errors */
+ uint64_t zrp_txg; /* specific txg to load */
+} zpool_rewind_policy_t;
+
+/*
+ * The following are configuration names used in the nvlist describing a pool's
+ * configuration.
+ */
+#define ZPOOL_CONFIG_VERSION "version"
+#define ZPOOL_CONFIG_POOL_NAME "name"
+#define ZPOOL_CONFIG_POOL_STATE "state"
+#define ZPOOL_CONFIG_POOL_TXG "txg"
+#define ZPOOL_CONFIG_POOL_GUID "pool_guid"
+#define ZPOOL_CONFIG_CREATE_TXG "create_txg"
+#define ZPOOL_CONFIG_TOP_GUID "top_guid"
+#define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
+#define ZPOOL_CONFIG_TYPE "type"
+#define ZPOOL_CONFIG_CHILDREN "children"
+#define ZPOOL_CONFIG_ID "id"
+#define ZPOOL_CONFIG_GUID "guid"
+#define ZPOOL_CONFIG_PATH "path"
+#define ZPOOL_CONFIG_DEVID "devid"
+#define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
+#define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
+#define ZPOOL_CONFIG_ASHIFT "ashift"
+#define ZPOOL_CONFIG_ASIZE "asize"
+#define ZPOOL_CONFIG_DTL "DTL"
+#define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */
+#define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
+#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
+#define ZPOOL_CONFIG_ERRCOUNT "error_count"
+#define ZPOOL_CONFIG_NOT_PRESENT "not_present"
+#define ZPOOL_CONFIG_SPARES "spares"
+#define ZPOOL_CONFIG_IS_SPARE "is_spare"
+#define ZPOOL_CONFIG_NPARITY "nparity"
+#define ZPOOL_CONFIG_HOSTID "hostid"
+#define ZPOOL_CONFIG_HOSTNAME "hostname"
+#define ZPOOL_CONFIG_LOADED_TIME "initial_load_time"
+#define ZPOOL_CONFIG_UNSPARE "unspare"
+#define ZPOOL_CONFIG_PHYS_PATH "phys_path"
+#define ZPOOL_CONFIG_IS_LOG "is_log"
+#define ZPOOL_CONFIG_L2CACHE "l2cache"
+#define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
+#define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
+#define ZPOOL_CONFIG_IS_HOLE "is_hole"
+#define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
+#define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
+#define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
+#define ZPOOL_CONFIG_SPLIT "splitcfg"
+#define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
+#define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
+#define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
+#define ZPOOL_CONFIG_REMOVING "removing"
+#define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
+#define ZPOOL_CONFIG_COMMENT "comment"
+#define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
+#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
+#define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
+#define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
+#define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
+#define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
+#define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
+#define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */
+#define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
+#define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
+#define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
+/*
+ * The persistent vdev state is stored as separate values rather than a single
+ * 'vdev_state' entry. This is because a device can be in multiple states, such
+ * as offline and degraded.
+ */
+#define ZPOOL_CONFIG_OFFLINE "offline"
+#define ZPOOL_CONFIG_FAULTED "faulted"
+#define ZPOOL_CONFIG_DEGRADED "degraded"
+#define ZPOOL_CONFIG_REMOVED "removed"
+#define ZPOOL_CONFIG_FRU "fru"
+#define ZPOOL_CONFIG_AUX_STATE "aux_state"
+
+/* Rewind policy parameters */
+#define ZPOOL_REWIND_POLICY "rewind-policy"
+#define ZPOOL_REWIND_REQUEST "rewind-request"
+#define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg"
+#define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh"
+#define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh"
+
+/* Rewind data discovered */
+#define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts"
+#define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors"
+#define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind"
+
+#define VDEV_TYPE_ROOT "root"
+#define VDEV_TYPE_MIRROR "mirror"
+#define VDEV_TYPE_REPLACING "replacing"
+#define VDEV_TYPE_RAIDZ "raidz"
+#define VDEV_TYPE_DISK "disk"
+#define VDEV_TYPE_FILE "file"
+#define VDEV_TYPE_MISSING "missing"
+#define VDEV_TYPE_HOLE "hole"
+#define VDEV_TYPE_SPARE "spare"
+#define VDEV_TYPE_LOG "log"
+#define VDEV_TYPE_L2CACHE "l2cache"
+
+/*
+ * This is needed in userland to report the minimum necessary device size.
+ */
+#define SPA_MINDEVSIZE (64ULL << 20)
+
+/*
+ * Set if the fragmentation has not yet been calculated. This can happen
+ * because the space maps have not been upgraded or the histogram feature
+ * is not enabled.
+ */
+#define ZFS_FRAG_INVALID UINT64_MAX
+
+/*
+ * The location of the pool configuration repository, shared between kernel and
+ * userland.
+ */
+#define ZPOOL_CACHE "/etc/zfs/zpool.cache"
+
+/*
+ * vdev states are ordered from least to most healthy.
+ * A vdev that's CANT_OPEN or below is considered unusable.
+ */
+typedef enum vdev_state {
+ VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */
+ VDEV_STATE_CLOSED, /* Not currently open */
+ VDEV_STATE_OFFLINE, /* Not allowed to open */
+ VDEV_STATE_REMOVED, /* Explicitly removed from system */
+ VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
+ VDEV_STATE_FAULTED, /* External request to fault device */
+ VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
+ VDEV_STATE_HEALTHY /* Presumed good */
+} vdev_state_t;
+
+#define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
+
+/*
+ * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
+ * of the vdev stats structure uses these constants to distinguish why.
+ */
+typedef enum vdev_aux {
+ VDEV_AUX_NONE, /* no error */
+ VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
+ VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
+ VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
+ VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
+ VDEV_AUX_TOO_SMALL, /* vdev size is too small */
+ VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
+ VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
+ VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
+ VDEV_AUX_UNSUP_FEAT, /* unsupported features */
+ VDEV_AUX_SPARED, /* hot spare used in another pool */
+ VDEV_AUX_ERR_EXCEEDED, /* too many errors */
+ VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
+ VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */
+ VDEV_AUX_EXTERNAL, /* external diagnosis */
+ VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */
+} vdev_aux_t;
+
+/*
+ * pool state. The following states are written to disk as part of the normal
+ * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
+ * states are software abstractions used at various levels to communicate
+ * pool state.
+ */
+typedef enum pool_state {
+ POOL_STATE_ACTIVE = 0, /* In active use */
+ POOL_STATE_EXPORTED, /* Explicitly exported */
+ POOL_STATE_DESTROYED, /* Explicitly destroyed */
+ POOL_STATE_SPARE, /* Reserved for hot spare use */
+ POOL_STATE_L2CACHE, /* Level 2 ARC device */
+ POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
+ POOL_STATE_UNAVAIL, /* Internal libzfs state */
+ POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
+} pool_state_t;
+
+/*
+ * Scan Functions.
+ */
+typedef enum pool_scan_func {
+ POOL_SCAN_NONE,
+ POOL_SCAN_SCRUB,
+ POOL_SCAN_RESILVER,
+ POOL_SCAN_FUNCS
+} pool_scan_func_t;
+
+/*
+ * ZIO types. Needed to interpret vdev statistics below.
+ */
+typedef enum zio_type {
+ ZIO_TYPE_NULL = 0,
+ ZIO_TYPE_READ,
+ ZIO_TYPE_WRITE,
+ ZIO_TYPE_FREE,
+ ZIO_TYPE_CLAIM,
+ ZIO_TYPE_IOCTL,
+ ZIO_TYPES
+} zio_type_t;
+
+/*
+ * Pool statistics. Note: all fields should be 64-bit because this
+ * is passed between kernel and userland as an nvlist uint64 array.
+ */
+typedef struct pool_scan_stat {
+ /* values stored on disk */
+ uint64_t pss_func; /* pool_scan_func_t */
+ uint64_t pss_state; /* dsl_scan_state_t */
+ uint64_t pss_start_time; /* scan start time */
+ uint64_t pss_end_time; /* scan end time */
+ uint64_t pss_to_examine; /* total bytes to scan */
+ uint64_t pss_examined; /* total examined bytes */
+ uint64_t pss_to_process; /* total bytes to process */
+ uint64_t pss_processed; /* total processed bytes */
+ uint64_t pss_errors; /* scan errors */
+
+ /* values not stored on disk */
+ uint64_t pss_pass_exam; /* examined bytes per scan pass */
+ uint64_t pss_pass_start; /* start time of a scan pass */
+} pool_scan_stat_t;
+
+typedef enum dsl_scan_state {
+ DSS_NONE,
+ DSS_SCANNING,
+ DSS_FINISHED,
+ DSS_CANCELED,
+ DSS_NUM_STATES
+} dsl_scan_state_t;
+
+
+/*
+ * Vdev statistics. Note: all fields should be 64-bit because this
+ * is passed between kernel and userland as an nvlist uint64 array.
+ */
+typedef struct vdev_stat {
+ hrtime_t vs_timestamp; /* time since vdev load */
+ uint64_t vs_state; /* vdev state */
+ uint64_t vs_aux; /* see vdev_aux_t */
+ uint64_t vs_alloc; /* space allocated */
+ uint64_t vs_space; /* total capacity */
+ uint64_t vs_dspace; /* deflated capacity */
+ uint64_t vs_rsize; /* replaceable dev size */
+ uint64_t vs_esize; /* expandable dev size */
+ uint64_t vs_ops[ZIO_TYPES]; /* operation count */
+ uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */
+ uint64_t vs_read_errors; /* read errors */
+ uint64_t vs_write_errors; /* write errors */
+ uint64_t vs_checksum_errors; /* checksum errors */
+ uint64_t vs_self_healed; /* self-healed bytes */
+ uint64_t vs_scan_removing; /* removing? */
+ uint64_t vs_scan_processed; /* scan processed bytes */
+ uint64_t vs_fragmentation; /* device fragmentation */
+} vdev_stat_t;
+
+/*
+ * DDT statistics. Note: all fields should be 64-bit because this
+ * is passed between kernel and userland as an nvlist uint64 array.
+ */
+typedef struct ddt_object {
+ uint64_t ddo_count; /* number of elments in ddt */
+ uint64_t ddo_dspace; /* size of ddt on disk */
+ uint64_t ddo_mspace; /* size of ddt in-core */
+} ddt_object_t;
+
+typedef struct ddt_stat {
+ uint64_t dds_blocks; /* blocks */
+ uint64_t dds_lsize; /* logical size */
+ uint64_t dds_psize; /* physical size */
+ uint64_t dds_dsize; /* deflated allocated size */
+ uint64_t dds_ref_blocks; /* referenced blocks */
+ uint64_t dds_ref_lsize; /* referenced lsize * refcnt */
+ uint64_t dds_ref_psize; /* referenced psize * refcnt */
+ uint64_t dds_ref_dsize; /* referenced dsize * refcnt */
+} ddt_stat_t;
+
+typedef struct ddt_histogram {
+ ddt_stat_t ddh_stat[64]; /* power-of-two histogram buckets */
+} ddt_histogram_t;
+
+#define ZVOL_DRIVER "zvol"
+#define ZFS_DRIVER "zfs"
+#define ZFS_DEV "/dev/zfs"
+
+/* general zvol path */
+#define ZVOL_DIR "/dev/zvol"
+/* expansion */
+#define ZVOL_PSEUDO_DEV "/devices/pseudo/zfs@0:"
+/* for dump and swap */
+#define ZVOL_FULL_DEV_DIR ZVOL_DIR "/dsk/"
+#define ZVOL_FULL_RDEV_DIR ZVOL_DIR "/rdsk/"
+
+#define ZVOL_PROP_NAME "name"
+#define ZVOL_DEFAULT_BLOCKSIZE 8192
+
+/*
+ * /dev/zfs ioctl numbers.
+ */
+typedef enum zfs_ioc {
+ ZFS_IOC_FIRST = ('Z' << 8),
+ ZFS_IOC = ZFS_IOC_FIRST,
+ ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
+ ZFS_IOC_POOL_DESTROY,
+ ZFS_IOC_POOL_IMPORT,
+ ZFS_IOC_POOL_EXPORT,
+ ZFS_IOC_POOL_CONFIGS,
+ ZFS_IOC_POOL_STATS,
+ ZFS_IOC_POOL_TRYIMPORT,
+ ZFS_IOC_POOL_SCAN,
+ ZFS_IOC_POOL_FREEZE,
+ ZFS_IOC_POOL_UPGRADE,
+ ZFS_IOC_POOL_GET_HISTORY,
+ ZFS_IOC_VDEV_ADD,
+ ZFS_IOC_VDEV_REMOVE,
+ ZFS_IOC_VDEV_SET_STATE,
+ ZFS_IOC_VDEV_ATTACH,
+ ZFS_IOC_VDEV_DETACH,
+ ZFS_IOC_VDEV_SETPATH,
+ ZFS_IOC_VDEV_SETFRU,
+ ZFS_IOC_OBJSET_STATS,
+ ZFS_IOC_OBJSET_ZPLPROPS,
+ ZFS_IOC_DATASET_LIST_NEXT,
+ ZFS_IOC_SNAPSHOT_LIST_NEXT,
+ ZFS_IOC_SET_PROP,
+ ZFS_IOC_CREATE,
+ ZFS_IOC_DESTROY,
+ ZFS_IOC_ROLLBACK,
+ ZFS_IOC_RENAME,
+ ZFS_IOC_RECV,
+ ZFS_IOC_SEND,
+ ZFS_IOC_INJECT_FAULT,
+ ZFS_IOC_CLEAR_FAULT,
+ ZFS_IOC_INJECT_LIST_NEXT,
+ ZFS_IOC_ERROR_LOG,
+ ZFS_IOC_CLEAR,
+ ZFS_IOC_PROMOTE,
+ ZFS_IOC_SNAPSHOT,
+ ZFS_IOC_DSOBJ_TO_DSNAME,
+ ZFS_IOC_OBJ_TO_PATH,
+ ZFS_IOC_POOL_SET_PROPS,
+ ZFS_IOC_POOL_GET_PROPS,
+ ZFS_IOC_SET_FSACL,
+ ZFS_IOC_GET_FSACL,
+ ZFS_IOC_SHARE,
+ ZFS_IOC_INHERIT_PROP,
+ ZFS_IOC_SMB_ACL,
+ ZFS_IOC_USERSPACE_ONE,
+ ZFS_IOC_USERSPACE_MANY,
+ ZFS_IOC_USERSPACE_UPGRADE,
+ ZFS_IOC_HOLD,
+ ZFS_IOC_RELEASE,
+ ZFS_IOC_GET_HOLDS,
+ ZFS_IOC_OBJSET_RECVD_PROPS,
+ ZFS_IOC_VDEV_SPLIT,
+ ZFS_IOC_NEXT_OBJ,
+ ZFS_IOC_DIFF,
+ ZFS_IOC_TMP_SNAPSHOT,
+ ZFS_IOC_OBJ_TO_STATS,
+ ZFS_IOC_SPACE_WRITTEN,
+ ZFS_IOC_SPACE_SNAPS,
+ ZFS_IOC_DESTROY_SNAPS,
+ ZFS_IOC_POOL_REGUID,
+ ZFS_IOC_POOL_REOPEN,
+ ZFS_IOC_SEND_PROGRESS,
+ ZFS_IOC_LOG_HISTORY,
+ ZFS_IOC_SEND_NEW,
+ ZFS_IOC_SEND_SPACE,
+ ZFS_IOC_CLONE,
+ ZFS_IOC_BOOKMARK,
+ ZFS_IOC_GET_BOOKMARKS,
+ ZFS_IOC_DESTROY_BOOKMARKS,
+ ZFS_IOC_LAST
+} zfs_ioc_t;
+
+/*
+ * Internal SPA load state. Used by FMA diagnosis engine.
+ */
+typedef enum {
+ SPA_LOAD_NONE, /* no load in progress */
+ SPA_LOAD_OPEN, /* normal open */
+ SPA_LOAD_IMPORT, /* import in progress */
+ SPA_LOAD_TRYIMPORT, /* tryimport in progress */
+ SPA_LOAD_RECOVER, /* recovery requested */
+ SPA_LOAD_ERROR /* load failed */
+} spa_load_state_t;
+
+/*
+ * Bookmark name values.
+ */
+#define ZPOOL_ERR_LIST "error list"
+#define ZPOOL_ERR_DATASET "dataset"
+#define ZPOOL_ERR_OBJECT "object"
+
+#define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1)
+
+/*
+ * The following are names used in the nvlist describing
+ * the pool's history log.
+ */
+#define ZPOOL_HIST_RECORD "history record"
+#define ZPOOL_HIST_TIME "history time"
+#define ZPOOL_HIST_CMD "history command"
+#define ZPOOL_HIST_WHO "history who"
+#define ZPOOL_HIST_ZONE "history zone"
+#define ZPOOL_HIST_HOST "history hostname"
+#define ZPOOL_HIST_TXG "history txg"
+#define ZPOOL_HIST_INT_EVENT "history internal event"
+#define ZPOOL_HIST_INT_STR "history internal str"
+#define ZPOOL_HIST_INT_NAME "internal_name"
+#define ZPOOL_HIST_IOCTL "ioctl"
+#define ZPOOL_HIST_INPUT_NVL "in_nvl"
+#define ZPOOL_HIST_OUTPUT_NVL "out_nvl"
+#define ZPOOL_HIST_DSNAME "dsname"
+#define ZPOOL_HIST_DSID "dsid"
+
+/*
+ * Flags for ZFS_IOC_VDEV_SET_STATE
+ */
+#define ZFS_ONLINE_CHECKREMOVE 0x1
+#define ZFS_ONLINE_UNSPARE 0x2
+#define ZFS_ONLINE_FORCEFAULT 0x4
+#define ZFS_ONLINE_EXPAND 0x8
+#define ZFS_OFFLINE_TEMPORARY 0x1
+
+/*
+ * Flags for ZFS_IOC_POOL_IMPORT
+ */
+#define ZFS_IMPORT_NORMAL 0x0
+#define ZFS_IMPORT_VERBATIM 0x1
+#define ZFS_IMPORT_ANY_HOST 0x2
+#define ZFS_IMPORT_MISSING_LOG 0x4
+#define ZFS_IMPORT_ONLY 0x8
+
+/*
+ * Sysevent payload members. ZFS will generate the following sysevents with the
+ * given payloads:
+ *
+ * ESC_ZFS_RESILVER_START
+ * ESC_ZFS_RESILVER_END
+ * ESC_ZFS_POOL_DESTROY
+ * ESC_ZFS_POOL_REGUID
+ *
+ * ZFS_EV_POOL_NAME DATA_TYPE_STRING
+ * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
+ *
+ * ESC_ZFS_VDEV_REMOVE
+ * ESC_ZFS_VDEV_CLEAR
+ * ESC_ZFS_VDEV_CHECK
+ *
+ * ZFS_EV_POOL_NAME DATA_TYPE_STRING
+ * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
+ * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
+ * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
+ */
+#define ZFS_EV_POOL_NAME "pool_name"
+#define ZFS_EV_POOL_GUID "pool_guid"
+#define ZFS_EV_VDEV_PATH "vdev_path"
+#define ZFS_EV_VDEV_GUID "vdev_guid"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FS_ZFS_H */
diff --git a/uts/debian/refs/usr/include/sys/lofi.h b/uts/debian/refs/usr/include/sys/lofi.h
new file mode 100644
index 0000000..957c4b4
--- /dev/null
+++ b/uts/debian/refs/usr/include/sys/lofi.h
@@ -0,0 +1,305 @@
+/*
+ * 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
+ */
+/*
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ */
+
+#ifndef _SYS_LOFI_H
+#define _SYS_LOFI_H
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/taskq.h>
+#include <sys/vtoc.h>
+#include <sys/dkio.h>
+#include <sys/vnode.h>
+#include <sys/list.h>
+#include <sys/crypto/api.h>
+#include <sys/zone.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * /dev names:
+ * /dev/lofictl - master control device
+ * /dev/lofi - block devices, named by minor number
+ * /dev/rlofi - character devices, named by minor number
+ */
+#define LOFI_DRIVER_NAME "lofi"
+#define LOFI_CTL_NODE "ctl"
+#define LOFI_CTL_NAME LOFI_DRIVER_NAME LOFI_CTL_NODE
+#define LOFI_BLOCK_NAME LOFI_DRIVER_NAME
+#define LOFI_CHAR_NAME "r" LOFI_DRIVER_NAME
+
+#define SEGHDR 1
+#define COMPRESSED 1
+#define UNCOMPRESSED 0
+#define MAXALGLEN 36
+
+/*
+ *
+ * Use is:
+ * ld = open("/dev/lofictl", O_RDWR | O_EXCL);
+ *
+ * lofi must be opened exclusively. Access is controlled by permissions on
+ * the device, which is 644 by default. Write-access is required for ioctls
+ * that change state, but only read-access is required for the ioctls that
+ * return information. Basically, only root can add and remove files, but
+ * non-root can look at the current lists.
+ *
+ * ioctl usage:
+ *
+ * kernel ioctls
+ *
+ * strcpy(li.li_filename, "somefilename");
+ * ioctl(ld, LOFI_MAP_FILE, &li);
+ * newminor = li.li_minor;
+ *
+ * strcpy(li.li_filename, "somefilename");
+ * ioctl(ld, LOFI_UNMAP_FILE, &li);
+ *
+ * strcpy(li.li_filename, "somefilename");
+ * li.li_minor = minor_number;
+ * ioctl(ld, LOFI_MAP_FILE_MINOR, &li);
+ *
+ * li.li_minor = minor_number;
+ * ioctl(ld, LOFI_UNMAP_FILE_MINOR, &li);
+ *
+ * li.li_minor = minor_number;
+ * ioctl(ld, LOFI_GET_FILENAME, &li);
+ * filename = li.li_filename;
+ * encrypted = li.li_crypto_enabled;
+ *
+ * strcpy(li.li_filename, "somefilename");
+ * ioctl(ld, LOFI_GET_MINOR, &li);
+ * minor = li.li_minor;
+ *
+ * li.li_minor = 0;
+ * ioctl(ld, LOFI_GET_MAXMINOR, &li);
+ * maxminor = li.li_minor;
+ *
+ * strcpy(li.li_filename, "somefilename");
+ * li.li_minor = 0;
+ * ioctl(ld, LOFI_CHECK_COMPRESSED, &li);
+ *
+ * If the 'li_force' flag is set for any of the LOFI_UNMAP_* commands, then if
+ * the device is busy, the underlying vnode will be closed, and any subsequent
+ * operations will fail. It will behave as if the device had been forcibly
+ * removed, so the DKIOCSTATE ioctl will return DKIO_DEV_GONE. When the device
+ * is last closed, it will be torn down.
+ *
+ * If the 'li_cleanup' flag is set for any of the LOFI_UNMAP_* commands, then
+ * if the device is busy, it is marked for removal at the next time it is
+ * no longer held open by anybody. When the device is last closed, it will be
+ * torn down.
+ *
+ * Oh, and last but not least: these ioctls are totally private and only
+ * for use by lofiadm(1M).
+ *
+ */
+
+typedef enum iv_method {
+ IVM_NONE, /* no iv needed, iv is null */
+ IVM_ENC_BLKNO /* iv is logical block no. encrypted */
+} iv_method_t;
+
+struct lofi_ioctl {
+ uint32_t li_minor;
+ boolean_t li_force;
+ boolean_t li_cleanup;
+ boolean_t li_readonly;
+ char li_filename[MAXPATHLEN];
+
+ /* the following fields are required for compression support */
+ char li_algorithm[MAXALGLEN];
+
+ /* the following fields are required for encryption support */
+ boolean_t li_crypto_enabled;
+ crypto_mech_name_t li_cipher; /* for data */
+ uint32_t li_key_len; /* for data */
+ char li_key[56]; /* for data: max 448-bit Blowfish key */
+ crypto_mech_name_t li_iv_cipher; /* for iv derivation */
+ uint32_t li_iv_len; /* for iv derivation */
+ iv_method_t li_iv_type; /* for iv derivation */
+};
+
+#define LOFI_IOC_BASE (('L' << 16) | ('F' << 8))
+
+#define LOFI_MAP_FILE (LOFI_IOC_BASE | 0x01)
+#define LOFI_MAP_FILE_MINOR (LOFI_IOC_BASE | 0x02)
+#define LOFI_UNMAP_FILE (LOFI_IOC_BASE | 0x03)
+#define LOFI_UNMAP_FILE_MINOR (LOFI_IOC_BASE | 0x04)
+#define LOFI_GET_FILENAME (LOFI_IOC_BASE | 0x05)
+#define LOFI_GET_MINOR (LOFI_IOC_BASE | 0x06)
+#define LOFI_GET_MAXMINOR (LOFI_IOC_BASE | 0x07)
+#define LOFI_CHECK_COMPRESSED (LOFI_IOC_BASE | 0x08)
+
+/*
+ * file types that might be usable with lofi, maybe. Only regular
+ * files are documented though.
+ */
+#define S_ISLOFIABLE(mode) \
+ (S_ISREG(mode) || S_ISBLK(mode) || S_ISCHR(mode))
+
+#if defined(_KERNEL)
+
+
+/*
+ * Cache decompressed data segments for the compressed lofi images.
+ *
+ * To avoid that we have to decompress data of a compressed
+ * segment multiple times when accessing parts of the segment's
+ * data we cache the uncompressed data, using a simple linked list.
+ */
+struct lofi_comp_cache {
+ list_node_t lc_list; /* linked list */
+ uchar_t *lc_data; /* decompressed segment data */
+ uint64_t lc_index; /* segment index */
+};
+
+#define V_ISLOFIABLE(vtype) \
+ ((vtype == VREG) || (vtype == VBLK) || (vtype == VCHR))
+
+/*
+ * Pre-allocated memory buffers for the purpose of compression
+ */
+struct compbuf {
+ void *buf;
+ uint32_t bufsize;
+ int inuse;
+};
+
+/*
+ * Need exactly 6 bytes to identify encrypted lofi image
+ */
+extern const char lofi_crypto_magic[6];
+#define LOFI_CRYPTO_MAGIC { 'C', 'F', 'L', 'O', 'F', 'I' }
+#define LOFI_CRYPTO_VERSION ((uint16_t)0)
+#define LOFI_CRYPTO_DATA_SECTOR ((uint32_t)16) /* for version 0 */
+
+/*
+ * Crypto metadata for encrypted lofi images
+ * The fields here only satisfy initial implementation requirements.
+ */
+struct crypto_meta {
+ char magic[6]; /* LOFI_CRYPTO_MAGIC */
+ uint16_t version; /* version of encrypted lofi */
+ char reserved1[96]; /* future use */
+ uint32_t data_sector; /* start of data area */
+ char pad[404]; /* end on DEV_BSIZE bdry */
+ /* second header block is not defined at this time */
+};
+
+struct lofi_state {
+ vnode_t *ls_vp; /* open real vnode */
+ vnode_t *ls_stacked_vp; /* open vnode */
+ kmutex_t ls_vp_lock; /* protects ls_vp */
+ kcondvar_t ls_vp_cv; /* signal changes to ls_vp */
+ uint32_t ls_vp_iocount; /* # pending I/O requests */
+ boolean_t ls_vp_closereq; /* force close requested */
+ u_offset_t ls_vp_size;
+ uint32_t ls_blk_open;
+ uint32_t ls_chr_open;
+ uint32_t ls_lyr_open_count;
+ int ls_openflag;
+ boolean_t ls_cleanup; /* cleanup on close */
+ boolean_t ls_readonly;
+ taskq_t *ls_taskq;
+ kstat_t *ls_kstat;
+ kmutex_t ls_kstat_lock;
+ struct dk_geom ls_dkg;
+ struct vtoc ls_vtoc;
+ struct dk_cinfo ls_ci;
+ zone_ref_t ls_zone;
+ list_node_t ls_list; /* all lofis */
+ dev_t ls_dev; /* this node's dev_t */
+
+ /* the following fields are required for compression support */
+ int ls_comp_algorithm_index; /* idx into compress_table */
+ char ls_comp_algorithm[MAXALGLEN];
+ uint32_t ls_uncomp_seg_sz; /* sz of uncompressed segment */
+ uint32_t ls_comp_index_sz; /* number of index entries */
+ uint32_t ls_comp_seg_shift; /* exponent for byte shift */
+ uint32_t ls_uncomp_last_seg_sz; /* sz of last uncomp segment */
+ uint64_t ls_comp_offbase; /* offset of actual compressed data */
+ uint64_t *ls_comp_seg_index; /* array of index entries */
+ caddr_t ls_comp_index_data; /* index pages loaded from file */
+ uint32_t ls_comp_index_data_sz;
+ u_offset_t ls_vp_comp_size; /* actual compressed file size */
+
+ /* pre-allocated list of buffers for compressed segment data */
+ kmutex_t ls_comp_bufs_lock;
+ struct compbuf *ls_comp_bufs;
+
+ /* lock and anchor for compressed segment caching */
+ kmutex_t ls_comp_cache_lock; /* protects ls_comp_cache */
+ list_t ls_comp_cache; /* cached decompressed segs */
+ uint32_t ls_comp_cache_count;
+
+ /* the following fields are required for encryption support */
+ boolean_t ls_crypto_enabled;
+ u_offset_t ls_crypto_offset; /* crypto meta size */
+ struct crypto_meta ls_crypto;
+ crypto_mechanism_t ls_mech; /* for data encr/decr */
+ crypto_key_t ls_key; /* for data encr/decr */
+ crypto_mechanism_t ls_iv_mech; /* for iv derivation */
+ size_t ls_iv_len; /* for iv derivation */
+ iv_method_t ls_iv_type; /* for iv derivation */
+ kmutex_t ls_crypto_lock;
+ crypto_ctx_template_t ls_ctx_tmpl;
+
+};
+
+#endif /* _KERNEL */
+
+/*
+ * Common signature for all lofi compress functions
+ */
+typedef int lofi_compress_func_t(void *src, size_t srclen, void *dst,
+ size_t *destlen, int level);
+
+/*
+ * Information about each compression function
+ */
+typedef struct lofi_compress_info {
+ lofi_compress_func_t *l_decompress;
+ lofi_compress_func_t *l_compress;
+ int l_level;
+ char *l_name; /* algorithm name */
+} lofi_compress_info_t;
+
+enum lofi_compress {
+ LOFI_COMPRESS_GZIP = 0,
+ LOFI_COMPRESS_GZIP_6 = 1,
+ LOFI_COMPRESS_GZIP_9 = 2,
+ LOFI_COMPRESS_LZMA = 3,
+ LOFI_COMPRESS_FUNCTIONS
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_LOFI_H */
diff --git a/uts/debian/refs/usr/include/sys/syscall.h b/uts/debian/refs/usr/include/sys/syscall.h
new file mode 100644
index 0000000..0f4cddf
--- /dev/null
+++ b/uts/debian/refs/usr/include/sys/syscall.h
@@ -0,0 +1,526 @@
+/*
+ * 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
+ */
+
+/*
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
+ * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ */
+
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * system call numbers
+ * syscall(SYS_xxxx, ...)
+ */
+
+ /* syscall enumeration MUST begin with 1 */
+
+ /*
+ * SunOS/SPARC uses 0 for the indirect system call SYS_syscall
+ * but this doesn't count because it is just another way
+ * to specify the real system call number.
+ */
+
+#define SYS_syscall 0
+#define SYS_exit 1
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_linkat 7
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_symlinkat 11
+#define SYS_chdir 12
+#define SYS_time 13
+#define SYS_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_brk 17
+#define SYS_stat 18
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_mount 21
+#define SYS_readlinkat 22
+#define SYS_setuid 23
+#define SYS_getuid 24
+#define SYS_stime 25
+#define SYS_pcsample 26
+#define SYS_alarm 27
+#define SYS_fstat 28
+#define SYS_pause 29
+#define SYS_stty 31
+#define SYS_gtty 32
+#define SYS_access 33
+#define SYS_nice 34
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_pgrpsys 39
+ /*
+ * subcodes:
+ * getpgrp() :: syscall(39,0)
+ * setpgrp() :: syscall(39,1)
+ * getsid(pid) :: syscall(39,2,pid)
+ * setsid() :: syscall(39,3)
+ * getpgid(pid) :: syscall(39,4,pid)
+ * setpgid(pid,pgid) :: syscall(39,5,pid,pgid)
+ */
+#define SYS_uucopystr 40
+#define SYS_pipe2 41
+#define SYS_pipe 42
+#define SYS_times 43
+#define SYS_profil 44
+#define SYS_faccessat 45
+#define SYS_setgid 46
+#define SYS_getgid 47
+#define SYS_mknodat 48
+#define SYS_msgsys 49
+ /*
+ * subcodes:
+ * msgget(...) :: msgsys(0, ...)
+ * msgctl(...) :: msgsys(1, ...)
+ * msgrcv(...) :: msgsys(2, ...)
+ * msgsnd(...) :: msgsys(3, ...)
+ * msgids(...) :: msgsys(4, ...)
+ * msgsnap(...) :: msgsys(5, ...)
+ * see <sys/msg.h>
+ */
+#define SYS_sysi86 50
+ /*
+ * subcodes:
+ * sysi86(code, ...)
+ */
+#define SYS_acct 51
+#define SYS_shmsys 52
+ /*
+ * subcodes:
+ * shmat (...) :: shmsys(0, ...)
+ * shmctl(...) :: shmsys(1, ...)
+ * shmdt (...) :: shmsys(2, ...)
+ * shmget(...) :: shmsys(3, ...)
+ * shmids(...) :: shmsys(4, ...)
+ * see <sys/shm.h>
+ */
+#define SYS_semsys 53
+ /*
+ * subcodes:
+ * semctl(...) :: semsys(0, ...)
+ * semget(...) :: semsys(1, ...)
+ * semop (...) :: semsys(2, ...)
+ * semids(...) :: semsys(3, ...)
+ * semtimedop(...) :: semsys(4, ...)
+ * see <sys/sem.h>
+ */
+#define SYS_ioctl 54
+#define SYS_uadmin 55
+#define SYS_fchownat 56
+#define SYS_utssys 57
+ /*
+ * subcodes (third argument):
+ * uname(obuf) (obsolete) :: syscall(57, obuf, ign, 0)
+ * subcode 1 unused
+ * ustat(dev, obuf) :: syscall(57, obuf, dev, 2)
+ * fusers(path, flags, obuf) :: syscall(57, path, flags, 3, obuf)
+ * see <sys/utssys.h>
+ */
+#define SYS_fdsync 58
+#define SYS_execve 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_fcntl 62
+#define SYS_ulimit 63
+#define SYS_renameat 64
+#define SYS_unlinkat 65
+#define SYS_fstatat 66
+#define SYS_fstatat64 67
+#define SYS_openat 68
+#define SYS_openat64 69
+#define SYS_tasksys 70
+ /*
+ * subcodes:
+ * settaskid(...) :: tasksys(0, ...)
+ * gettaskid(...) :: tasksys(1, ...)
+ * getprojid(...) :: tasksys(2, ...)
+ */
+#define SYS_acctctl 71
+#define SYS_exacctsys 72
+ /*
+ * subcodes:
+ * getacct(...) :: exacct(0, ...)
+ * putacct(...) :: exacct(1, ...)
+ * wracct(...) :: exacct(2, ...)
+ */
+#define SYS_getpagesizes 73
+ /*
+ * subcodes:
+ * getpagesizes2(...) :: getpagesizes(0, ...)
+ * getpagesizes(...) :: getpagesizes(1, ...) legacy
+ */
+#define SYS_rctlsys 74
+ /*
+ * subcodes:
+ * getrctl(...) :: rctlsys(0, ...)
+ * setrctl(...) :: rctlsys(1, ...)
+ * rctllist(...) :: rctlsys(2, ...)
+ * rctlctl(...) :: rctlsys(3, ...)
+ */
+#define SYS_sidsys 75
+ /*
+ * subcodes:
+ * allocids(...) :: sidsys(0, ...)
+ * idmap_reg(...) :: sidsys(1, ...)
+ * idmap_unreg(...) :: sidsys(2, ...)
+ */
+#define SYS_lwp_park 77
+ /*
+ * subcodes:
+ * _lwp_park(timespec_t *, lwpid_t) :: syslwp_park(0, ...)
+ * _lwp_unpark(lwpid_t, int) :: syslwp_park(1, ...)
+ * _lwp_unpark_all(lwpid_t *, int) :: syslwp_park(2, ...)
+ * _lwp_unpark_cancel(lwpid_t *, int) :: syslwp_park(3, ...)
+ * _lwp_set_park(lwpid_t *, int) :: syslwp_park(4, ...)
+ */
+#define SYS_sendfilev 78
+ /*
+ * subcodes :
+ * sendfilev() :: sendfilev(0, ...)
+ * sendfilev64() :: sendfilev(1, ...)
+ */
+#define SYS_rmdir 79
+#define SYS_mkdir 80
+#define SYS_getdents 81
+#define SYS_privsys 82
+ /*
+ * subcodes:
+ * setppriv(...) :: privsys(0, ...)
+ * getppriv(...) :: privsys(1, ...)
+ * getimplinfo(...) :: privsys(2, ...)
+ * setpflags(...) :: privsys(3, ...)
+ * getpflags(...) :: privsys(4, ...)
+ * issetugid(); :: privsys(5)
+ */
+#define SYS_ucredsys 83
+ /*
+ * subcodes:
+ * ucred_get(...) :: ucredsys(0, ...)
+ * getpeerucred(...) :: ucredsys(1, ...)
+ */
+#define SYS_sysfs 84
+ /*
+ * subcodes:
+ * sysfs(code, ...)
+ * see <sys/fstyp.h>
+ */
+#define SYS_getmsg 85
+#define SYS_putmsg 86
+#define SYS_lstat 88
+#define SYS_symlink 89
+#define SYS_readlink 90
+#define SYS_setgroups 91
+#define SYS_getgroups 92
+#define SYS_fchmod 93
+#define SYS_fchown 94
+#define SYS_sigprocmask 95
+#define SYS_sigsuspend 96
+#define SYS_sigaltstack 97
+#define SYS_sigaction 98
+#define SYS_sigpending 99
+ /*
+ * subcodes:
+ * subcode 0 unused
+ * sigpending(...) :: syscall(99, 1, ...)
+ * sigfillset(...) :: syscall(99, 2, ...)
+ */
+#define SYS_context 100
+ /*
+ * subcodes:
+ * getcontext(...) :: syscall(100, 0, ...)
+ * setcontext(...) :: syscall(100, 1, ...)
+ */
+#define SYS_fchmodat 101
+#define SYS_mkdirat 102
+#define SYS_statvfs 103
+#define SYS_fstatvfs 104
+#define SYS_getloadavg 105
+#define SYS_nfssys 106
+#define SYS_waitid 107
+#define SYS_waitsys SYS_waitid /* historical */
+#define SYS_sigsendsys 108
+#define SYS_hrtsys 109
+#define SYS_utimesys 110
+ /*
+ * subcodes:
+ * futimens(...) :: syscall(110, 0, ...)
+ * utimensat(...) :: syscall(110, 1, ...)
+ */
+#define SYS_sigresend 111
+#define SYS_priocntlsys 112
+#define SYS_pathconf 113
+#define SYS_mincore 114
+#define SYS_mmap 115
+#define SYS_mprotect 116
+#define SYS_munmap 117
+#define SYS_fpathconf 118
+#define SYS_vfork 119
+#define SYS_fchdir 120
+#define SYS_readv 121
+#define SYS_writev 122
+#define SYS_preadv 123
+#define SYS_pwritev 124
+#define SYS_getrandom 126
+#define SYS_mmapobj 127
+#define SYS_setrlimit 128
+#define SYS_getrlimit 129
+#define SYS_lchown 130
+#define SYS_memcntl 131
+#define SYS_getpmsg 132
+#define SYS_putpmsg 133
+#define SYS_rename 134
+#define SYS_uname 135
+#define SYS_setegid 136
+#define SYS_sysconfig 137
+#define SYS_adjtime 138
+#define SYS_systeminfo 139
+#define SYS_sharefs 140
+#define SYS_seteuid 141
+#define SYS_forksys 142
+ /*
+ * subcodes:
+ * forkx(flags) :: forksys(0, flags)
+ * forkallx(flags) :: forksys(1, flags)
+ * vforkx(flags) :: forksys(2, flags)
+ */
+#define SYS_sigtimedwait 144
+#define SYS_lwp_info 145
+#define SYS_yield 146
+#define SYS_lwp_sema_post 148
+#define SYS_lwp_sema_trywait 149
+#define SYS_lwp_detach 150
+#define SYS_corectl 151
+#define SYS_modctl 152
+#define SYS_fchroot 153
+#define SYS_vhangup 155
+#define SYS_gettimeofday 156
+#define SYS_getitimer 157
+#define SYS_setitimer 158
+#define SYS_lwp_create 159
+#define SYS_lwp_exit 160
+#define SYS_lwp_suspend 161
+#define SYS_lwp_continue 162
+#define SYS_lwp_kill 163
+#define SYS_lwp_self 164
+#define SYS_lwp_sigmask 165
+#define SYS_lwp_private 166
+#define SYS_lwp_wait 167
+#define SYS_lwp_mutex_wakeup 168
+#define SYS_lwp_cond_wait 170
+#define SYS_lwp_cond_signal 171
+#define SYS_lwp_cond_broadcast 172
+#define SYS_pread 173
+#define SYS_pwrite 174
+#define SYS_llseek 175
+#define SYS_inst_sync 176
+#define SYS_brand 177
+#define SYS_kaio 178
+ /*
+ * subcodes:
+ * aioread(...) :: kaio(AIOREAD, ...)
+ * aiowrite(...) :: kaio(AIOWRITE, ...)
+ * aiowait(...) :: kaio(AIOWAIT, ...)
+ * aiocancel(...) :: kaio(AIOCANCEL, ...)
+ * aionotify() :: kaio(AIONOTIFY)
+ * aioinit() :: kaio(AIOINIT)
+ * aiostart() :: kaio(AIOSTART)
+ * see <sys/aio.h>
+ */
+#define SYS_cpc 179
+#define SYS_lgrpsys 180
+#define SYS_meminfosys SYS_lgrpsys
+ /*
+ * subcodes:
+ * meminfo(...) :: meminfosys(MISYS_MEMINFO, ...)
+ */
+#define SYS_rusagesys 181
+ /*
+ * subcodes:
+ * getrusage(...) :: rusagesys(RUSAGESYS_GETRUSAGE, ...)
+ * getvmusage(...) :: rusagesys(RUSAGESYS_GETVMUSAGE, ...)
+ */
+#define SYS_port 182
+ /*
+ * subcodes:
+ * port_create(...) :: portfs(PORT_CREATE, ...)
+ * port_associate(...) :: portfs(PORT_ASSOCIATE, ...)
+ * port_dissociate(...) :: portfs(PORT_DISSOCIATE, ...)
+ * port_send(...) :: portfs(PORT_SEND, ...)
+ * port_sendn(...) :: portfs(PORT_SENDN, ...)
+ * port_get(...) :: portfs(PORT_GET, ...)
+ * port_getn(...) :: portfs(PORT_GETN, ...)
+ * port_alert(...) :: portfs(PORT_ALERT, ...)
+ * port_dispatch(...) :: portfs(PORT_DISPATCH, ...)
+ */
+#define SYS_pollsys 183
+#define SYS_labelsys 184
+#define SYS_acl 185
+#define SYS_auditsys 186
+#define SYS_processor_bind 187
+#define SYS_processor_info 188
+#define SYS_p_online 189
+#define SYS_sigqueue 190
+#define SYS_clock_gettime 191
+#define SYS_clock_settime 192
+#define SYS_clock_getres 193
+#define SYS_timer_create 194
+#define SYS_timer_delete 195
+#define SYS_timer_settime 196
+#define SYS_timer_gettime 197
+#define SYS_timer_getoverrun 198
+#define SYS_nanosleep 199
+#define SYS_facl 200
+#define SYS_door 201
+ /*
+ * Door Subcodes:
+ * 0 door_create
+ * 1 door_revoke
+ * 2 door_info
+ * 3 door_call
+ * 4 door_return
+ */
+#define SYS_setreuid 202
+#define SYS_setregid 203
+#define SYS_install_utrap 204
+#define SYS_signotify 205
+#define SYS_schedctl 206
+#define SYS_pset 207
+#define SYS_sparc_utrap_install 208
+#define SYS_resolvepath 209
+#define SYS_lwp_mutex_timedlock 210
+#define SYS_lwp_sema_timedwait 211
+#define SYS_lwp_rwlock_sys 212
+ /*
+ * subcodes:
+ * lwp_rwlock_rdlock(...) :: syscall(212, 0, ...)
+ * lwp_rwlock_wrlock(...) :: syscall(212, 1, ...)
+ * lwp_rwlock_tryrdlock(...) :: syscall(212, 2, ...)
+ * lwp_rwlock_trywrlock(...) :: syscall(212, 3, ...)
+ * lwp_rwlock_unlock(...) :: syscall(212, 4, ...)
+ */
+/* system calls for large file ( > 2 gigabyte) support */
+#define SYS_getdents64 213
+#define SYS_mmap64 214
+#define SYS_stat64 215
+#define SYS_lstat64 216
+#define SYS_fstat64 217
+#define SYS_statvfs64 218
+#define SYS_fstatvfs64 219
+#define SYS_setrlimit64 220
+#define SYS_getrlimit64 221
+#define SYS_pread64 222
+#define SYS_pwrite64 223
+#define SYS_accept4 224
+#define SYS_open64 225
+#define SYS_rpcsys 226
+#define SYS_zone 227
+ /*
+ * subcodes:
+ * zone_create(...) :: zone(ZONE_CREATE, ...)
+ * zone_destroy(...) :: zone(ZONE_DESTROY, ...)
+ * zone_getattr(...) :: zone(ZONE_GETATTR, ...)
+ * zone_enter(...) :: zone(ZONE_ENTER, ...)
+ * zone_list(...) :: zone(ZONE_LIST, ...)
+ * zone_shutdown(...) :: zone(ZONE_SHUTDOWN, ...)
+ * zone_lookup(...) :: zone(ZONE_LOOKUP, ...)
+ * zone_boot(...) :: zone(ZONE_BOOT, ...)
+ * zone_version(...) :: zone(ZONE_VERSION, ...)
+ * zone_setattr(...) :: zone(ZONE_SETATTR, ...)
+ * zone_add_datalink(...) :: zone(ZONE_ADD_DATALINK, ...)
+ * zone_remove_datalink(...) :: zone(ZONE_DEL_DATALINK, ...)
+ * zone_check_datalink(...) :: zone(ZONE_CHECK_DATALINK, ...)
+ * zone_list_datalink(...) :: zone(ZONE_LIST_DATALINK, ...)
+ */
+#define SYS_autofssys 228
+#define SYS_getcwd 229
+#define SYS_so_socket 230
+#define SYS_so_socketpair 231
+#define SYS_bind 232
+#define SYS_listen 233
+#define SYS_accept 234
+#define SYS_connect 235
+#define SYS_shutdown 236
+#define SYS_recv 237
+#define SYS_recvfrom 238
+#define SYS_recvmsg 239
+#define SYS_send 240
+#define SYS_sendmsg 241
+#define SYS_sendto 242
+#define SYS_getpeername 243
+#define SYS_getsockname 244
+#define SYS_getsockopt 245
+#define SYS_setsockopt 246
+#define SYS_sockconfig 247
+ /*
+ * NTP codes
+ */
+#define SYS_ntp_gettime 248
+#define SYS_ntp_adjtime 249
+#define SYS_lwp_mutex_unlock 250
+#define SYS_lwp_mutex_trylock 251
+#define SYS_lwp_mutex_register 252
+#define SYS_cladm 253
+#define SYS_uucopy 254
+#define SYS_umount2 255
+
+#ifndef _ASM
+
+typedef struct { /* syscall set type */
+ unsigned int word[16];
+} sysset_t;
+
+typedef struct { /* return values from system call */
+ long sys_rval1; /* primary return value from system call */
+ long sys_rval2; /* second return value from system call */
+} sysret_t;
+
+#if !defined(_KERNEL)
+
+extern int syscall(int, ...);
+extern int __systemcall(sysret_t *, int, ...);
+extern int __set_errno(int);
+
+#endif /* _KERNEL */
+
+#endif /* _ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SYSCALL_H */
diff --git a/uts/debian/refs/usr/include/sys/zfs_ioctl.h b/uts/debian/refs/usr/include/sys/zfs_ioctl.h
new file mode 100644
index 0000000..47799ff
--- /dev/null
+++ b/uts/debian/refs/usr/include/sys/zfs_ioctl.h
@@ -0,0 +1,420 @@
+/*
+ * 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
+ */
+/*
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ */
+
+#ifndef _SYS_ZFS_IOCTL_H
+#define _SYS_ZFS_IOCTL_H
+
+#include <sys/cred.h>
+#include <sys/dmu.h>
+#include <sys/zio.h>
+#include <sys/dsl_deleg.h>
+#include <sys/spa.h>
+#include <sys/zfs_stat.h>
+
+#ifdef _KERNEL
+#include <sys/nvpair.h>
+#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
+} drr_headertype_t;
+
+#define DMU_GET_STREAM_HDRTYPE(vi) BF64_GET((vi), 0, 2)
+#define DMU_SET_STREAM_HDRTYPE(vi, x) BF64_SET((vi), 0, 2, x)
+
+#define DMU_GET_FEATUREFLAGS(vi) BF64_GET((vi), 2, 30)
+#define DMU_SET_FEATUREFLAGS(vi, x) BF64_SET((vi), 2, 30, x)
+
+/*
+ * Feature flags for zfs send streams (flags in drr_versioninfo)
+ */
+
+#define DMU_BACKUP_FEATURE_DEDUP (1 << 0)
+#define DMU_BACKUP_FEATURE_DEDUPPROPS (1 << 1)
+#define DMU_BACKUP_FEATURE_SA_SPILL (1 << 2)
+/* flags #3 - #15 are reserved for incompatible closed-source implementations */
+#define DMU_BACKUP_FEATURE_EMBED_DATA (1 << 16)
+#define DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 (1 << 17)
+/* flag #18 is reserved for a Delphix feature */
+#define DMU_BACKUP_FEATURE_LARGE_BLOCKS (1 << 19)
+#define DMU_BACKUP_FEATURE_RESUMING (1 << 20)
+
+/*
+ * Mask of all supported backup features
+ */
+#define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP | \
+ DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL | \
+ DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 | \
+ DMU_BACKUP_FEATURE_RESUMING | \
+ DMU_BACKUP_FEATURE_LARGE_BLOCKS)
+
+/* Are all features in the given flag word currently supported? */
+#define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))
+
+typedef enum dmu_send_resume_token_version {
+ ZFS_SEND_RESUME_TOKEN_VERSION = 1
+} dmu_send_resume_token_version_t;
+
+/*
+ * 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)
+#define DRR_FLAG_CI_DATA (1<<1)
+
+/*
+ * flags in the drr_checksumflags field in the DRR_WRITE and
+ * DRR_WRITE_BYREF blocks
+ */
+#define DRR_CHECKSUM_DEDUP (1<<0)
+
+#define DRR_IS_DEDUP_CAPABLE(flags) ((flags) & DRR_CHECKSUM_DEDUP)
+
+/*
+ * zfs ioctl command structure
+ */
+typedef struct dmu_replay_record {
+ enum {
+ DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
+ DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF,
+ DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_NUMTYPES
+ } drr_type;
+ uint32_t drr_payloadlen;
+ union {
+ struct drr_begin {
+ uint64_t drr_magic;
+ uint64_t drr_versioninfo; /* was drr_version */
+ uint64_t drr_creation_time;
+ dmu_objset_type_t drr_type;
+ uint32_t drr_flags;
+ uint64_t drr_toguid;
+ uint64_t drr_fromguid;
+ char drr_toname[MAXNAMELEN];
+ } drr_begin;
+ struct drr_end {
+ zio_cksum_t drr_checksum;
+ uint64_t drr_toguid;
+ } drr_end;
+ struct drr_object {
+ 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_checksumtype;
+ uint8_t drr_compress;
+ uint8_t drr_pad[6];
+ uint64_t drr_toguid;
+ /* bonus content follows */
+ } drr_object;
+ struct drr_freeobjects {
+ uint64_t drr_firstobj;
+ uint64_t drr_numobjs;
+ uint64_t drr_toguid;
+ } 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;
+ uint64_t drr_toguid;
+ uint8_t drr_checksumtype;
+ uint8_t drr_checksumflags;
+ uint8_t drr_pad2[6];
+ ddt_key_t drr_key; /* deduplication key */
+ /* content follows */
+ } drr_write;
+ struct drr_free {
+ uint64_t drr_object;
+ uint64_t drr_offset;
+ uint64_t drr_length;
+ uint64_t drr_toguid;
+ } drr_free;
+ struct drr_write_byref {
+ /* where to put the data */
+ uint64_t drr_object;
+ uint64_t drr_offset;
+ uint64_t drr_length;
+ uint64_t drr_toguid;
+ /* where to find the prior copy of the data */
+ uint64_t drr_refguid;
+ uint64_t drr_refobject;
+ uint64_t drr_refoffset;
+ /* properties of the data */
+ uint8_t drr_checksumtype;
+ uint8_t drr_checksumflags;
+ uint8_t drr_pad2[6];
+ ddt_key_t drr_key; /* deduplication key */
+ } drr_write_byref;
+ struct drr_spill {
+ uint64_t drr_object;
+ uint64_t drr_length;
+ uint64_t drr_toguid;
+ uint64_t drr_pad[4]; /* needed for crypto */
+ /* spill data follows */
+ } drr_spill;
+ struct drr_write_embedded {
+ uint64_t drr_object;
+ uint64_t drr_offset;
+ /* logical length, should equal blocksize */
+ uint64_t drr_length;
+ uint64_t drr_toguid;
+ uint8_t drr_compression;
+ uint8_t drr_etype;
+ uint8_t drr_pad[6];
+ uint32_t drr_lsize; /* uncompressed size of payload */
+ uint32_t drr_psize; /* compr. (real) size of payload */
+ /* (possibly compressed) content follows */
+ } drr_write_embedded;
+
+ /*
+ * 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 {
+ uint64_t drr_pad[34];
+ /*
+ * fletcher-4 checksum of everything preceding the
+ * checksum.
+ */
+ zio_cksum_t drr_checksum;
+ } drr_checksum;
+ } drr_u;
+} dmu_replay_record_t;
+
+/* 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 {
+ uint64_t ddr_type;
+ uint64_t ddr_first;
+ uint64_t ddr_last;
+} dmu_diff_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_failfast;
+ char zi_func[MAXNAMELEN];
+ uint32_t zi_iotype;
+ int32_t zi_duration;
+ uint64_t zi_timer;
+ uint32_t zi_cmd;
+ uint32_t zi_pad;
+} zinject_record_t;
+
+#define ZINJECT_NULL 0x1
+#define ZINJECT_FLUSH_ARC 0x2
+#define ZINJECT_UNLOAD_SPA 0x4
+
+typedef enum zinject_type {
+ ZINJECT_UNINITIALIZED,
+ ZINJECT_DATA_FAULT,
+ ZINJECT_DEVICE_FAULT,
+ ZINJECT_LABEL_FAULT,
+ ZINJECT_IGNORED_WRITES,
+ ZINJECT_PANIC,
+ ZINJECT_DELAY_IO,
+} zinject_type_t;
+
+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]; /* name of pool or dataset */
+ 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;
+ boolean_t zc_nvlist_dst_filled; /* put an nvlist in dst? */
+ int zc_pad2;
+
+ /*
+ * The following members are for legacy ioctls which haven't been
+ * converted to the new method.
+ */
+ uint64_t zc_history; /* really (char *) */
+ 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_cookie;
+ uint64_t zc_objset_type;
+ uint64_t zc_perm_action;
+ uint64_t zc_history_len;
+ uint64_t zc_history_offset;
+ uint64_t zc_obj;
+ uint64_t zc_iflags; /* internal to zfs(7fs) */
+ zfs_share_t zc_share;
+ dmu_objset_stats_t zc_objset_stats;
+ dmu_replay_record_t zc_begin_record;
+ zinject_record_t zc_inject_record;
+ uint32_t zc_defer_destroy;
+ uint32_t zc_flags;
+ uint64_t zc_action_handle;
+ int zc_cleanup_fd;
+ boolean_t zc_resumable;
+ uint64_t zc_sendobj;
+ uint64_t zc_fromobj;
+ uint64_t zc_createtxg;
+ zfs_stat_t zc_stat;
+} zfs_cmd_t;
+
+typedef struct zfs_useracct {
+ char zu_domain[256];
+ uid_t zu_rid;
+ uint32_t zu_pad;
+ uint64_t zu_space;
+} zfs_useracct_t;
+
+#define ZFSDEV_MAX_MINOR (1 << 16)
+#define ZFS_MIN_MINOR (ZFSDEV_MAX_MINOR + 1)
+
+#define ZPOOL_EXPORT_AFTER_SPLIT 0x1
+
+#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(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 {
+ ZSST_ZVOL,
+ ZSST_CTLDEV
+};
+
+typedef struct zfs_soft_state {
+ enum zfs_soft_state_type zss_type;
+ void *zss_data;
+} zfs_soft_state_t;
+
+extern void *zfsdev_get_soft_state(minor_t minor,
+ 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 */
diff --git a/uts/debian/rules b/uts/debian/rules
index 9bfcfaf..5e02c43 100755
--- a/uts/debian/rules
+++ b/uts/debian/rules
@@ -115,6 +115,7 @@ override_dh_auto_install:
override_dh_install:
dh_install --fail-missing
+ debian/abi-check debian/ref debian/uts-dev
override_dh_installdeb:
(cd debian/illumos-kernel && find kernel platform usr/kernel \