Add FreeBSD support to OpenZFS

Add the FreeBSD platform code to the OpenZFS repository.  As of this
commit the source can be compiled and tested on FreeBSD 11 and 12.
Subsequent commits are now required to compile on FreeBSD and Linux.
Additionally, they must pass the ZFS Test Suite on FreeBSD which is
being run by the CI.  As of this commit 1230 tests pass on FreeBSD
and there are no unexpected failures.

Reviewed-by: Sean Eric Fagan <sef@ixsystems.com>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #898 
Closes #8987
This commit is contained in:
Matthew Macy
2020-04-14 11:36:28 -07:00
committed by GitHub
parent 75c62019f3
commit 9f0a21e641
209 changed files with 46197 additions and 77 deletions
+14
View File
@@ -0,0 +1,14 @@
KERNEL_H = \
$(top_srcdir)/include/os/freebsd/zfs/sys/freebsd_crypto.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/sha2.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/vdev_os.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_context_os.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_ctldir.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_dir.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_ioctl_compat.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_vfsops.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_vnops.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_znode_impl.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zpl.h
EXTRA_DIST = $(KERNEL_H)
@@ -0,0 +1,98 @@
/*
* Copyright (c) 2018 Sean Eric Fagan <sef@ixsystems.com>
* Portions Copyright (c) 2005-2011 Pawel Jakub Dawidek <pawel@dawidek.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Portions of this file were taken from GELI's implementation of hmac.
*
* $FreeBSD$
*/
#ifndef _ZFS_FREEBSD_CRYPTO_H
#define _ZFS_FREEBSD_CRYPTO_H
#include <sys/errno.h>
#include <sys/mutex.h>
#include <opencrypto/cryptodev.h>
#include <crypto/sha2/sha256.h>
#include <crypto/sha2/sha512.h>
#define SUN_CKM_AES_CCM "CKM_AES_CCM"
#define SUN_CKM_AES_GCM "CKM_AES_GCM"
#define SUN_CKM_SHA512_HMAC "CKM_SHA512_HMAC"
#define CRYPTO_KEY_RAW 1
#define CRYPTO_BITS2BYTES(n) ((n) == 0 ? 0 : (((n) - 1) >> 3) + 1)
#define CRYPTO_BYTES2BITS(n) ((n) << 3)
struct zio_crypt_info;
typedef struct freebsd_crypt_session {
struct mtx fs_lock;
crypto_session_t fs_sid;
boolean_t fs_done;
} freebsd_crypt_session_t;
/*
* Unused types to minimize code differences.
*/
typedef void *crypto_mechanism_t;
typedef void *crypto_ctx_template_t;
/*
* Unlike the ICP crypto_key type, this only
* supports <data, length> (the equivalent of
* CRYPTO_KEY_RAW).
*/
typedef struct crypto_key {
int ck_format; /* Unused, but minimizes code diff */
void *ck_data;
size_t ck_length;
} crypto_key_t;
typedef struct hmac_ctx {
SHA512_CTX innerctx;
SHA512_CTX outerctx;
} *crypto_context_t;
/*
* The only algorithm ZFS uses for hashing is SHA512_HMAC.
*/
void crypto_mac(const crypto_key_t *key, const void *in_data,
size_t in_data_size, void *out_data, size_t out_data_size);
void crypto_mac_init(struct hmac_ctx *ctx, const crypto_key_t *key);
void crypto_mac_update(struct hmac_ctx *ctx, const void *data,
size_t data_size);
void crypto_mac_final(struct hmac_ctx *ctx, void *out_data,
size_t out_data_size);
int freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
struct zio_crypt_info *, crypto_key_t *);
void freebsd_crypt_freesession(freebsd_crypt_session_t *sessp);
int freebsd_crypt_uio(boolean_t, freebsd_crypt_session_t *,
struct zio_crypt_info *, uio_t *, crypto_key_t *, uint8_t *,
size_t, size_t);
#endif /* _ZFS_FREEBSD_CRYPTO_H */
+200
View File
@@ -0,0 +1,200 @@
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright 2013 Saso Kiselkov. All rights reserved. */
#ifndef _SYS_SHA2_H
#define _SYS_SHA2_H
#include <sys/types.h> /* for uint_* */
#ifdef __cplusplus
extern "C" {
#endif
#define SHA2_HMAC_MIN_KEY_LEN 1 /* SHA2-HMAC min key length in bytes */
#define SHA2_HMAC_MAX_KEY_LEN INT_MAX /* SHA2-HMAC max key length in bytes */
#define SHA256_DIGEST_LENGTH 32 /* SHA256 digest length in bytes */
#define SHA384_DIGEST_LENGTH 48 /* SHA384 digest length in bytes */
#define SHA512_DIGEST_LENGTH 64 /* SHA512 digest length in bytes */
/* Truncated versions of SHA-512 according to FIPS-180-4, section 5.3.6 */
#define SHA512_224_DIGEST_LENGTH 28 /* SHA512/224 digest length */
#define SHA512_256_DIGEST_LENGTH 32 /* SHA512/256 digest length */
#define SHA256_HMAC_BLOCK_SIZE 64 /* SHA256-HMAC block size */
#define SHA512_HMAC_BLOCK_SIZE 128 /* SHA512-HMAC block size */
#define SHA256 0
#define SHA256_HMAC 1
#define SHA256_HMAC_GEN 2
#define SHA384 3
#define SHA384_HMAC 4
#define SHA384_HMAC_GEN 5
#define SHA512 6
#define SHA512_HMAC 7
#define SHA512_HMAC_GEN 8
#define SHA512_224 9
#define SHA512_256 10
/*
* SHA2 context.
* The contents of this structure are a private interface between the
* Init/Update/Final calls of the functions defined below.
* Callers must never attempt to read or write any of the fields
* in this structure directly.
*/
#include <crypto/sha2/sha256.h>
#include <crypto/sha2/sha384.h>
#include <crypto/sha2/sha512.h>
#include <crypto/sha2/sha512t.h>
typedef struct {
uint32_t algotype; /* Algorithm Type */
union {
SHA256_CTX SHA256_ctx;
SHA384_CTX SHA384_ctx;
SHA512_CTX SHA512_ctx;
};
} SHA2_CTX;
extern void SHA256Init(SHA256_CTX *);
extern void SHA256Update(SHA256_CTX *, const void *, size_t);
extern void SHA256Final(void *, SHA256_CTX *);
extern void SHA384Init(SHA384_CTX *);
extern void SHA384Update(SHA384_CTX *, const void *, size_t);
extern void SHA384Final(void *, SHA384_CTX *);
extern void SHA512Init(SHA512_CTX *);
extern void SHA512Update(SHA512_CTX *, const void *, size_t);
extern void SHA512Final(void *, SHA512_CTX *);
static inline void
SHA2Init(uint64_t mech, SHA2_CTX *c)
{
switch (mech) {
case SHA256:
SHA256_Init(&c->SHA256_ctx);
break;
case SHA384:
SHA384_Init(&c->SHA384_ctx);
break;
case SHA512:
SHA512_Init(&c->SHA512_ctx);
break;
case SHA512_256:
SHA512_256_Init(&c->SHA512_ctx);
break;
default:
panic("unknown mechanism %lu", mech);
}
c->algotype = (uint32_t)mech;
}
static inline void
SHA2Update(SHA2_CTX *c, const void *p, size_t s)
{
switch (c->algotype) {
case SHA256:
SHA256_Update(&c->SHA256_ctx, p, s);
break;
case SHA384:
SHA384_Update(&c->SHA384_ctx, p, s);
break;
case SHA512:
SHA512_Update(&c->SHA512_ctx, p, s);
break;
case SHA512_256:
SHA512_256_Update(&c->SHA512_ctx, p, s);
break;
default:
panic("unknown mechanism %d", c->algotype);
}
}
static inline void
SHA2Final(void *p, SHA2_CTX *c)
{
switch (c->algotype) {
case SHA256:
SHA256_Final(p, &c->SHA256_ctx);
break;
case SHA384:
SHA384_Final(p, &c->SHA384_ctx);
break;
case SHA512:
SHA512_Final(p, &c->SHA512_ctx);
break;
case SHA512_256:
SHA512_256_Final(p, &c->SHA512_ctx);
break;
default:
panic("unknown mechanism %d", c->algotype);
}
}
#ifdef _SHA2_IMPL
/*
* The following types/functions are all private to the implementation
* of the SHA2 functions and must not be used by consumers of the interface
*/
/*
* List of support mechanisms in this module.
*
* It is important to note that in the module, division or modulus calculations
* are used on the enumerated type to determine which mechanism is being used;
* therefore, changing the order or additional mechanisms should be done
* carefully
*/
typedef enum sha2_mech_type {
SHA256_MECH_INFO_TYPE, /* SUN_CKM_SHA256 */
SHA256_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA256_HMAC */
SHA256_HMAC_GEN_MECH_INFO_TYPE, /* SUN_CKM_SHA256_HMAC_GENERAL */
SHA384_MECH_INFO_TYPE, /* SUN_CKM_SHA384 */
SHA384_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA384_HMAC */
SHA384_HMAC_GEN_MECH_INFO_TYPE, /* SUN_CKM_SHA384_HMAC_GENERAL */
SHA512_MECH_INFO_TYPE, /* SUN_CKM_SHA512 */
SHA512_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA512_HMAC */
SHA512_HMAC_GEN_MECH_INFO_TYPE, /* SUN_CKM_SHA512_HMAC_GENERAL */
SHA512_224_MECH_INFO_TYPE, /* SUN_CKM_SHA512_224 */
SHA512_256_MECH_INFO_TYPE /* SUN_CKM_SHA512_256 */
} sha2_mech_type_t;
#endif /* _SHA2_IMPL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SHA2_H */
+30
View File
@@ -0,0 +1,30 @@
/*
* 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.
*/
#ifndef _SYS_VDEV_OS_H
#define _SYS_VDEV_OS_H
extern int vdev_label_write_pad2(vdev_t *vd, const char *buf, size_t size);
#endif
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2020 iXsystems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ZFS_CONTEXT_OS_H_
#define ZFS_CONTEXT_OS_H_
#include <sys/condvar.h>
#include <sys/rwlock.h>
#include <sys/sig.h>
#include_next <sys/sdt.h>
#include <sys/misc.h>
#include <sys/kdb.h>
#include <sys/pathname.h>
#include <sys/conf.h>
#define cv_wait_io(cv, mp) cv_wait(cv, mp)
#define cv_wait_io_sig(cv, mp) cv_wait_sig(cv, mp)
#define cond_resched() kern_yield(PRI_USER)
#define taskq_create_sysdc(a, b, d, e, p, dc, f) \
(taskq_create(a, b, maxclsyspri, d, e, f))
#define tsd_create(keyp, destructor) do { \
*(keyp) = osd_thread_register((destructor)); \
KASSERT(*(keyp) > 0, ("cannot register OSD")); \
} while (0)
#define tsd_destroy(keyp) osd_thread_deregister(*(keyp))
#define tsd_get(key) osd_thread_get(curthread, (key))
#define tsd_set(key, value) osd_thread_set(curthread, (key), (value))
#define fm_panic panic
#define cond_resched() kern_yield(PRI_USER)
extern int zfs_debug_level;
extern struct mtx zfs_debug_mtx;
#define ZFS_LOG(lvl, ...) do { \
if (((lvl) & 0xff) <= zfs_debug_level) { \
mtx_lock(&zfs_debug_mtx); \
printf("%s:%u[%d]: ", \
__func__, __LINE__, (lvl)); \
printf(__VA_ARGS__); \
printf("\n"); \
if ((lvl) & 0x100) \
kdb_backtrace(); \
mtx_unlock(&zfs_debug_mtx); \
} \
} while (0)
#define MSEC_TO_TICK(msec) ((msec) / (MILLISEC / hz))
extern int hz;
extern int tick;
typedef int fstrans_cookie_t;
#define spl_fstrans_mark() (0)
#define spl_fstrans_unmark(x) (x = 0)
#define signal_pending(x) SIGPENDING(x)
#define current curthread
#define thread_join(x)
#define cv_wait_io(cv, mp) cv_wait(cv, mp)
typedef struct opensolaris_utsname utsname_t;
extern utsname_t *utsname(void);
extern int spa_import_rootpool(const char *name);
#else
#if BYTE_ORDER != BIG_ENDIAN
#undef _BIG_ENDIAN
#endif
#endif
+65
View File
@@ -0,0 +1,65 @@
/*
* 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.
*/
#ifndef _ZFS_CTLDIR_H
#define _ZFS_CTLDIR_H
#include <sys/vnode.h>
#include <sys/zfs_vfsops.h>
#include <sys/zfs_znode.h>
#ifdef __cplusplus
extern "C" {
#endif
#define ZFS_CTLDIR_NAME ".zfs"
#define zfs_has_ctldir(zdp) \
((zdp)->z_id == (zdp)->z_zfsvfs->z_root && \
((zdp)->z_zfsvfs->z_ctldir != NULL))
#define zfs_show_ctldir(zdp) \
(zfs_has_ctldir(zdp) && \
((zdp)->z_zfsvfs->z_show_ctldir))
void zfsctl_create(zfsvfs_t *);
void zfsctl_destroy(zfsvfs_t *);
int zfsctl_root(zfsvfs_t *, int, vnode_t **);
void zfsctl_init(void);
void zfsctl_fini(void);
boolean_t zfsctl_is_node(vnode_t *);
int zfsctl_snapshot_unmount(char *snapname, int flags);
int zfsctl_rename_snapshot(const char *from, const char *to);
int zfsctl_destroy_snapshot(const char *snapname, int force);
int zfsctl_umount_snapshots(vfs_t *, int, cred_t *);
int zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp);
#define ZFSCTL_INO_ROOT 0x1
#define ZFSCTL_INO_SNAPDIR 0x2
#ifdef __cplusplus
}
#endif
#endif /* _ZFS_CTLDIR_H */
+74
View File
@@ -0,0 +1,74 @@
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FS_ZFS_DIR_H
#define _SYS_FS_ZFS_DIR_H
#include <sys/pathname.h>
#include <sys/dmu.h>
#include <sys/zfs_znode.h>
#ifdef __cplusplus
extern "C" {
#endif
/* zfs_dirent_lock() flags */
#define ZNEW 0x0001 /* entry should not exist */
#define ZEXISTS 0x0002 /* entry should exist */
#define ZSHARED 0x0004 /* shared access (zfs_dirlook()) */
#define ZXATTR 0x0008 /* we want the xattr dir */
#define ZRENAMING 0x0010 /* znode is being renamed */
#define ZCILOOK 0x0020 /* case-insensitive lookup requested */
#define ZCIEXACT 0x0040 /* c-i requires c-s match (rename) */
#define ZHAVELOCK 0x0080 /* z_name_lock is already held */
/* mknode flags */
#define IS_ROOT_NODE 0x01 /* create a root node */
#define IS_XATTR 0x02 /* create an extended attribute node */
extern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int);
extern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int);
extern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int,
boolean_t *);
#if 0
extern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int);
#else
extern int zfs_dirlook(znode_t *, const char *name, znode_t **);
#endif
extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *,
uint_t, znode_t **, zfs_acl_ids_t *);
extern void zfs_rmnode(znode_t *);
extern boolean_t zfs_dirempty(znode_t *);
extern void zfs_unlinked_add(znode_t *, dmu_tx_t *);
extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs);
extern int zfs_sticky_remove_access(znode_t *, znode_t *, cred_t *cr);
extern int zfs_get_xattrdir(znode_t *, znode_t **, cred_t *, int);
extern int zfs_make_xattrdir(znode_t *, vattr_t *, znode_t **, cred_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_ZFS_DIR_H */
@@ -0,0 +1,677 @@
/*
* 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 Xin Li <delphij@FreeBSD.org>. All rights reserved.
* Copyright 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ZFS_IOCTL_COMPAT_H
#define _SYS_ZFS_IOCTL_COMPAT_H
#include <sys/cred.h>
#include <sys/dmu.h>
#include <sys/zio.h>
#include <sys/dsl_deleg.h>
#include <sys/zfs_ioctl.h>
#ifdef _KERNEL
#include <sys/nvpair.h>
#endif /* _KERNEL */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Backwards ioctl compatibility
*/
/* ioctl versions for vfs.zfs.version.ioctl */
#define ZFS_IOCVER_UNDEF -1
#define ZFS_IOCVER_NONE 0
#define ZFS_IOCVER_DEADMAN 1
#define ZFS_IOCVER_LZC 2
#define ZFS_IOCVER_ZCMD 3
#define ZFS_IOCVER_EDBP 4
#define ZFS_IOCVER_RESUME 5
#define ZFS_IOCVER_INLANES 6
#define ZFS_IOCVER_PAD 7
#define ZFS_IOCVER_FREEBSD ZFS_IOCVER_PAD
#define ZFS_IOCVER_ZOF 15
/* compatibility conversion flag */
#define ZFS_CMD_COMPAT_NONE 0
#define ZFS_CMD_COMPAT_V15 1
#define ZFS_CMD_COMPAT_V28 2
#define ZFS_CMD_COMPAT_DEADMAN 3
#define ZFS_CMD_COMPAT_LZC 4
#define ZFS_CMD_COMPAT_ZCMD 5
#define ZFS_CMD_COMPAT_EDBP 6
#define ZFS_CMD_COMPAT_RESUME 7
#define ZFS_CMD_COMPAT_INLANES 8
#define ZFS_IOC_COMPAT_PASS 254
#define ZFS_IOC_COMPAT_FAIL 255
#define ZFS_IOCREQ(ioreq) ((ioreq) & 0xff)
typedef struct zfs_iocparm {
uint32_t zfs_ioctl_version;
uint64_t zfs_cmd;
uint64_t zfs_cmd_size;
} zfs_iocparm_t;
typedef struct zinject_record_v15 {
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;
} zinject_record_v15_t;
typedef struct zfs_cmd_v15 {
char zc_name[MAXPATHLEN];
char zc_value[MAXPATHLEN];
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;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
struct drr_begin zc_begin_record;
zinject_record_v15_t zc_inject_record;
} zfs_cmd_v15_t;
typedef struct zinject_record_v28 {
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;
} zinject_record_v28_t;
typedef struct zfs_cmd_v28 {
char zc_name[MAXPATHLEN];
char zc_value[MAXPATHLEN * 2];
char zc_string[MAXNAMELEN];
char zc_top_ds[MAXPATHLEN];
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;
uint64_t zc_iflags; /* internal to zfs(7fs) */
zfs_share_t zc_share;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
struct drr_begin zc_begin_record;
zinject_record_v28_t zc_inject_record;
boolean_t zc_defer_destroy;
boolean_t zc_temphold;
uint64_t zc_action_handle;
int zc_cleanup_fd;
uint8_t zc_simple;
uint8_t zc_pad[3]; /* alignment */
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_v28_t;
typedef struct zinject_record_deadman {
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_deadman_t;
typedef struct zfs_cmd_deadman {
char zc_name[MAXPATHLEN];
char zc_value[MAXPATHLEN * 2];
char zc_string[MAXNAMELEN];
char zc_top_ds[MAXPATHLEN];
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;
uint64_t zc_iflags; /* internal to zfs(7fs) */
zfs_share_t zc_share;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
struct drr_begin zc_begin_record;
/* zc_inject_record doesn't change in libzfs_core */
zinject_record_deadman_t zc_inject_record;
boolean_t zc_defer_destroy;
boolean_t zc_temphold;
uint64_t zc_action_handle;
int zc_cleanup_fd;
uint8_t zc_simple;
uint8_t zc_pad[3]; /* alignment */
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_deadman_t;
typedef struct zfs_cmd_zcmd {
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;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
struct drr_begin zc_begin_record;
zinject_record_deadman_t zc_inject_record;
boolean_t zc_defer_destroy;
boolean_t zc_temphold;
uint64_t zc_action_handle;
int zc_cleanup_fd;
uint8_t zc_simple;
uint8_t zc_pad[3]; /* alignment */
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_zcmd_t;
typedef struct zfs_cmd_edbp {
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;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
struct drr_begin zc_begin_record;
zinject_record_deadman_t zc_inject_record;
uint32_t zc_defer_destroy;
uint32_t zc_flags;
uint64_t zc_action_handle;
int zc_cleanup_fd;
uint8_t zc_simple;
uint8_t zc_pad[3]; /* alignment */
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_edbp_t;
typedef struct zfs_cmd_resume {
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;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
dmu_replay_record_t zc_begin_record;
zinject_record_deadman_t zc_inject_record;
uint32_t zc_defer_destroy;
uint32_t zc_flags;
uint64_t zc_action_handle;
int zc_cleanup_fd;
uint8_t zc_simple;
boolean_t zc_resumable;
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_resume_t;
typedef struct zfs_cmd_inlanes {
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;
uint64_t zc_jailid;
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;
uint8_t zc_simple;
boolean_t zc_resumable;
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_inlanes_t;
#ifdef _KERNEL
/*
* Note: this struct must have the same layout in 32-bit and 64-bit, so
* that 32-bit processes (like /sbin/zfs) can pass it to the 64-bit
* kernel. Therefore, we add padding to it so that no "hidden" padding
* is automatically added on 64-bit (but not on 32-bit).
*/
typedef struct zfs_cmd_legacy {
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;
uint64_t zc_jailid;
dmu_objset_stats_t zc_objset_stats;
uint64_t zc_freebsd_drr_pad;
struct drr_begin 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;
uint8_t zc_simple;
uint8_t zc_pad3[3];
boolean_t zc_resumable;
uint32_t zc_pad4;
uint64_t zc_sendobj;
uint64_t zc_fromobj;
uint64_t zc_createtxg;
zfs_stat_t zc_stat;
} zfs_cmd_legacy_t;
unsigned static long zfs_ioctl_bsd12_to_zof[] = {
ZFS_IOC_POOL_CREATE, /* 0x00 */
ZFS_IOC_POOL_DESTROY, /* 0x01 */
ZFS_IOC_POOL_IMPORT, /* 0x02 */
ZFS_IOC_POOL_EXPORT, /* 0x03 */
ZFS_IOC_POOL_CONFIGS, /* 0x04 */
ZFS_IOC_POOL_STATS, /* 0x05 */
ZFS_IOC_POOL_TRYIMPORT, /* 0x06 */
ZFS_IOC_POOL_SCAN, /* 0x07 */
ZFS_IOC_POOL_FREEZE, /* 0x08 */
ZFS_IOC_POOL_UPGRADE, /* 0x09 */
ZFS_IOC_POOL_GET_HISTORY, /* 0x0a */
ZFS_IOC_VDEV_ADD, /* 0x0b */
ZFS_IOC_VDEV_REMOVE, /* 0x0c */
ZFS_IOC_VDEV_SET_STATE, /* 0x0d */
ZFS_IOC_VDEV_ATTACH, /* 0x0e */
ZFS_IOC_VDEV_DETACH, /* 0x0f */
ZFS_IOC_VDEV_SETPATH, /* 0x10 */
ZFS_IOC_VDEV_SETFRU, /* 0x11 */
ZFS_IOC_OBJSET_STATS, /* 0x12 */
ZFS_IOC_OBJSET_ZPLPROPS, /* 0x13 */
ZFS_IOC_DATASET_LIST_NEXT, /* 0x14 */
ZFS_IOC_SNAPSHOT_LIST_NEXT, /* 0x15 */
ZFS_IOC_SET_PROP, /* 0x16 */
ZFS_IOC_CREATE, /* 0x17 */
ZFS_IOC_DESTROY, /* 0x18 */
ZFS_IOC_ROLLBACK, /* 0x19 */
ZFS_IOC_RENAME, /* 0x1a */
ZFS_IOC_RECV, /* 0x1b */
ZFS_IOC_SEND, /* 0x1c */
ZFS_IOC_INJECT_FAULT, /* 0x1d */
ZFS_IOC_CLEAR_FAULT, /* 0x1e */
ZFS_IOC_INJECT_LIST_NEXT, /* 0x1f */
ZFS_IOC_ERROR_LOG, /* 0x20 */
ZFS_IOC_CLEAR, /* 0x21 */
ZFS_IOC_PROMOTE, /* 0x22 */
/* start of mismatch */
ZFS_IOC_DESTROY_SNAPS, /* 0x23:0x3b */
ZFS_IOC_SNAPSHOT, /* 0x24:0x23 */
ZFS_IOC_DSOBJ_TO_DSNAME, /* 0x25:0x24 */
ZFS_IOC_OBJ_TO_PATH, /* 0x26:0x25 */
ZFS_IOC_POOL_SET_PROPS, /* 0x27:0x26 */
ZFS_IOC_POOL_GET_PROPS, /* 0x28:0x27 */
ZFS_IOC_SET_FSACL, /* 0x29:0x28 */
ZFS_IOC_GET_FSACL, /* 0x30:0x29 */
ZFS_IOC_SHARE, /* 0x2b:0x2a */
ZFS_IOC_INHERIT_PROP, /* 0x2c:0x2b */
ZFS_IOC_SMB_ACL, /* 0x2d:0x2c */
ZFS_IOC_USERSPACE_ONE, /* 0x2e:0x2d */
ZFS_IOC_USERSPACE_MANY, /* 0x2f:0x2e */
ZFS_IOC_USERSPACE_UPGRADE, /* 0x30:0x2f */
ZFS_IOC_HOLD, /* 0x31:0x30 */
ZFS_IOC_RELEASE, /* 0x32:0x31 */
ZFS_IOC_GET_HOLDS, /* 0x33:0x32 */
ZFS_IOC_OBJSET_RECVD_PROPS, /* 0x34:0x33 */
ZFS_IOC_VDEV_SPLIT, /* 0x35:0x34 */
ZFS_IOC_NEXT_OBJ, /* 0x36:0x35 */
ZFS_IOC_DIFF, /* 0x37:0x36 */
ZFS_IOC_TMP_SNAPSHOT, /* 0x38:0x37 */
ZFS_IOC_OBJ_TO_STATS, /* 0x39:0x38 */
ZFS_IOC_JAIL, /* 0x3a:0xc2 */
ZFS_IOC_UNJAIL, /* 0x3b:0xc3 */
ZFS_IOC_POOL_REGUID, /* 0x3c:0x3c */
ZFS_IOC_SPACE_WRITTEN, /* 0x3d:0x39 */
ZFS_IOC_SPACE_SNAPS, /* 0x3e:0x3a */
ZFS_IOC_SEND_PROGRESS, /* 0x3f:0x3e */
ZFS_IOC_POOL_REOPEN, /* 0x40:0x3d */
ZFS_IOC_LOG_HISTORY, /* 0x41:0x3f */
ZFS_IOC_SEND_NEW, /* 0x42:0x40 */
ZFS_IOC_SEND_SPACE, /* 0x43:0x41 */
ZFS_IOC_CLONE, /* 0x44:0x42 */
ZFS_IOC_BOOKMARK, /* 0x45:0x43 */
ZFS_IOC_GET_BOOKMARKS, /* 0x46:0x44 */
ZFS_IOC_DESTROY_BOOKMARKS, /* 0x47:0x45 */
ZFS_IOC_NEXTBOOT, /* 0x48:0xc1 */
ZFS_IOC_CHANNEL_PROGRAM, /* 0x49:0x48 */
ZFS_IOC_REMAP, /* 0x4a:0x4c */
ZFS_IOC_POOL_CHECKPOINT, /* 0x4b:0x4d */
ZFS_IOC_POOL_DISCARD_CHECKPOINT, /* 0x4c:0x4e */
ZFS_IOC_POOL_INITIALIZE, /* 0x4d:0x4f */
};
unsigned static long zfs_ioctl_v15_to_v28[] = {
0, /* 0 ZFS_IOC_POOL_CREATE */
1, /* 1 ZFS_IOC_POOL_DESTROY */
2, /* 2 ZFS_IOC_POOL_IMPORT */
3, /* 3 ZFS_IOC_POOL_EXPORT */
4, /* 4 ZFS_IOC_POOL_CONFIGS */
5, /* 5 ZFS_IOC_POOL_STATS */
6, /* 6 ZFS_IOC_POOL_TRYIMPORT */
7, /* 7 ZFS_IOC_POOL_SCRUB */
8, /* 8 ZFS_IOC_POOL_FREEZE */
9, /* 9 ZFS_IOC_POOL_UPGRADE */
10, /* 10 ZFS_IOC_POOL_GET_HISTORY */
11, /* 11 ZFS_IOC_VDEV_ADD */
12, /* 12 ZFS_IOC_VDEV_REMOVE */
13, /* 13 ZFS_IOC_VDEV_SET_STATE */
14, /* 14 ZFS_IOC_VDEV_ATTACH */
15, /* 15 ZFS_IOC_VDEV_DETACH */
16, /* 16 ZFS_IOC_VDEV_SETPATH */
18, /* 17 ZFS_IOC_OBJSET_STATS */
19, /* 18 ZFS_IOC_OBJSET_ZPLPROPS */
20, /* 19 ZFS_IOC_DATASET_LIST_NEXT */
21, /* 20 ZFS_IOC_SNAPSHOT_LIST_NEXT */
22, /* 21 ZFS_IOC_SET_PROP */
ZFS_IOC_COMPAT_PASS, /* 22 ZFS_IOC_CREATE_MINOR */
ZFS_IOC_COMPAT_PASS, /* 23 ZFS_IOC_REMOVE_MINOR */
23, /* 24 ZFS_IOC_CREATE */
24, /* 25 ZFS_IOC_DESTROY */
25, /* 26 ZFS_IOC_ROLLBACK */
26, /* 27 ZFS_IOC_RENAME */
27, /* 28 ZFS_IOC_RECV */
28, /* 29 ZFS_IOC_SEND */
29, /* 30 ZFS_IOC_INJECT_FAULT */
30, /* 31 ZFS_IOC_CLEAR_FAULT */
31, /* 32 ZFS_IOC_INJECT_LIST_NEXT */
32, /* 33 ZFS_IOC_ERROR_LOG */
33, /* 34 ZFS_IOC_CLEAR */
34, /* 35 ZFS_IOC_PROMOTE */
35, /* 36 ZFS_IOC_DESTROY_SNAPS */
36, /* 37 ZFS_IOC_SNAPSHOT */
37, /* 38 ZFS_IOC_DSOBJ_TO_DSNAME */
38, /* 39 ZFS_IOC_OBJ_TO_PATH */
39, /* 40 ZFS_IOC_POOL_SET_PROPS */
40, /* 41 ZFS_IOC_POOL_GET_PROPS */
41, /* 42 ZFS_IOC_SET_FSACL */
42, /* 43 ZFS_IOC_GET_FSACL */
ZFS_IOC_COMPAT_PASS, /* 44 ZFS_IOC_ISCSI_PERM_CHECK */
43, /* 45 ZFS_IOC_SHARE */
44, /* 46 ZFS_IOC_IHNERIT_PROP */
58, /* 47 ZFS_IOC_JAIL */
59, /* 48 ZFS_IOC_UNJAIL */
45, /* 49 ZFS_IOC_SMB_ACL */
46, /* 50 ZFS_IOC_USERSPACE_ONE */
47, /* 51 ZFS_IOC_USERSPACE_MANY */
48, /* 52 ZFS_IOC_USERSPACE_UPGRADE */
17, /* 53 ZFS_IOC_SETFRU */
};
#else /* KERNEL */
unsigned static long zfs_ioctl_v28_to_v15[] = {
0, /* 0 ZFS_IOC_POOL_CREATE */
1, /* 1 ZFS_IOC_POOL_DESTROY */
2, /* 2 ZFS_IOC_POOL_IMPORT */
3, /* 3 ZFS_IOC_POOL_EXPORT */
4, /* 4 ZFS_IOC_POOL_CONFIGS */
5, /* 5 ZFS_IOC_POOL_STATS */
6, /* 6 ZFS_IOC_POOL_TRYIMPORT */
7, /* 7 ZFS_IOC_POOL_SCAN */
8, /* 8 ZFS_IOC_POOL_FREEZE */
9, /* 9 ZFS_IOC_POOL_UPGRADE */
10, /* 10 ZFS_IOC_POOL_GET_HISTORY */
11, /* 11 ZFS_IOC_VDEV_ADD */
12, /* 12 ZFS_IOC_VDEV_REMOVE */
13, /* 13 ZFS_IOC_VDEV_SET_STATE */
14, /* 14 ZFS_IOC_VDEV_ATTACH */
15, /* 15 ZFS_IOC_VDEV_DETACH */
16, /* 16 ZFS_IOC_VDEV_SETPATH */
53, /* 17 ZFS_IOC_VDEV_SETFRU */
17, /* 18 ZFS_IOC_OBJSET_STATS */
18, /* 19 ZFS_IOC_OBJSET_ZPLPROPS */
19, /* 20 ZFS_IOC_DATASET_LIST_NEXT */
20, /* 21 ZFS_IOC_SNAPSHOT_LIST_NEXT */
21, /* 22 ZFS_IOC_SET_PROP */
24, /* 23 ZFS_IOC_CREATE */
25, /* 24 ZFS_IOC_DESTROY */
26, /* 25 ZFS_IOC_ROLLBACK */
27, /* 26 ZFS_IOC_RENAME */
28, /* 27 ZFS_IOC_RECV */
29, /* 28 ZFS_IOC_SEND */
30, /* 39 ZFS_IOC_INJECT_FAULT */
31, /* 30 ZFS_IOC_CLEAR_FAULT */
32, /* 31 ZFS_IOC_INJECT_LIST_NEXT */
33, /* 32 ZFS_IOC_ERROR_LOG */
34, /* 33 ZFS_IOC_CLEAR */
35, /* 34 ZFS_IOC_PROMOTE */
36, /* 35 ZFS_IOC_DESTROY_SNAPS */
37, /* 36 ZFS_IOC_SNAPSHOT */
38, /* 37 ZFS_IOC_DSOBJ_TO_DSNAME */
39, /* 38 ZFS_IOC_OBJ_TO_PATH */
40, /* 39 ZFS_IOC_POOL_SET_PROPS */
41, /* 40 ZFS_IOC_POOL_GET_PROPS */
42, /* 41 ZFS_IOC_SET_FSACL */
43, /* 42 ZFS_IOC_GET_FSACL */
45, /* 43 ZFS_IOC_SHARE */
46, /* 44 ZFS_IOC_IHNERIT_PROP */
49, /* 45 ZFS_IOC_SMB_ACL */
50, /* 46 ZFS_IOC_USERSPACE_ONE */
51, /* 47 ZFS_IOC_USERSPACE_MANY */
52, /* 48 ZFS_IOC_USERSPACE_UPGRADE */
ZFS_IOC_COMPAT_FAIL, /* 49 ZFS_IOC_HOLD */
ZFS_IOC_COMPAT_FAIL, /* 50 ZFS_IOC_RELEASE */
ZFS_IOC_COMPAT_FAIL, /* 51 ZFS_IOC_GET_HOLDS */
ZFS_IOC_COMPAT_FAIL, /* 52 ZFS_IOC_OBJSET_RECVD_PROPS */
ZFS_IOC_COMPAT_FAIL, /* 53 ZFS_IOC_VDEV_SPLIT */
ZFS_IOC_COMPAT_FAIL, /* 54 ZFS_IOC_NEXT_OBJ */
ZFS_IOC_COMPAT_FAIL, /* 55 ZFS_IOC_DIFF */
ZFS_IOC_COMPAT_FAIL, /* 56 ZFS_IOC_TMP_SNAPSHOT */
ZFS_IOC_COMPAT_FAIL, /* 57 ZFS_IOC_OBJ_TO_STATS */
47, /* 58 ZFS_IOC_JAIL */
48, /* 59 ZFS_IOC_UNJAIL */
};
#endif /* ! _KERNEL */
#ifdef _KERNEL
int zfs_ioctl_compat_pre(zfs_cmd_t *, int *, const int);
void zfs_ioctl_compat_post(zfs_cmd_t *, const int, const int);
nvlist_t *zfs_ioctl_compat_innvl(zfs_cmd_t *, nvlist_t *, const int,
const int);
nvlist_t *zfs_ioctl_compat_outnvl(zfs_cmd_t *, nvlist_t *, const int,
const int);
#endif /* _KERNEL */
void zfs_cmd_compat_get(zfs_cmd_t *, caddr_t, const int);
void zfs_cmd_compat_put(zfs_cmd_t *, caddr_t, const int, const int);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ZFS_IOCTL_COMPAT_H */
+172
View File
@@ -0,0 +1,172 @@
/*
* 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 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
*/
#ifndef _SYS_FS_ZFS_VFSOPS_H
#define _SYS_FS_ZFS_VFSOPS_H
#include <sys/list.h>
#include <sys/vfs.h>
#include <sys/zil.h>
#include <sys/sa.h>
#include <sys/rrwlock.h>
#include <sys/zfs_ioctl.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct zfsvfs zfsvfs_t;
struct znode;
struct zfsvfs {
vfs_t *z_vfs; /* generic fs struct */
zfsvfs_t *z_parent; /* parent fs */
objset_t *z_os; /* objset reference */
uint64_t z_flags; /* super_block flags */
uint64_t z_root; /* id of root znode */
uint64_t z_unlinkedobj; /* id of unlinked zapobj */
uint64_t z_max_blksz; /* maximum block size for files */
uint64_t z_fuid_obj; /* fuid table object number */
uint64_t z_fuid_size; /* fuid table size */
avl_tree_t z_fuid_idx; /* fuid tree keyed by index */
avl_tree_t z_fuid_domain; /* fuid tree keyed by domain */
krwlock_t z_fuid_lock; /* fuid lock */
boolean_t z_fuid_loaded; /* fuid tables are loaded */
boolean_t z_fuid_dirty; /* need to sync fuid table ? */
struct zfs_fuid_info *z_fuid_replay; /* fuid info for replay */
zilog_t *z_log; /* intent log pointer */
uint_t z_acl_mode; /* acl chmod/mode behavior */
uint_t z_acl_inherit; /* acl inheritance behavior */
zfs_case_t z_case; /* case-sense */
boolean_t z_utf8; /* utf8-only */
int z_norm; /* normalization flags */
boolean_t z_atime; /* enable atimes mount option */
boolean_t z_unmounted; /* unmounted */
rrmlock_t z_teardown_lock;
krwlock_t z_teardown_inactive_lock;
list_t z_all_znodes; /* all vnodes in the fs */
uint64_t z_nr_znodes; /* number of znodes in the fs */
kmutex_t z_znodes_lock; /* lock for z_all_znodes */
struct zfsctl_root *z_ctldir; /* .zfs directory pointer */
boolean_t z_show_ctldir; /* expose .zfs in the root dir */
boolean_t z_issnap; /* true if this is a snapshot */
boolean_t z_vscan; /* virus scan on/off */
boolean_t z_use_fuids; /* version allows fuids */
boolean_t z_replay; /* set during ZIL replay */
boolean_t z_use_sa; /* version allow system attributes */
boolean_t z_xattr_sa; /* allow xattrs to be stores as SA */
boolean_t z_use_namecache; /* make use of FreeBSD name cache */
uint8_t z_xattr; /* xattr type in use */
uint64_t z_version; /* ZPL version */
uint64_t z_shares_dir; /* hidden shares dir */
kmutex_t z_lock;
uint64_t z_userquota_obj;
uint64_t z_groupquota_obj;
uint64_t z_userobjquota_obj;
uint64_t z_groupobjquota_obj;
uint64_t z_projectquota_obj;
uint64_t z_projectobjquota_obj;
uint64_t z_replay_eof; /* New end of file - replay only */
sa_attr_type_t *z_attr_table; /* SA attr mapping->id */
#define ZFS_OBJ_MTX_SZ 64
kmutex_t z_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */
struct task z_unlinked_drain_task;
};
#define ZSB_XATTR 0x0001 /* Enable user xattrs */
/*
* Normal filesystems (those not under .zfs/snapshot) have a total
* file ID size limited to 12 bytes (including the length field) due to
* NFSv2 protocol's limitation of 32 bytes for a filehandle. For historical
* reasons, this same limit is being imposed by the Solaris NFSv3 implementation
* (although the NFSv3 protocol actually permits a maximum of 64 bytes). It
* is not possible to expand beyond 12 bytes without abandoning support
* of NFSv2.
*
* For normal filesystems, we partition up the available space as follows:
* 2 bytes fid length (required)
* 6 bytes object number (48 bits)
* 4 bytes generation number (32 bits)
*
* We reserve only 48 bits for the object number, as this is the limit
* currently defined and imposed by the DMU.
*/
typedef struct zfid_short {
uint16_t zf_len;
uint8_t zf_object[6]; /* obj[i] = obj >> (8 * i) */
uint8_t zf_gen[4]; /* gen[i] = gen >> (8 * i) */
} zfid_short_t;
/*
* Filesystems under .zfs/snapshot have a total file ID size of 22[*] bytes
* (including the length field). This makes files under .zfs/snapshot
* accessible by NFSv3 and NFSv4, but not NFSv2.
*
* For files under .zfs/snapshot, we partition up the available space
* as follows:
* 2 bytes fid length (required)
* 6 bytes object number (48 bits)
* 4 bytes generation number (32 bits)
* 6 bytes objset id (48 bits)
* 4 bytes[**] currently just zero (32 bits)
*
* We reserve only 48 bits for the object number and objset id, as these are
* the limits currently defined and imposed by the DMU.
*
* [*] 20 bytes on FreeBSD to fit into the size of struct fid.
* [**] 2 bytes on FreeBSD for the above reason.
*/
typedef struct zfid_long {
zfid_short_t z_fid;
uint8_t zf_setid[6]; /* obj[i] = obj >> (8 * i) */
uint8_t zf_setgen[2]; /* gen[i] = gen >> (8 * i) */
} zfid_long_t;
#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_super_owner;
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);
extern int zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers);
extern int zfsvfs_create(const char *name, boolean_t readonly, zfsvfs_t **zfvp);
extern int zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, objset_t *os);
extern void zfsvfs_free(zfsvfs_t *zfsvfs);
extern int zfs_check_global_label(const char *dsname, const char *hexsl);
extern boolean_t zfs_is_readonly(zfsvfs_t *zfsvfs);
extern int zfs_get_temporary_prop(struct dsl_dataset *ds, zfs_prop_t zfs_prop,
uint64_t *val, char *setpoint);
extern int zfs_busy(void);
extern void zfsvfs_update_fromname(const char *oldname, const char *newname);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_ZFS_VFSOPS_H */
+56
View File
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2020 iXsystems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS_ZFS_VNOPS_H_
#define _SYS_ZFS_VNOPS_H_
int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset,
uint64_t size, struct vm_page **ppa, dmu_tx_t *tx);
int dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
int *rbehind, int *rahead, int last_size);
extern int zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags);
extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
znode_t **zpp, cred_t *cr, int flags, vsecattr_t *vsecp);
extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
cred_t *cr, int flags);
extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr);
extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
char *tnm, cred_t *cr, int flags);
extern int zfs_symlink(znode_t *dzp, const char *name, vattr_t *vap,
const char *link, znode_t **zpp, cred_t *cr, int flags);
extern int zfs_link(znode_t *tdzp, znode_t *sp,
char *name, cred_t *cr, int flags);
extern int zfs_space(znode_t *zp, int cmd, struct flock *bfp, int flag,
offset_t offset, cred_t *cr);
extern int zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp);
extern int zfs_setsecattr(znode_t *zp, vsecattr_t *vsecp, int flag,
cred_t *cr);
extern int zfs_write_simple(znode_t *zp, const void *data, size_t len,
loff_t pos, size_t *resid);
#endif
+182
View File
@@ -0,0 +1,182 @@
/*
* 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, 2015 by Delphix. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _FREEBSD_ZFS_SYS_ZNODE_IMPL_H
#define _FREEBSD_ZFS_SYS_ZNODE_IMPL_H
#include <sys/list.h>
#include <sys/dmu.h>
#include <sys/sa.h>
#include <sys/zfs_vfsops.h>
#include <sys/rrwlock.h>
#include <sys/zfs_sa.h>
#include <sys/zfs_stat.h>
#include <sys/zfs_rlock.h>
#include <sys/zfs_acl.h>
#include <sys/zil.h>
#include <sys/zfs_project.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Directory entry locks control access to directory entries.
* They are used to protect creates, deletes, and renames.
* Each directory znode has a mutex and a list of locked names.
*/
#define ZNODE_OS_FIELDS \
struct zfsvfs *z_zfsvfs; \
vnode_t *z_vnode; \
uint64_t z_uid; \
uint64_t z_gid; \
uint64_t z_gen; \
uint64_t z_atime[2]; \
uint64_t z_links;
#define ZFS_LINK_MAX UINT64_MAX
/*
* 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 minor_t zfsdev_minor_alloc(void);
/*
* Range locking rules
* --------------------
* 1. When truncating a file (zfs_create, zfs_setattr, zfs_space) the whole
* file range needs to be locked as RL_WRITER. Only then can the pages be
* freed etc and zp_size reset. zp_size must be set within range lock.
* 2. For writes and punching holes (zfs_write & zfs_space) just the range
* being written or freed needs to be locked as RL_WRITER.
* Multiple writes at the end of the file must coordinate zp_size updates
* to ensure data isn't lost. A compare and swap loop is currently used
* to ensure the file size is at least the offset last written.
* 3. For reads (zfs_read, zfs_get_data & zfs_putapage) just the range being
* read needs to be locked as RL_READER. A check against zp_size can then
* be made for reading beyond end of file.
*/
/*
* Convert between znode pointers and vnode pointers
*/
#define ZTOV(ZP) ((ZP)->z_vnode)
#define ZTOI(ZP) ((ZP)->z_vnode)
#define VTOZ(VP) ((struct znode *)(VP)->v_data)
#define ITOZ(VP) ((struct znode *)(VP)->v_data)
#define zhold(zp) vhold(ZTOV((zp)))
#define zrele(zp) vrele(ZTOV((zp)))
#define ZTOZSB(zp) ((zp)->z_zfsvfs)
#define ITOZSB(vp) (VTOZ(vp)->z_zfsvfs)
#define ZTOTYPE(zp) (ZTOV(zp)->v_type)
#define ZTOGID(zp) ((zp)->z_gid)
#define ZTOUID(zp) ((zp)->z_uid)
#define ZTONLNK(zp) ((zp)->z_links)
#define Z_ISBLK(type) ((type) == VBLK)
#define Z_ISCHR(type) ((type) == VCHR)
#define Z_ISLNK(type) ((type) == VLNK)
/* Called on entry to each ZFS vnode and vfs operation */
#define ZFS_ENTER(zfsvfs) \
{ \
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
if ((zfsvfs)->z_unmounted) { \
ZFS_EXIT(zfsvfs); \
return (EIO); \
} \
}
/* Must be called before exiting the vop */
#define ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG)
/* Verifies the znode is valid */
#define ZFS_VERIFY_ZP(zp) \
if ((zp)->z_sa_hdl == NULL) { \
ZFS_EXIT((zp)->z_zfsvfs); \
return (EIO); \
} \
/*
* Macros for dealing with dmu_buf_hold
*/
#define ZFS_OBJ_HASH(obj_num) ((obj_num) & (ZFS_OBJ_MTX_SZ - 1))
#define ZFS_OBJ_MUTEX(zfsvfs, obj_num) \
(&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)])
#define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \
mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
#define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \
mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \
mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
/* Encode ZFS stored time values from a struct timespec */
#define ZFS_TIME_ENCODE(tp, stmp) \
{ \
(stmp)[0] = (uint64_t)(tp)->tv_sec; \
(stmp)[1] = (uint64_t)(tp)->tv_nsec; \
}
/* Decode ZFS stored time values to a struct timespec */
#define ZFS_TIME_DECODE(tp, stmp) \
{ \
(tp)->tv_sec = (time_t)(stmp)[0]; \
(tp)->tv_nsec = (long)(stmp)[1]; \
}
#define ZFS_ACCESSTIME_STAMP(zfsvfs, zp) \
if ((zfsvfs)->z_atime && !((zfsvfs)->z_vfs->vfs_flag & VFS_RDONLY)) \
zfs_tstamp_update_setup_ext(zp, ACCESSED, NULL, NULL, B_FALSE);
extern void zfs_tstamp_update_setup_ext(struct znode *,
uint_t, uint64_t [2], uint64_t [2], boolean_t have_tx);
extern void zfs_znode_free(struct znode *);
extern zil_get_data_t zfs_get_data;
extern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE];
extern int zfsfstype;
extern int zfs_znode_parent_and_name(struct znode *zp, struct znode **dzpp,
char *buf);
#ifdef __cplusplus
}
#endif
#endif /* _FREEBSD_SYS_FS_ZFS_ZNODE_H */
+1
View File
@@ -0,0 +1 @@
/* Don't remove */