diff --git a/ZFS.RELEASE b/ZFS.RELEASE new file mode 100644 index 0000000000..c00b983276 --- /dev/null +++ b/ZFS.RELEASE @@ -0,0 +1 @@ +http://dlc.sun.com/osol/on/downloads/b103/on-src.tar.bz2 diff --git a/zfs/zcmd/zdb/zdb.c b/cmd/zdb/zdb.c similarity index 100% rename from zfs/zcmd/zdb/zdb.c rename to cmd/zdb/zdb.c diff --git a/zfs/zcmd/zdb/zdb_il.c b/cmd/zdb/zdb_il.c similarity index 100% rename from zfs/zcmd/zdb/zdb_il.c rename to cmd/zdb/zdb_il.c diff --git a/zfs/zcmd/zdump/zdump.c b/cmd/zdump/zdump.c similarity index 100% rename from zfs/zcmd/zdump/zdump.c rename to cmd/zdump/zdump.c diff --git a/zfs/zcmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c similarity index 100% rename from zfs/zcmd/zfs/zfs_iter.c rename to cmd/zfs/zfs_iter.c diff --git a/zfs/zcmd/zfs/zfs_iter.h b/cmd/zfs/zfs_iter.h similarity index 100% rename from zfs/zcmd/zfs/zfs_iter.h rename to cmd/zfs/zfs_iter.h diff --git a/zfs/zcmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c similarity index 100% rename from zfs/zcmd/zfs/zfs_main.c rename to cmd/zfs/zfs_main.c diff --git a/zfs/zcmd/zfs/zfs_util.h b/cmd/zfs/zfs_util.h similarity index 100% rename from zfs/zcmd/zfs/zfs_util.h rename to cmd/zfs/zfs_util.h diff --git a/zfs/zcmd/zinject/translate.c b/cmd/zinject/translate.c similarity index 100% rename from zfs/zcmd/zinject/translate.c rename to cmd/zinject/translate.c diff --git a/zfs/zcmd/zinject/zinject.c b/cmd/zinject/zinject.c similarity index 100% rename from zfs/zcmd/zinject/zinject.c rename to cmd/zinject/zinject.c diff --git a/zfs/zcmd/zinject/zinject.h b/cmd/zinject/zinject.h similarity index 100% rename from zfs/zcmd/zinject/zinject.h rename to cmd/zinject/zinject.h diff --git a/zfs/zcmd/zpool/zpool_iter.c b/cmd/zpool/zpool_iter.c similarity index 100% rename from zfs/zcmd/zpool/zpool_iter.c rename to cmd/zpool/zpool_iter.c diff --git a/zfs/zcmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c similarity index 100% rename from zfs/zcmd/zpool/zpool_main.c rename to cmd/zpool/zpool_main.c diff --git a/zfs/zcmd/zpool/zpool_util.c b/cmd/zpool/zpool_util.c similarity index 100% rename from zfs/zcmd/zpool/zpool_util.c rename to cmd/zpool/zpool_util.c diff --git a/zfs/zcmd/zpool/zpool_util.h b/cmd/zpool/zpool_util.h similarity index 100% rename from zfs/zcmd/zpool/zpool_util.h rename to cmd/zpool/zpool_util.h diff --git a/zfs/zcmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c similarity index 100% rename from zfs/zcmd/zpool/zpool_vdev.c rename to cmd/zpool/zpool_vdev.c diff --git a/zfs/zcmd/ztest/ztest.c b/cmd/ztest/ztest.c similarity index 100% rename from zfs/zcmd/ztest/ztest.c rename to cmd/ztest/ztest.c diff --git a/zfs/lib/libspl/include/sys/list.h b/lib/libspl/include/sys/list.h similarity index 100% rename from zfs/lib/libspl/include/sys/list.h rename to lib/libspl/include/sys/list.h diff --git a/zfs/lib/libspl/include/sys/list_impl.h b/lib/libspl/include/sys/list_impl.h similarity index 100% rename from zfs/lib/libspl/include/sys/list_impl.h rename to lib/libspl/include/sys/list_impl.h diff --git a/zfs/lib/libspl/list.c b/lib/libspl/list.c similarity index 100% rename from zfs/lib/libspl/list.c rename to lib/libspl/list.c diff --git a/zfs/lib/libspl/mkdirp.c b/lib/libspl/mkdirp.c similarity index 100% rename from zfs/lib/libspl/mkdirp.c rename to lib/libspl/mkdirp.c diff --git a/zfs/lib/libspl/strlcat.c b/lib/libspl/strlcat.c similarity index 100% rename from zfs/lib/libspl/strlcat.c rename to lib/libspl/strlcat.c diff --git a/zfs/lib/libspl/strlcpy.c b/lib/libspl/strlcpy.c similarity index 100% rename from zfs/lib/libspl/strlcpy.c rename to lib/libspl/strlcpy.c diff --git a/zfs/lib/libspl/strnlen.c b/lib/libspl/strnlen.c similarity index 100% rename from zfs/lib/libspl/strnlen.c rename to lib/libspl/strnlen.c diff --git a/zfs/lib/libspl/u8_textprep.c b/lib/libspl/u8_textprep.c similarity index 100% rename from zfs/lib/libspl/u8_textprep.c rename to lib/libspl/u8_textprep.c diff --git a/zfs/lib/libuutil/include/libuutil.h b/lib/libuutil/include/libuutil.h similarity index 100% rename from zfs/lib/libuutil/include/libuutil.h rename to lib/libuutil/include/libuutil.h diff --git a/zfs/lib/libuutil/include/libuutil_common.h b/lib/libuutil/include/libuutil_common.h similarity index 100% rename from zfs/lib/libuutil/include/libuutil_common.h rename to lib/libuutil/include/libuutil_common.h diff --git a/zfs/lib/libuutil/include/libuutil_impl.h b/lib/libuutil/include/libuutil_impl.h similarity index 100% rename from zfs/lib/libuutil/include/libuutil_impl.h rename to lib/libuutil/include/libuutil_impl.h diff --git a/zfs/lib/libuutil/uu_alloc.c b/lib/libuutil/uu_alloc.c similarity index 100% rename from zfs/lib/libuutil/uu_alloc.c rename to lib/libuutil/uu_alloc.c diff --git a/zfs/lib/libuutil/uu_avl.c b/lib/libuutil/uu_avl.c similarity index 100% rename from zfs/lib/libuutil/uu_avl.c rename to lib/libuutil/uu_avl.c diff --git a/zfs/lib/libuutil/uu_dprintf.c b/lib/libuutil/uu_dprintf.c similarity index 100% rename from zfs/lib/libuutil/uu_dprintf.c rename to lib/libuutil/uu_dprintf.c diff --git a/zfs/lib/libuutil/uu_ident.c b/lib/libuutil/uu_ident.c similarity index 100% rename from zfs/lib/libuutil/uu_ident.c rename to lib/libuutil/uu_ident.c diff --git a/zfs/lib/libuutil/uu_list.c b/lib/libuutil/uu_list.c similarity index 100% rename from zfs/lib/libuutil/uu_list.c rename to lib/libuutil/uu_list.c diff --git a/zfs/lib/libuutil/uu_misc.c b/lib/libuutil/uu_misc.c similarity index 100% rename from zfs/lib/libuutil/uu_misc.c rename to lib/libuutil/uu_misc.c diff --git a/zfs/lib/libuutil/uu_open.c b/lib/libuutil/uu_open.c similarity index 100% rename from zfs/lib/libuutil/uu_open.c rename to lib/libuutil/uu_open.c diff --git a/zfs/lib/libuutil/uu_pname.c b/lib/libuutil/uu_pname.c similarity index 100% rename from zfs/lib/libuutil/uu_pname.c rename to lib/libuutil/uu_pname.c diff --git a/zfs/lib/libuutil/uu_strtoint.c b/lib/libuutil/uu_strtoint.c similarity index 100% rename from zfs/lib/libuutil/uu_strtoint.c rename to lib/libuutil/uu_strtoint.c diff --git a/zfs/lib/libzfs/include/libzfs.h b/lib/libzfs/include/libzfs.h similarity index 100% rename from zfs/lib/libzfs/include/libzfs.h rename to lib/libzfs/include/libzfs.h diff --git a/zfs/lib/libzfs/include/libzfs_impl.h b/lib/libzfs/include/libzfs_impl.h similarity index 100% rename from zfs/lib/libzfs/include/libzfs_impl.h rename to lib/libzfs/include/libzfs_impl.h diff --git a/zfs/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c similarity index 100% rename from zfs/lib/libzfs/libzfs_changelist.c rename to lib/libzfs/libzfs_changelist.c diff --git a/zfs/lib/libzfs/libzfs_config.c b/lib/libzfs/libzfs_config.c similarity index 100% rename from zfs/lib/libzfs/libzfs_config.c rename to lib/libzfs/libzfs_config.c diff --git a/zfs/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c similarity index 100% rename from zfs/lib/libzfs/libzfs_dataset.c rename to lib/libzfs/libzfs_dataset.c diff --git a/zfs/lib/libzfs/libzfs_graph.c b/lib/libzfs/libzfs_graph.c similarity index 100% rename from zfs/lib/libzfs/libzfs_graph.c rename to lib/libzfs/libzfs_graph.c diff --git a/zfs/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c similarity index 100% rename from zfs/lib/libzfs/libzfs_import.c rename to lib/libzfs/libzfs_import.c diff --git a/zfs/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c similarity index 100% rename from zfs/lib/libzfs/libzfs_mount.c rename to lib/libzfs/libzfs_mount.c diff --git a/zfs/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c similarity index 100% rename from zfs/lib/libzfs/libzfs_pool.c rename to lib/libzfs/libzfs_pool.c diff --git a/zfs/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c similarity index 100% rename from zfs/lib/libzfs/libzfs_sendrecv.c rename to lib/libzfs/libzfs_sendrecv.c diff --git a/zfs/lib/libzfs/libzfs_status.c b/lib/libzfs/libzfs_status.c similarity index 100% rename from zfs/lib/libzfs/libzfs_status.c rename to lib/libzfs/libzfs_status.c diff --git a/zfs/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c similarity index 100% rename from zfs/lib/libzfs/libzfs_util.c rename to lib/libzfs/libzfs_util.c diff --git a/lib/libzpool/include/sys/zfs_context.h b/lib/libzpool/include/sys/zfs_context.h new file mode 100644 index 0000000000..0e7019bba8 --- /dev/null +++ b/lib/libzpool/include/sys/zfs_context.h @@ -0,0 +1,547 @@ +/* + * 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 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZFS_CONTEXT_H +#define _SYS_ZFS_CONTEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define _SYS_MUTEX_H +#define _SYS_RWLOCK_H +#define _SYS_CONDVAR_H +#define _SYS_SYSTM_H +#define _SYS_DEBUG_H +#define _SYS_T_LOCK_H +#define _SYS_VNODE_H +#define _SYS_VFS_H +#define _SYS_SUNDDI_H +#define _SYS_CALLB_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Debugging + */ + +/* + * Note that we are not using the debugging levels. + */ + +#define CE_CONT 0 /* continuation */ +#define CE_NOTE 1 /* notice */ +#define CE_WARN 2 /* warning */ +#define CE_PANIC 3 /* panic */ +#define CE_IGNORE 4 /* print nothing */ + +/* + * ZFS debugging + */ + +#ifdef ZFS_DEBUG +extern void dprintf_setup(int *argc, char **argv); +#endif /* ZFS_DEBUG */ + +extern void cmn_err(int, const char *, ...); +extern void vcmn_err(int, const char *, __va_list); +extern void panic(const char *, ...); +extern void vpanic(const char *, __va_list); + +#define fm_panic panic + +/* This definition is copied from assert.h. */ +#if defined(__STDC__) +#if __STDC_VERSION__ - 0 >= 199901L +#define verify(EX) (void)((EX) || \ + (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0)) +#else +#define verify(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0)) +#endif /* __STDC_VERSION__ - 0 >= 199901L */ +#else +#define verify(EX) (void)((EX) || (_assert("EX", __FILE__, __LINE__), 0)) +#endif /* __STDC__ */ + + +#define VERIFY verify +#define ASSERT assert + +extern void __assert(const char *, const char *, int); + +#ifdef lint +#define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0) +#else +/* BEGIN CSTYLED */ +#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ + const TYPE __left = (TYPE)(LEFT); \ + const TYPE __right = (TYPE)(RIGHT); \ + if (!(__left OP __right)) { \ + char *__buf = alloca(256); \ + (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ + #LEFT, #OP, #RIGHT, \ + (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ + __assert(__buf, __FILE__, __LINE__); \ + } \ +_NOTE(CONSTCOND) } while (0) +/* END CSTYLED */ +#endif /* lint */ + +#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) +#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) +#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) + +#ifdef NDEBUG +#define ASSERT3S(x, y, z) ((void)0) +#define ASSERT3U(x, y, z) ((void)0) +#define ASSERT3P(x, y, z) ((void)0) +#else +#define ASSERT3S(x, y, z) VERIFY3S(x, y, z) +#define ASSERT3U(x, y, z) VERIFY3U(x, y, z) +#define ASSERT3P(x, y, z) VERIFY3P(x, y, z) +#endif + +/* + * DTrace SDT probes have different signatures in userland than they do in + * kernel. If they're being used in kernel code, re-define them out of + * existence for their counterparts in libzpool. + */ + +#ifdef DTRACE_PROBE +#undef DTRACE_PROBE +#define DTRACE_PROBE(a) ((void)0) +#endif /* DTRACE_PROBE */ + +#ifdef DTRACE_PROBE1 +#undef DTRACE_PROBE1 +#define DTRACE_PROBE1(a, b, c) ((void)0) +#endif /* DTRACE_PROBE1 */ + +#ifdef DTRACE_PROBE2 +#undef DTRACE_PROBE2 +#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) +#endif /* DTRACE_PROBE2 */ + +#ifdef DTRACE_PROBE3 +#undef DTRACE_PROBE3 +#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) +#endif /* DTRACE_PROBE3 */ + +#ifdef DTRACE_PROBE4 +#undef DTRACE_PROBE4 +#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) +#endif /* DTRACE_PROBE4 */ + +/* + * Threads + */ +#define curthread ((void *)(uintptr_t)thr_self()) + +typedef struct kthread kthread_t; + +#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ + zk_thread_create(func, arg) +#define thread_exit() thr_exit(NULL) + +extern kthread_t *zk_thread_create(void (*func)(), void *arg); + +#define issig(why) (FALSE) +#define ISSIG(thr, why) (FALSE) + +/* + * Mutexes + */ +typedef struct kmutex { + void *m_owner; + boolean_t initialized; + mutex_t m_lock; +} kmutex_t; + +#define MUTEX_DEFAULT USYNC_THREAD +#undef MUTEX_HELD +#define MUTEX_HELD(m) _mutex_held(&(m)->m_lock) + +/* + * Argh -- we have to get cheesy here because the kernel and userland + * have different signatures for the same routine. + */ +extern int _mutex_init(mutex_t *mp, int type, void *arg); +extern int _mutex_destroy(mutex_t *mp); + +#define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp)) +#define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp)) + +extern void zmutex_init(kmutex_t *mp); +extern void zmutex_destroy(kmutex_t *mp); +extern void mutex_enter(kmutex_t *mp); +extern void mutex_exit(kmutex_t *mp); +extern int mutex_tryenter(kmutex_t *mp); +extern void *mutex_owner(kmutex_t *mp); + +/* + * RW locks + */ +typedef struct krwlock { + void *rw_owner; + boolean_t initialized; + rwlock_t rw_lock; +} krwlock_t; + +typedef int krw_t; + +#define RW_READER 0 +#define RW_WRITER 1 +#define RW_DEFAULT USYNC_THREAD + +#undef RW_READ_HELD +#define RW_READ_HELD(x) _rw_read_held(&(x)->rw_lock) + +#undef RW_WRITE_HELD +#define RW_WRITE_HELD(x) _rw_write_held(&(x)->rw_lock) + +extern void rw_init(krwlock_t *rwlp, char *name, int type, void *arg); +extern void rw_destroy(krwlock_t *rwlp); +extern void rw_enter(krwlock_t *rwlp, krw_t rw); +extern int rw_tryenter(krwlock_t *rwlp, krw_t rw); +extern int rw_tryupgrade(krwlock_t *rwlp); +extern void rw_exit(krwlock_t *rwlp); +#define rw_downgrade(rwlp) do { } while (0) + +extern uid_t crgetuid(cred_t *cr); +extern gid_t crgetgid(cred_t *cr); +extern int crgetngroups(cred_t *cr); +extern gid_t *crgetgroups(cred_t *cr); + +/* + * Condition variables + */ +typedef cond_t kcondvar_t; + +#define CV_DEFAULT USYNC_THREAD + +extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg); +extern void cv_destroy(kcondvar_t *cv); +extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); +extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); +extern void cv_signal(kcondvar_t *cv); +extern void cv_broadcast(kcondvar_t *cv); + +/* + * kstat creation, installation and deletion + */ +extern kstat_t *kstat_create(char *, int, + char *, char *, uchar_t, ulong_t, uchar_t); +extern void kstat_install(kstat_t *); +extern void kstat_delete(kstat_t *); + +/* + * Kernel memory + */ +#define KM_SLEEP UMEM_NOFAIL +#define KM_PUSHPAGE KM_SLEEP +#define KM_NOSLEEP UMEM_DEFAULT +#define KMC_NODEBUG UMC_NODEBUG +#define kmem_alloc(_s, _f) umem_alloc(_s, _f) +#define kmem_zalloc(_s, _f) umem_zalloc(_s, _f) +#define kmem_free(_b, _s) umem_free(_b, _s) +#define kmem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) \ + umem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) +#define kmem_cache_destroy(_c) umem_cache_destroy(_c) +#define kmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f) +#define kmem_cache_free(_c, _b) umem_cache_free(_c, _b) +#define kmem_debugging() 0 +#define kmem_cache_reap_now(c) + +typedef umem_cache_t kmem_cache_t; + +/* + * Task queues + */ +typedef struct taskq taskq_t; +typedef uintptr_t taskqid_t; +typedef void (task_func_t)(void *); + +#define TASKQ_PREPOPULATE 0x0001 +#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ +#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ + +#define TQ_SLEEP KM_SLEEP /* Can block for memory */ +#define TQ_NOSLEEP KM_NOSLEEP /* cannot block for memory; may fail */ +#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ + +extern taskq_t *system_taskq; + +extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); +extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void taskq_destroy(taskq_t *); +extern void taskq_wait(taskq_t *); +extern int taskq_member(taskq_t *, void *); +extern void system_taskq_init(void); + +#define XVA_MAPSIZE 3 +#define XVA_MAGIC 0x78766174 + +/* + * vnodes + */ +typedef struct vnode { + uint64_t v_size; + int v_fd; + char *v_path; +} vnode_t; + + +typedef struct xoptattr { + timestruc_t xoa_createtime; /* Create time of file */ + uint8_t xoa_archive; + uint8_t xoa_system; + uint8_t xoa_readonly; + uint8_t xoa_hidden; + uint8_t xoa_nounlink; + uint8_t xoa_immutable; + uint8_t xoa_appendonly; + uint8_t xoa_nodump; + uint8_t xoa_settable; + uint8_t xoa_opaque; + uint8_t xoa_av_quarantined; + uint8_t xoa_av_modified; +} xoptattr_t; + +typedef struct vattr { + uint_t va_mask; /* bit-mask of attributes */ + u_offset_t va_size; /* file size in bytes */ +} vattr_t; + + +typedef struct xvattr { + vattr_t xva_vattr; /* Embedded vattr structure */ + uint32_t xva_magic; /* Magic Number */ + uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ + uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ + uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ + uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ + xoptattr_t xva_xoptattrs; /* Optional attributes */ +} xvattr_t; + +typedef struct vsecattr { + uint_t vsa_mask; /* See below */ + int vsa_aclcnt; /* ACL entry count */ + void *vsa_aclentp; /* pointer to ACL entries */ + int vsa_dfaclcnt; /* default ACL entry count */ + void *vsa_dfaclentp; /* pointer to default ACL entries */ + size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ +} vsecattr_t; + +#define AT_TYPE 0x00001 +#define AT_MODE 0x00002 +#define AT_UID 0x00004 +#define AT_GID 0x00008 +#define AT_FSID 0x00010 +#define AT_NODEID 0x00020 +#define AT_NLINK 0x00040 +#define AT_SIZE 0x00080 +#define AT_ATIME 0x00100 +#define AT_MTIME 0x00200 +#define AT_CTIME 0x00400 +#define AT_RDEV 0x00800 +#define AT_BLKSIZE 0x01000 +#define AT_NBLOCKS 0x02000 +#define AT_SEQ 0x08000 +#define AT_XVATTR 0x10000 + +#define CRCREAT 0 + +#define VOP_CLOSE(vp, f, c, o, cr, ct) 0 +#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0 +#define VOP_GETATTR(vp, vap, fl, cr, ct) ((vap)->va_size = (vp)->v_size, 0) + +#define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd) + +#define VN_RELE(vp) vn_close(vp) + +extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp, + int x2, int x3); +extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp, + int x2, int x3, vnode_t *vp, int fd); +extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, + offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp); +extern void vn_close(vnode_t *vp); + +#define vn_remove(path, x1, x2) remove(path) +#define vn_rename(from, to, seg) rename((from), (to)) +#define vn_is_readonly(vp) B_FALSE + +extern vnode_t *rootdir; + +#include /* for FREAD, FWRITE, etc */ + +/* + * Random stuff + */ +#define lbolt (gethrtime() >> 23) +#define lbolt64 (gethrtime() >> 23) +#define hz 119 /* frequency when using gethrtime() >> 23 for lbolt */ + +extern void delay(clock_t ticks); + +#define gethrestime_sec() time(NULL) + +#define max_ncpus 64 + +#define minclsyspri 60 +#define maxclsyspri 99 + +#define CPU_SEQID (thr_self() & (max_ncpus - 1)) + +#define kcred NULL +#define CRED() NULL + +#define ptob(x) ((x) * PAGESIZE) + +extern uint64_t physmem; + +extern int highbit(ulong_t i); +extern int random_get_bytes(uint8_t *ptr, size_t len); +extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len); + +extern void kernel_init(int); +extern void kernel_fini(void); + +struct spa; +extern void nicenum(uint64_t num, char *buf); +extern void show_pool_stats(struct spa *); + +typedef struct callb_cpr { + kmutex_t *cc_lockp; +} callb_cpr_t; + +#define CALLB_CPR_INIT(cp, lockp, func, name) { \ + (cp)->cc_lockp = lockp; \ +} + +#define CALLB_CPR_SAFE_BEGIN(cp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ +} + +#define CALLB_CPR_SAFE_END(cp, lockp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ +} + +#define CALLB_CPR_EXIT(cp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ + mutex_exit((cp)->cc_lockp); \ +} + +#define zone_dataset_visible(x, y) (1) +#define INGLOBALZONE(z) (1) + +/* + * Hostname information + */ +extern char hw_serial[]; +extern int ddi_strtoul(const char *str, char **nptr, int base, + unsigned long *result); + +/* ZFS Boot Related stuff. */ + +struct _buf { + intptr_t _fd; +}; + +struct bootstat { + uint64_t st_size; +}; + +typedef struct ace_object { + uid_t a_who; + uint32_t a_access_mask; + uint16_t a_flags; + uint16_t a_type; + uint8_t a_obj_type[16]; + uint8_t a_inherit_obj_type[16]; +} ace_object_t; + + +#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 +#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 +#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 +#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 + +extern struct _buf *kobj_open_file(char *name); +extern int kobj_read_file(struct _buf *file, char *buf, unsigned size, + unsigned off); +extern void kobj_close_file(struct _buf *file); +extern int kobj_get_filesize(struct _buf *file, uint64_t *size); +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 zoneid_t getzoneid(void); + +/* SID stuff */ +typedef struct ksiddomain { + uint_t kd_ref; + uint_t kd_len; + char *kd_name; +} ksiddomain_t; + +ksiddomain_t *ksid_lookupdomain(const char *); +void ksiddomain_rele(ksiddomain_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_ZFS_CONTEXT_H */ diff --git a/zfs/lib/libzpool/kernel.c b/lib/libzpool/kernel.c similarity index 100% rename from zfs/lib/libzpool/kernel.c rename to lib/libzpool/kernel.c diff --git a/zfs/lib/libzpool/taskq.c b/lib/libzpool/taskq.c similarity index 100% rename from zfs/lib/libzpool/taskq.c rename to lib/libzpool/taskq.c diff --git a/zfs/lib/libzpool/util.c b/lib/libzpool/util.c similarity index 100% rename from zfs/lib/libzpool/util.c rename to lib/libzpool/util.c diff --git a/zfs/lib/libavl/avl.c b/module/avl/avl.c similarity index 100% rename from zfs/lib/libavl/avl.c rename to module/avl/avl.c diff --git a/zfs/lib/libavl/include/sys/avl.h b/module/avl/include/sys/avl.h similarity index 100% rename from zfs/lib/libavl/include/sys/avl.h rename to module/avl/include/sys/avl.h diff --git a/zfs/lib/libavl/include/sys/avl_impl.h b/module/avl/include/sys/avl_impl.h similarity index 100% rename from zfs/lib/libavl/include/sys/avl_impl.h rename to module/avl/include/sys/avl_impl.h diff --git a/zfs/lib/libnvpair/include/libnvpair.h b/module/nvpair/include/libnvpair.h similarity index 100% rename from zfs/lib/libnvpair/include/libnvpair.h rename to module/nvpair/include/libnvpair.h diff --git a/zfs/lib/libnvpair/include/sys/nvpair.h b/module/nvpair/include/sys/nvpair.h similarity index 100% rename from zfs/lib/libnvpair/include/sys/nvpair.h rename to module/nvpair/include/sys/nvpair.h diff --git a/zfs/lib/libnvpair/include/sys/nvpair_impl.h b/module/nvpair/include/sys/nvpair_impl.h similarity index 100% rename from zfs/lib/libnvpair/include/sys/nvpair_impl.h rename to module/nvpair/include/sys/nvpair_impl.h diff --git a/zfs/lib/libnvpair/libnvpair.c b/module/nvpair/libnvpair.c similarity index 100% rename from zfs/lib/libnvpair/libnvpair.c rename to module/nvpair/libnvpair.c diff --git a/zfs/lib/libnvpair/nvpair.c b/module/nvpair/nvpair.c similarity index 100% rename from zfs/lib/libnvpair/nvpair.c rename to module/nvpair/nvpair.c diff --git a/zfs/lib/libnvpair/nvpair_alloc_fixed.c b/module/nvpair/nvpair_alloc_fixed.c similarity index 100% rename from zfs/lib/libnvpair/nvpair_alloc_fixed.c rename to module/nvpair/nvpair_alloc_fixed.c diff --git a/zfs/lib/libnvpair/nvpair_alloc_system.c b/module/nvpair/nvpair_alloc_system.c similarity index 100% rename from zfs/lib/libnvpair/nvpair_alloc_system.c rename to module/nvpair/nvpair_alloc_system.c diff --git a/zfs/lib/libzcommon/include/sys/fm/fs/zfs.h b/module/zcommon/include/sys/fm/fs/zfs.h similarity index 100% rename from zfs/lib/libzcommon/include/sys/fm/fs/zfs.h rename to module/zcommon/include/sys/fm/fs/zfs.h diff --git a/zfs/lib/libzcommon/include/sys/fs/zfs.h b/module/zcommon/include/sys/fs/zfs.h similarity index 100% rename from zfs/lib/libzcommon/include/sys/fs/zfs.h rename to module/zcommon/include/sys/fs/zfs.h diff --git a/zfs/lib/libzcommon/include/zfs_comutil.h b/module/zcommon/include/zfs_comutil.h similarity index 100% rename from zfs/lib/libzcommon/include/zfs_comutil.h rename to module/zcommon/include/zfs_comutil.h diff --git a/zfs/lib/libzcommon/include/zfs_deleg.h b/module/zcommon/include/zfs_deleg.h similarity index 100% rename from zfs/lib/libzcommon/include/zfs_deleg.h rename to module/zcommon/include/zfs_deleg.h diff --git a/zfs/lib/libzcommon/include/zfs_namecheck.h b/module/zcommon/include/zfs_namecheck.h similarity index 100% rename from zfs/lib/libzcommon/include/zfs_namecheck.h rename to module/zcommon/include/zfs_namecheck.h diff --git a/zfs/lib/libzcommon/include/zfs_prop.h b/module/zcommon/include/zfs_prop.h similarity index 100% rename from zfs/lib/libzcommon/include/zfs_prop.h rename to module/zcommon/include/zfs_prop.h diff --git a/zfs/lib/libzcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c similarity index 100% rename from zfs/lib/libzcommon/zfs_comutil.c rename to module/zcommon/zfs_comutil.c diff --git a/zfs/lib/libzcommon/zfs_deleg.c b/module/zcommon/zfs_deleg.c similarity index 100% rename from zfs/lib/libzcommon/zfs_deleg.c rename to module/zcommon/zfs_deleg.c diff --git a/zfs/lib/libzcommon/zfs_namecheck.c b/module/zcommon/zfs_namecheck.c similarity index 100% rename from zfs/lib/libzcommon/zfs_namecheck.c rename to module/zcommon/zfs_namecheck.c diff --git a/zfs/lib/libzcommon/zfs_prop.c b/module/zcommon/zfs_prop.c similarity index 100% rename from zfs/lib/libzcommon/zfs_prop.c rename to module/zcommon/zfs_prop.c diff --git a/zfs/lib/libzcommon/zpool_prop.c b/module/zcommon/zpool_prop.c similarity index 100% rename from zfs/lib/libzcommon/zpool_prop.c rename to module/zcommon/zpool_prop.c diff --git a/zfs/lib/libzcommon/zprop_common.c b/module/zcommon/zprop_common.c similarity index 100% rename from zfs/lib/libzcommon/zprop_common.c rename to module/zcommon/zprop_common.c diff --git a/zfs/lib/libzpool/arc.c b/module/zfs/arc.c similarity index 100% rename from zfs/lib/libzpool/arc.c rename to module/zfs/arc.c diff --git a/zfs/lib/libzpool/bplist.c b/module/zfs/bplist.c similarity index 100% rename from zfs/lib/libzpool/bplist.c rename to module/zfs/bplist.c diff --git a/zfs/lib/libzpool/dbuf.c b/module/zfs/dbuf.c similarity index 100% rename from zfs/lib/libzpool/dbuf.c rename to module/zfs/dbuf.c diff --git a/zfs/lib/libzpool/dmu.c b/module/zfs/dmu.c similarity index 100% rename from zfs/lib/libzpool/dmu.c rename to module/zfs/dmu.c diff --git a/zfs/lib/libzpool/dmu_object.c b/module/zfs/dmu_object.c similarity index 100% rename from zfs/lib/libzpool/dmu_object.c rename to module/zfs/dmu_object.c diff --git a/zfs/lib/libzpool/dmu_objset.c b/module/zfs/dmu_objset.c similarity index 100% rename from zfs/lib/libzpool/dmu_objset.c rename to module/zfs/dmu_objset.c diff --git a/zfs/lib/libzpool/dmu_send.c b/module/zfs/dmu_send.c similarity index 100% rename from zfs/lib/libzpool/dmu_send.c rename to module/zfs/dmu_send.c diff --git a/zfs/lib/libzpool/dmu_traverse.c b/module/zfs/dmu_traverse.c similarity index 100% rename from zfs/lib/libzpool/dmu_traverse.c rename to module/zfs/dmu_traverse.c diff --git a/zfs/lib/libzpool/dmu_tx.c b/module/zfs/dmu_tx.c similarity index 100% rename from zfs/lib/libzpool/dmu_tx.c rename to module/zfs/dmu_tx.c diff --git a/zfs/lib/libzpool/dmu_zfetch.c b/module/zfs/dmu_zfetch.c similarity index 100% rename from zfs/lib/libzpool/dmu_zfetch.c rename to module/zfs/dmu_zfetch.c diff --git a/zfs/lib/libzpool/dnode.c b/module/zfs/dnode.c similarity index 100% rename from zfs/lib/libzpool/dnode.c rename to module/zfs/dnode.c diff --git a/zfs/lib/libzpool/dnode_sync.c b/module/zfs/dnode_sync.c similarity index 100% rename from zfs/lib/libzpool/dnode_sync.c rename to module/zfs/dnode_sync.c diff --git a/zfs/lib/libzpool/dsl_dataset.c b/module/zfs/dsl_dataset.c similarity index 100% rename from zfs/lib/libzpool/dsl_dataset.c rename to module/zfs/dsl_dataset.c diff --git a/zfs/lib/libzpool/dsl_deleg.c b/module/zfs/dsl_deleg.c similarity index 100% rename from zfs/lib/libzpool/dsl_deleg.c rename to module/zfs/dsl_deleg.c diff --git a/zfs/lib/libzpool/dsl_dir.c b/module/zfs/dsl_dir.c similarity index 100% rename from zfs/lib/libzpool/dsl_dir.c rename to module/zfs/dsl_dir.c diff --git a/zfs/lib/libzpool/dsl_pool.c b/module/zfs/dsl_pool.c similarity index 100% rename from zfs/lib/libzpool/dsl_pool.c rename to module/zfs/dsl_pool.c diff --git a/zfs/lib/libzpool/dsl_prop.c b/module/zfs/dsl_prop.c similarity index 100% rename from zfs/lib/libzpool/dsl_prop.c rename to module/zfs/dsl_prop.c diff --git a/zfs/lib/libzpool/dsl_scrub.c b/module/zfs/dsl_scrub.c similarity index 100% rename from zfs/lib/libzpool/dsl_scrub.c rename to module/zfs/dsl_scrub.c diff --git a/zfs/lib/libzpool/dsl_synctask.c b/module/zfs/dsl_synctask.c similarity index 100% rename from zfs/lib/libzpool/dsl_synctask.c rename to module/zfs/dsl_synctask.c diff --git a/zfs/lib/libzpool/fletcher.c b/module/zfs/fletcher.c similarity index 100% rename from zfs/lib/libzpool/fletcher.c rename to module/zfs/fletcher.c diff --git a/zfs/lib/libzpool/gzip.c b/module/zfs/gzip.c similarity index 100% rename from zfs/lib/libzpool/gzip.c rename to module/zfs/gzip.c diff --git a/zfs/lib/libzpool/include/sys/arc.h b/module/zfs/include/sys/arc.h similarity index 100% rename from zfs/lib/libzpool/include/sys/arc.h rename to module/zfs/include/sys/arc.h diff --git a/zfs/lib/libzpool/include/sys/bplist.h b/module/zfs/include/sys/bplist.h similarity index 100% rename from zfs/lib/libzpool/include/sys/bplist.h rename to module/zfs/include/sys/bplist.h diff --git a/zfs/lib/libzpool/include/sys/dbuf.h b/module/zfs/include/sys/dbuf.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dbuf.h rename to module/zfs/include/sys/dbuf.h diff --git a/zfs/lib/libzpool/include/sys/dmu.h b/module/zfs/include/sys/dmu.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dmu.h rename to module/zfs/include/sys/dmu.h diff --git a/zfs/lib/libzpool/include/sys/dmu_impl.h b/module/zfs/include/sys/dmu_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dmu_impl.h rename to module/zfs/include/sys/dmu_impl.h diff --git a/zfs/lib/libzpool/include/sys/dmu_objset.h b/module/zfs/include/sys/dmu_objset.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dmu_objset.h rename to module/zfs/include/sys/dmu_objset.h diff --git a/zfs/lib/libzpool/include/sys/dmu_traverse.h b/module/zfs/include/sys/dmu_traverse.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dmu_traverse.h rename to module/zfs/include/sys/dmu_traverse.h diff --git a/zfs/lib/libzpool/include/sys/dmu_tx.h b/module/zfs/include/sys/dmu_tx.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dmu_tx.h rename to module/zfs/include/sys/dmu_tx.h diff --git a/zfs/lib/libzpool/include/sys/dmu_zfetch.h b/module/zfs/include/sys/dmu_zfetch.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dmu_zfetch.h rename to module/zfs/include/sys/dmu_zfetch.h diff --git a/zfs/lib/libzpool/include/sys/dnode.h b/module/zfs/include/sys/dnode.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dnode.h rename to module/zfs/include/sys/dnode.h diff --git a/zfs/lib/libzpool/include/sys/dsl_dataset.h b/module/zfs/include/sys/dsl_dataset.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dsl_dataset.h rename to module/zfs/include/sys/dsl_dataset.h diff --git a/zfs/lib/libzpool/include/sys/dsl_deleg.h b/module/zfs/include/sys/dsl_deleg.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dsl_deleg.h rename to module/zfs/include/sys/dsl_deleg.h diff --git a/zfs/lib/libzpool/include/sys/dsl_dir.h b/module/zfs/include/sys/dsl_dir.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dsl_dir.h rename to module/zfs/include/sys/dsl_dir.h diff --git a/zfs/lib/libzpool/include/sys/dsl_pool.h b/module/zfs/include/sys/dsl_pool.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dsl_pool.h rename to module/zfs/include/sys/dsl_pool.h diff --git a/zfs/lib/libzpool/include/sys/dsl_prop.h b/module/zfs/include/sys/dsl_prop.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dsl_prop.h rename to module/zfs/include/sys/dsl_prop.h diff --git a/zfs/lib/libzpool/include/sys/dsl_synctask.h b/module/zfs/include/sys/dsl_synctask.h similarity index 100% rename from zfs/lib/libzpool/include/sys/dsl_synctask.h rename to module/zfs/include/sys/dsl_synctask.h diff --git a/zfs/lib/libzpool/include/sys/metaslab.h b/module/zfs/include/sys/metaslab.h similarity index 100% rename from zfs/lib/libzpool/include/sys/metaslab.h rename to module/zfs/include/sys/metaslab.h diff --git a/zfs/lib/libzpool/include/sys/metaslab_impl.h b/module/zfs/include/sys/metaslab_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/metaslab_impl.h rename to module/zfs/include/sys/metaslab_impl.h diff --git a/zfs/lib/libzpool/include/sys/refcount.h b/module/zfs/include/sys/refcount.h similarity index 100% rename from zfs/lib/libzpool/include/sys/refcount.h rename to module/zfs/include/sys/refcount.h diff --git a/zfs/lib/libzpool/include/sys/rrwlock.h b/module/zfs/include/sys/rrwlock.h similarity index 100% rename from zfs/lib/libzpool/include/sys/rrwlock.h rename to module/zfs/include/sys/rrwlock.h diff --git a/zfs/lib/libzpool/include/sys/spa.h b/module/zfs/include/sys/spa.h similarity index 100% rename from zfs/lib/libzpool/include/sys/spa.h rename to module/zfs/include/sys/spa.h diff --git a/zfs/lib/libzpool/include/sys/spa_boot.h b/module/zfs/include/sys/spa_boot.h similarity index 100% rename from zfs/lib/libzpool/include/sys/spa_boot.h rename to module/zfs/include/sys/spa_boot.h diff --git a/zfs/lib/libzpool/include/sys/spa_impl.h b/module/zfs/include/sys/spa_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/spa_impl.h rename to module/zfs/include/sys/spa_impl.h diff --git a/zfs/lib/libzpool/include/sys/space_map.h b/module/zfs/include/sys/space_map.h similarity index 100% rename from zfs/lib/libzpool/include/sys/space_map.h rename to module/zfs/include/sys/space_map.h diff --git a/zfs/lib/libzpool/include/sys/txg.h b/module/zfs/include/sys/txg.h similarity index 100% rename from zfs/lib/libzpool/include/sys/txg.h rename to module/zfs/include/sys/txg.h diff --git a/zfs/lib/libzpool/include/sys/txg_impl.h b/module/zfs/include/sys/txg_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/txg_impl.h rename to module/zfs/include/sys/txg_impl.h diff --git a/zfs/lib/libzpool/include/sys/uberblock.h b/module/zfs/include/sys/uberblock.h similarity index 100% rename from zfs/lib/libzpool/include/sys/uberblock.h rename to module/zfs/include/sys/uberblock.h diff --git a/zfs/lib/libzpool/include/sys/uberblock_impl.h b/module/zfs/include/sys/uberblock_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/uberblock_impl.h rename to module/zfs/include/sys/uberblock_impl.h diff --git a/zfs/lib/libzpool/include/sys/unique.h b/module/zfs/include/sys/unique.h similarity index 100% rename from zfs/lib/libzpool/include/sys/unique.h rename to module/zfs/include/sys/unique.h diff --git a/zfs/lib/libzpool/include/sys/vdev.h b/module/zfs/include/sys/vdev.h similarity index 100% rename from zfs/lib/libzpool/include/sys/vdev.h rename to module/zfs/include/sys/vdev.h diff --git a/zfs/lib/libzpool/include/sys/vdev_file.h b/module/zfs/include/sys/vdev_file.h similarity index 100% rename from zfs/lib/libzpool/include/sys/vdev_file.h rename to module/zfs/include/sys/vdev_file.h diff --git a/zfs/lib/libzpool/include/sys/vdev_impl.h b/module/zfs/include/sys/vdev_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/vdev_impl.h rename to module/zfs/include/sys/vdev_impl.h diff --git a/zfs/lib/libzpool/include/sys/zap.h b/module/zfs/include/sys/zap.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zap.h rename to module/zfs/include/sys/zap.h diff --git a/zfs/lib/libzpool/include/sys/zap_impl.h b/module/zfs/include/sys/zap_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zap_impl.h rename to module/zfs/include/sys/zap_impl.h diff --git a/zfs/lib/libzpool/include/sys/zap_leaf.h b/module/zfs/include/sys/zap_leaf.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zap_leaf.h rename to module/zfs/include/sys/zap_leaf.h diff --git a/zfs/lib/libzpool/include/sys/zfs_acl.h b/module/zfs/include/sys/zfs_acl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_acl.h rename to module/zfs/include/sys/zfs_acl.h diff --git a/zfs/lib/libzpool/include/sys/zfs_context.h b/module/zfs/include/sys/zfs_context.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_context.h rename to module/zfs/include/sys/zfs_context.h diff --git a/zfs/lib/libzpool/include/sys/zfs_ctldir.h b/module/zfs/include/sys/zfs_ctldir.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_ctldir.h rename to module/zfs/include/sys/zfs_ctldir.h diff --git a/zfs/lib/libzpool/include/sys/zfs_debug.h b/module/zfs/include/sys/zfs_debug.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_debug.h rename to module/zfs/include/sys/zfs_debug.h diff --git a/zfs/lib/libzpool/include/sys/zfs_dir.h b/module/zfs/include/sys/zfs_dir.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_dir.h rename to module/zfs/include/sys/zfs_dir.h diff --git a/zfs/lib/libzpool/include/sys/zfs_fuid.h b/module/zfs/include/sys/zfs_fuid.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_fuid.h rename to module/zfs/include/sys/zfs_fuid.h diff --git a/zfs/lib/libzpool/include/sys/zfs_ioctl.h b/module/zfs/include/sys/zfs_ioctl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_ioctl.h rename to module/zfs/include/sys/zfs_ioctl.h diff --git a/zfs/lib/libzpool/include/sys/zfs_rlock.h b/module/zfs/include/sys/zfs_rlock.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_rlock.h rename to module/zfs/include/sys/zfs_rlock.h diff --git a/zfs/lib/libzpool/include/sys/zfs_vfsops.h b/module/zfs/include/sys/zfs_vfsops.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_vfsops.h rename to module/zfs/include/sys/zfs_vfsops.h diff --git a/zfs/lib/libzpool/include/sys/zfs_znode.h b/module/zfs/include/sys/zfs_znode.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zfs_znode.h rename to module/zfs/include/sys/zfs_znode.h diff --git a/zfs/lib/libzpool/include/sys/zil.h b/module/zfs/include/sys/zil.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zil.h rename to module/zfs/include/sys/zil.h diff --git a/zfs/lib/libzpool/include/sys/zil_impl.h b/module/zfs/include/sys/zil_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zil_impl.h rename to module/zfs/include/sys/zil_impl.h diff --git a/zfs/lib/libzpool/include/sys/zio.h b/module/zfs/include/sys/zio.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zio.h rename to module/zfs/include/sys/zio.h diff --git a/zfs/lib/libzpool/include/sys/zio_checksum.h b/module/zfs/include/sys/zio_checksum.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zio_checksum.h rename to module/zfs/include/sys/zio_checksum.h diff --git a/zfs/lib/libzpool/include/sys/zio_compress.h b/module/zfs/include/sys/zio_compress.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zio_compress.h rename to module/zfs/include/sys/zio_compress.h diff --git a/zfs/lib/libzpool/include/sys/zio_impl.h b/module/zfs/include/sys/zio_impl.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zio_impl.h rename to module/zfs/include/sys/zio_impl.h diff --git a/zfs/lib/libzpool/include/sys/zvol.h b/module/zfs/include/sys/zvol.h similarity index 100% rename from zfs/lib/libzpool/include/sys/zvol.h rename to module/zfs/include/sys/zvol.h diff --git a/zfs/lib/libzpool/lzjb.c b/module/zfs/lzjb.c similarity index 100% rename from zfs/lib/libzpool/lzjb.c rename to module/zfs/lzjb.c diff --git a/zfs/lib/libzpool/metaslab.c b/module/zfs/metaslab.c similarity index 100% rename from zfs/lib/libzpool/metaslab.c rename to module/zfs/metaslab.c diff --git a/zfs/lib/libzpool/refcount.c b/module/zfs/refcount.c similarity index 100% rename from zfs/lib/libzpool/refcount.c rename to module/zfs/refcount.c diff --git a/zfs/lib/libzpool/rrwlock.c b/module/zfs/rrwlock.c similarity index 100% rename from zfs/lib/libzpool/rrwlock.c rename to module/zfs/rrwlock.c diff --git a/zfs/lib/libzpool/sha256.c b/module/zfs/sha256.c similarity index 100% rename from zfs/lib/libzpool/sha256.c rename to module/zfs/sha256.c diff --git a/zfs/lib/libzpool/spa.c b/module/zfs/spa.c similarity index 100% rename from zfs/lib/libzpool/spa.c rename to module/zfs/spa.c diff --git a/zfs/lib/libzpool/spa_boot.c b/module/zfs/spa_boot.c similarity index 100% rename from zfs/lib/libzpool/spa_boot.c rename to module/zfs/spa_boot.c diff --git a/zfs/lib/libzpool/spa_config.c b/module/zfs/spa_config.c similarity index 100% rename from zfs/lib/libzpool/spa_config.c rename to module/zfs/spa_config.c diff --git a/zfs/lib/libzpool/spa_errlog.c b/module/zfs/spa_errlog.c similarity index 100% rename from zfs/lib/libzpool/spa_errlog.c rename to module/zfs/spa_errlog.c diff --git a/zfs/lib/libzpool/spa_history.c b/module/zfs/spa_history.c similarity index 100% rename from zfs/lib/libzpool/spa_history.c rename to module/zfs/spa_history.c diff --git a/zfs/lib/libzpool/spa_misc.c b/module/zfs/spa_misc.c similarity index 100% rename from zfs/lib/libzpool/spa_misc.c rename to module/zfs/spa_misc.c diff --git a/zfs/lib/libzpool/space_map.c b/module/zfs/space_map.c similarity index 100% rename from zfs/lib/libzpool/space_map.c rename to module/zfs/space_map.c diff --git a/zfs/lib/libzpool/txg.c b/module/zfs/txg.c similarity index 100% rename from zfs/lib/libzpool/txg.c rename to module/zfs/txg.c diff --git a/zfs/lib/libzpool/uberblock.c b/module/zfs/uberblock.c similarity index 100% rename from zfs/lib/libzpool/uberblock.c rename to module/zfs/uberblock.c diff --git a/zfs/lib/libzpool/unique.c b/module/zfs/unique.c similarity index 100% rename from zfs/lib/libzpool/unique.c rename to module/zfs/unique.c diff --git a/zfs/lib/libzpool/vdev.c b/module/zfs/vdev.c similarity index 100% rename from zfs/lib/libzpool/vdev.c rename to module/zfs/vdev.c diff --git a/zfs/lib/libzpool/vdev_cache.c b/module/zfs/vdev_cache.c similarity index 100% rename from zfs/lib/libzpool/vdev_cache.c rename to module/zfs/vdev_cache.c diff --git a/zfs/lib/libzpool/vdev_file.c b/module/zfs/vdev_file.c similarity index 100% rename from zfs/lib/libzpool/vdev_file.c rename to module/zfs/vdev_file.c diff --git a/zfs/lib/libzpool/vdev_label.c b/module/zfs/vdev_label.c similarity index 100% rename from zfs/lib/libzpool/vdev_label.c rename to module/zfs/vdev_label.c diff --git a/zfs/lib/libzpool/vdev_mirror.c b/module/zfs/vdev_mirror.c similarity index 100% rename from zfs/lib/libzpool/vdev_mirror.c rename to module/zfs/vdev_mirror.c diff --git a/zfs/lib/libzpool/vdev_missing.c b/module/zfs/vdev_missing.c similarity index 100% rename from zfs/lib/libzpool/vdev_missing.c rename to module/zfs/vdev_missing.c diff --git a/zfs/lib/libzpool/vdev_queue.c b/module/zfs/vdev_queue.c similarity index 100% rename from zfs/lib/libzpool/vdev_queue.c rename to module/zfs/vdev_queue.c diff --git a/zfs/lib/libzpool/vdev_raidz.c b/module/zfs/vdev_raidz.c similarity index 100% rename from zfs/lib/libzpool/vdev_raidz.c rename to module/zfs/vdev_raidz.c diff --git a/zfs/lib/libzpool/vdev_root.c b/module/zfs/vdev_root.c similarity index 100% rename from zfs/lib/libzpool/vdev_root.c rename to module/zfs/vdev_root.c diff --git a/zfs/lib/libzpool/zap.c b/module/zfs/zap.c similarity index 100% rename from zfs/lib/libzpool/zap.c rename to module/zfs/zap.c diff --git a/zfs/lib/libzpool/zap_leaf.c b/module/zfs/zap_leaf.c similarity index 100% rename from zfs/lib/libzpool/zap_leaf.c rename to module/zfs/zap_leaf.c diff --git a/zfs/lib/libzpool/zap_micro.c b/module/zfs/zap_micro.c similarity index 100% rename from zfs/lib/libzpool/zap_micro.c rename to module/zfs/zap_micro.c diff --git a/zfs/lib/libzpool/zfs_acl.c b/module/zfs/zfs_acl.c similarity index 100% rename from zfs/lib/libzpool/zfs_acl.c rename to module/zfs/zfs_acl.c diff --git a/zfs/lib/libzpool/zfs_byteswap.c b/module/zfs/zfs_byteswap.c similarity index 100% rename from zfs/lib/libzpool/zfs_byteswap.c rename to module/zfs/zfs_byteswap.c diff --git a/zfs/lib/libzpool/zfs_ctldir.c b/module/zfs/zfs_ctldir.c similarity index 100% rename from zfs/lib/libzpool/zfs_ctldir.c rename to module/zfs/zfs_ctldir.c diff --git a/zfs/lib/libzpool/zfs_dir.c b/module/zfs/zfs_dir.c similarity index 100% rename from zfs/lib/libzpool/zfs_dir.c rename to module/zfs/zfs_dir.c diff --git a/zfs/lib/libzpool/zfs_fm.c b/module/zfs/zfs_fm.c similarity index 100% rename from zfs/lib/libzpool/zfs_fm.c rename to module/zfs/zfs_fm.c diff --git a/zfs/lib/libzpool/zfs_fuid.c b/module/zfs/zfs_fuid.c similarity index 100% rename from zfs/lib/libzpool/zfs_fuid.c rename to module/zfs/zfs_fuid.c diff --git a/zfs/lib/libzpool/zfs_ioctl.c b/module/zfs/zfs_ioctl.c similarity index 100% rename from zfs/lib/libzpool/zfs_ioctl.c rename to module/zfs/zfs_ioctl.c diff --git a/zfs/lib/libzpool/zfs_log.c b/module/zfs/zfs_log.c similarity index 100% rename from zfs/lib/libzpool/zfs_log.c rename to module/zfs/zfs_log.c diff --git a/zfs/lib/libzpool/zfs_replay.c b/module/zfs/zfs_replay.c similarity index 100% rename from zfs/lib/libzpool/zfs_replay.c rename to module/zfs/zfs_replay.c diff --git a/zfs/lib/libzpool/zfs_rlock.c b/module/zfs/zfs_rlock.c similarity index 100% rename from zfs/lib/libzpool/zfs_rlock.c rename to module/zfs/zfs_rlock.c diff --git a/zfs/lib/libzpool/zfs_vfsops.c b/module/zfs/zfs_vfsops.c similarity index 100% rename from zfs/lib/libzpool/zfs_vfsops.c rename to module/zfs/zfs_vfsops.c diff --git a/zfs/lib/libzpool/zfs_vnops.c b/module/zfs/zfs_vnops.c similarity index 100% rename from zfs/lib/libzpool/zfs_vnops.c rename to module/zfs/zfs_vnops.c diff --git a/zfs/lib/libzpool/zfs_znode.c b/module/zfs/zfs_znode.c similarity index 100% rename from zfs/lib/libzpool/zfs_znode.c rename to module/zfs/zfs_znode.c diff --git a/zfs/lib/libzpool/zil.c b/module/zfs/zil.c similarity index 100% rename from zfs/lib/libzpool/zil.c rename to module/zfs/zil.c diff --git a/zfs/lib/libzpool/zio.c b/module/zfs/zio.c similarity index 100% rename from zfs/lib/libzpool/zio.c rename to module/zfs/zio.c diff --git a/zfs/lib/libzpool/zio_checksum.c b/module/zfs/zio_checksum.c similarity index 100% rename from zfs/lib/libzpool/zio_checksum.c rename to module/zfs/zio_checksum.c diff --git a/zfs/lib/libzpool/zio_compress.c b/module/zfs/zio_compress.c similarity index 100% rename from zfs/lib/libzpool/zio_compress.c rename to module/zfs/zio_compress.c diff --git a/zfs/lib/libzpool/zio_inject.c b/module/zfs/zio_inject.c similarity index 100% rename from zfs/lib/libzpool/zio_inject.c rename to module/zfs/zio_inject.c diff --git a/zfs/lib/libzpool/zvol.c b/module/zfs/zvol.c similarity index 100% rename from zfs/lib/libzpool/zvol.c rename to module/zfs/zvol.c diff --git a/scripts/update-zfs.sh b/scripts/update-zfs.sh index 2aa2425c6b..318f45f396 100755 --- a/scripts/update-zfs.sh +++ b/scripts/update-zfs.sh @@ -38,7 +38,7 @@ echo "------------- Fetching OpenSolaris ${RELEASE} archive ----------------" wget ${REMOTE_SRC} -P ${SRC} || die "Error 'wget ${REMOTE_SRC}'" -echo "------------- Unpacking OperSolaris ${RELEASE} archive ---------------" +echo "------------- Unpacking OpenSolaris ${RELEASE} archive ---------------" tar -xjf ${SRC}/on-src.tar.bz2 -C ${SRC} || die "Error 'tar -xjf ${SRC}/on-src.tar.bz2 -C ${SRC}'" @@ -49,35 +49,47 @@ SRC_UTS=${SRC}/usr/src/uts SRC_UCM=${SRC}/usr/src/uts/common SRC_ZLIB=${SRC}/usr/src/uts/common/fs/zfs -DST_LIB=${DST}/zfs/lib -DST_CMD=${DST}/zfs/zcmd +DST_MOD=${DST}/module +DST_LIB=${DST}/lib +DST_CMD=${DST}/cmd rm -Rf ${DST}/zfs echo echo "------------- Updating ZFS from OpenSolaris ${RELEASE} ---------------" -echo "* zfs/lib/libavl" -mkdir -p ${DST_LIB}/libavl/include/sys/ -cp ${SRC_CM}/avl/avl.c ${DST_LIB}/libavl/ -cp ${SRC_UCM}/sys/avl.h ${DST_LIB}/libavl/include/sys/ -cp ${SRC_UCM}/sys/avl_impl.h ${DST_LIB}/libavl/include/sys/ +echo "* module/avl + lib/libavl" +mkdir -p ${DST_MOD}/avl/include/sys/ +cp ${SRC_CM}/avl/avl.c ${DST_MOD}/avl/ +cp ${SRC_UCM}/sys/avl.h ${DST_MOD}/avl/include/sys/ +cp ${SRC_UCM}/sys/avl_impl.h ${DST_MOD}/avl/include/sys/ -echo "* zfs/lib/libnvpair" -mkdir -p ${DST_LIB}/libnvpair/include/sys/ -cp ${SRC_CM}/nvpair/nvpair.c ${DST_LIB}/libnvpair/ -cp ${SRC_LIB}/libnvpair/libnvpair.c ${DST_LIB}/libnvpair/ -cp ${SRC_UCM}/os/nvpair_alloc_system.c ${DST_LIB}/libnvpair/ -cp ${SRC_CM}/nvpair/nvpair_alloc_fixed.c ${DST_LIB}/libnvpair/ -cp ${SRC_LIB}/libnvpair/libnvpair.h ${DST_LIB}/libnvpair/include/ -cp ${SRC_UCM}/sys/nvpair.h ${DST_LIB}/libnvpair/include/sys/ -cp ${SRC_UCM}/sys/nvpair_impl.h ${DST_LIB}/libnvpair/include/sys/ +echo "* module/nvpair + lib/libnvpair" +mkdir -p ${DST_MOD}/nvpair/include/sys/ +cp ${SRC_CM}/nvpair/nvpair.c ${DST_MOD}/nvpair/ +cp ${SRC_LIB}/libnvpair/libnvpair.c ${DST_MOD}/nvpair/ +cp ${SRC_UCM}/os/nvpair_alloc_system.c ${DST_MOD}/nvpair/ +cp ${SRC_CM}/nvpair/nvpair_alloc_fixed.c ${DST_MOD}/nvpair/ +cp ${SRC_LIB}/libnvpair/libnvpair.h ${DST_MOD}/nvpair/include/ +cp ${SRC_UCM}/sys/nvpair.h ${DST_MOD}/nvpair/include/sys/ +cp ${SRC_UCM}/sys/nvpair_impl.h ${DST_MOD}/nvpair/include/sys/ -echo "* zfs/lib/libuutil" -mkdir -p ${DST_LIB}/libuutil/include/ -cp ${SRC_LIB}/libuutil/common/*.c ${DST_LIB}/libuutil/ -cp ${SRC_LIB}/libuutil/common/*.h ${DST_LIB}/libuutil/include/ +echo "* module/zcommon + lib/libzcommon" +mkdir -p ${DST_MOD}/zcommon/include/sys/fs/ +mkdir -p ${DST_MOD}/zcommon/include/sys/fm/fs/ +cp ${SRC_CM}/zfs/*.c ${DST_MOD}/zcommon/ +cp ${SRC_CM}/zfs/*.h ${DST_MOD}/zcommon/include/ +cp ${SRC_UCM}/sys/fs/zfs.h ${DST_MOD}/zcommon/include/sys/fs/ +cp ${SRC_UCM}/sys/fm/fs/zfs.h ${DST_MOD}/zcommon/include/sys/fm/fs/ -echo "* zfs/lib/libspl" +echo "* module/zfs" +mkdir -p ${DST_MOD}/zpool/include/sys/ +cp ${SRC_UTS}/intel/zfs/spa_boot.c ${DST_MOD}/zfs/ +cp ${SRC_ZLIB}/*.c ${DST_MOD}/zfs/ +cp ${SRC_ZLIB}/sys/*.h ${DST_MOD}/zfs/include/sys/ +rm ${DST_MOD}/zfs/vdev_disk.c +rm ${DST_MOD}/zfs/include/sys/vdev_disk.h + +echo "* lib/libspl" mkdir -p ${DST_LIB}/libspl/include/sys/ cp ${SRC_LIB}/libc/port/gen/strlcat.c ${DST_LIB}/libspl/ cp ${SRC_LIB}/libc/port/gen/strlcpy.c ${DST_LIB}/libspl/ @@ -88,56 +100,50 @@ cp ${SRC_UCM}/os/list.c ${DST_LIB}/libspl/ cp ${SRC_UCM}/sys/list.h ${DST_LIB}/libspl/include/sys/ cp ${SRC_UCM}/sys/list_impl.h ${DST_LIB}/libspl/include/sys/ -echo "* zfs/lib/libzcommon" -mkdir -p ${DST_LIB}/libzcommon/include/sys/fs/ -mkdir -p ${DST_LIB}/libzcommon/include/sys/fm/fs/ -cp ${SRC_CM}/zfs/*.c ${DST_LIB}/libzcommon/ -cp ${SRC_CM}/zfs/*.h ${DST_LIB}/libzcommon/include/ -cp ${SRC_UCM}/sys/fs/zfs.h ${DST_LIB}/libzcommon/include/sys/fs/ -cp ${SRC_UCM}/sys/fm/fs/zfs.h ${DST_LIB}/libzcommon/include/sys/fm/fs/ +echo "* lib/libuutil" +mkdir -p ${DST_LIB}/libuutil/include/ +cp ${SRC_LIB}/libuutil/common/*.c ${DST_LIB}/libuutil/ +cp ${SRC_LIB}/libuutil/common/*.h ${DST_LIB}/libuutil/include/ -echo "* zfs/lib/libzpool" +echo "* lib/libzpool" mkdir -p ${DST_LIB}/libzpool/include/sys/ cp ${SRC_LIB}/libzpool/common/kernel.c ${DST_LIB}/libzpool/ cp ${SRC_LIB}/libzpool/common/taskq.c ${DST_LIB}/libzpool/ cp ${SRC_LIB}/libzpool/common/util.c ${DST_LIB}/libzpool/ -#cp ${SRC_LIB}/libzpool/common/sys/zfs_context.h ${DST_LIB}/libzpool/include/sys/ -cp ${SRC_ZLIB}/*.c ${DST_LIB}/libzpool/ -cp ${SRC_UTS}/intel/zfs/spa_boot.c ${DST_LIB}/libzpool/ -cp ${SRC_ZLIB}/sys/*.h ${DST_LIB}/libzpool/include/sys/ -rm ${DST_LIB}/libzpool/vdev_disk.c -rm ${DST_LIB}/libzpool/include/sys/vdev_disk.h +cp ${SRC_LIB}/libzpool/common/sys/zfs_context.h ${DST_LIB}/libzpool/include/sys/ -echo "* zfs/lib/libzfs" +echo "* lib/libzfs" mkdir -p ${DST_LIB}/libzfs/include/ cp ${SRC_LIB}/libzfs/common/*.c ${DST_LIB}/libzfs/ cp ${SRC_LIB}/libzfs/common/*.h ${DST_LIB}/libzfs/include/ -echo "* zfs/zcmd/zpool" +echo "* cmd/zpool" mkdir -p ${DST_CMD}/zpool cp ${SRC_CMD}/zpool/*.c ${DST_CMD}/zpool/ cp ${SRC_CMD}/zpool/*.h ${DST_CMD}/zpool/ -echo "* zfs/zcmd/zfs" +echo "* cmd/zfs" mkdir -p ${DST_CMD}/zfs cp ${SRC_CMD}/zfs/*.c ${DST_CMD}/zfs/ cp ${SRC_CMD}/zfs/*.h ${DST_CMD}/zfs/ -echo "* zfs/zcmd/zdb" +echo "* cmd/zdb" mkdir -p ${DST_CMD}/zdb/ cp ${SRC_CMD}/zdb/*.c ${DST_CMD}/zdb/ -echo "* zfs/zcmd/zdump" +echo "* cmd/zdump" mkdir -p ${DST_CMD}/zdump cp ${SRC_CMD}/zdump/*.c ${DST_CMD}/zdump/ -echo "* zfs/zcmd/zinject" +echo "* cmd/zinject" mkdir -p ${DST_CMD}/zinject cp ${SRC_CMD}/zinject/*.c ${DST_CMD}/zinject/ cp ${SRC_CMD}/zinject/*.h ${DST_CMD}/zinject/ -echo "* zfs/zcmd/ztest" +echo "* cmd/ztest" mkdir -p ${DST_CMD}/ztest cp ${SRC_CMD}/ztest/*.c ${DST_CMD}/ztest/ +echo "${REMOTE_SRC}" >${DST}/ZFS.RELEASE + rm -Rf ${SRC}