diff options
Diffstat (limited to 'include/sys')
104 files changed, 0 insertions, 6275 deletions
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am deleted file mode 100644 index 45b658976..000000000 --- a/include/sys/Makefile.am +++ /dev/null @@ -1,113 +0,0 @@ -SUBDIRS = fm fs - -COMMON_H = - -KERNEL_H = \ - $(top_srcdir)/include/sys/acl.h \ - $(top_srcdir)/include/sys/acl_impl.h \ - $(top_srcdir)/include/sys/atomic.h \ - $(top_srcdir)/include/sys/attr.h \ - $(top_srcdir)/include/sys/bitmap.h \ - $(top_srcdir)/include/sys/bootconf.h \ - $(top_srcdir)/include/sys/bootprops.h \ - $(top_srcdir)/include/sys/buf.h \ - $(top_srcdir)/include/sys/byteorder.h \ - $(top_srcdir)/include/sys/callb.h \ - $(top_srcdir)/include/sys/callo.h \ - $(top_srcdir)/include/sys/cmn_err.h \ - $(top_srcdir)/include/sys/compress.h \ - $(top_srcdir)/include/sys/condvar.h \ - $(top_srcdir)/include/sys/conf.h \ - $(top_srcdir)/include/sys/console.h \ - $(top_srcdir)/include/sys/cpupart.h \ - $(top_srcdir)/include/sys/cpuvar.h \ - $(top_srcdir)/include/sys/crc32.h \ - $(top_srcdir)/include/sys/cred.h \ - $(top_srcdir)/include/sys/ctype.h \ - $(top_srcdir)/include/sys/ddi.h \ - $(top_srcdir)/include/sys/debug.h \ - $(top_srcdir)/include/sys/dirent.h \ - $(top_srcdir)/include/sys/disp.h \ - $(top_srcdir)/include/sys/dkio.h \ - $(top_srcdir)/include/sys/dkioc_free_util.h \ - $(top_srcdir)/include/sys/dklabel.h \ - $(top_srcdir)/include/sys/dnlc.h \ - $(top_srcdir)/include/sys/dumphdr.h \ - $(top_srcdir)/include/sys/efi_partition.h \ - $(top_srcdir)/include/sys/errno.h \ - $(top_srcdir)/include/sys/extdirent.h \ - $(top_srcdir)/include/sys/fcntl.h \ - $(top_srcdir)/include/sys/file.h \ - $(top_srcdir)/include/sys/idmap.h \ - $(top_srcdir)/include/sys/int_limits.h \ - $(top_srcdir)/include/sys/int_types.h \ - $(top_srcdir)/include/sys/inttypes.h \ - $(top_srcdir)/include/sys/isa_defs.h \ - $(top_srcdir)/include/sys/kidmap.h \ - $(top_srcdir)/include/sys/kmem.h \ - $(top_srcdir)/include/sys/kmem_cache.h \ - $(top_srcdir)/include/sys/kobj.h \ - $(top_srcdir)/include/sys/kstat.h \ - $(top_srcdir)/include/sys/list.h \ - $(top_srcdir)/include/sys/mkdev.h \ - $(top_srcdir)/include/sys/mntent.h \ - $(top_srcdir)/include/sys/modctl.h \ - $(top_srcdir)/include/sys/mode.h \ - $(top_srcdir)/include/sys/mount.h \ - $(top_srcdir)/include/sys/mutex.h \ - $(top_srcdir)/include/sys/note.h \ - $(top_srcdir)/include/sys/open.h \ - $(top_srcdir)/include/sys/param.h \ - $(top_srcdir)/include/sys/pathname.h \ - $(top_srcdir)/include/sys/policy.h \ - $(top_srcdir)/include/sys/pool.h \ - $(top_srcdir)/include/sys/priv_impl.h \ - $(top_srcdir)/include/sys/processor.h \ - $(top_srcdir)/include/sys/proc.h \ - $(top_srcdir)/include/sys/pset.h \ - $(top_srcdir)/include/sys/random.h \ - $(top_srcdir)/include/sys/refstr.h \ - $(top_srcdir)/include/sys/resource.h \ - $(top_srcdir)/include/sys/rwlock.h \ - $(top_srcdir)/include/sys/sdt.h \ - $(top_srcdir)/include/sys/sid.h \ - $(top_srcdir)/include/sys/signal.h \ - $(top_srcdir)/include/sys/stat.h \ - $(top_srcdir)/include/sys/stropts.h \ - $(top_srcdir)/include/sys/sunddi.h \ - $(top_srcdir)/include/sys/sunldi.h \ - $(top_srcdir)/include/sys/sysdc.h \ - $(top_srcdir)/include/sys/sysmacros.h \ - $(top_srcdir)/include/sys/systeminfo.h \ - $(top_srcdir)/include/sys/systm.h \ - $(top_srcdir)/include/sys/taskq.h \ - $(top_srcdir)/include/sys/thread.h \ - $(top_srcdir)/include/sys/time.h \ - $(top_srcdir)/include/sys/timer.h \ - $(top_srcdir)/include/sys/t_lock.h \ - $(top_srcdir)/include/sys/tsd.h \ - $(top_srcdir)/include/sys/types32.h \ - $(top_srcdir)/include/sys/types.h \ - $(top_srcdir)/include/sys/u8_textprep.h \ - $(top_srcdir)/include/sys/uio.h \ - $(top_srcdir)/include/sys/unistd.h \ - $(top_srcdir)/include/sys/user.h \ - $(top_srcdir)/include/sys/va_list.h \ - $(top_srcdir)/include/sys/varargs.h \ - $(top_srcdir)/include/sys/vfs.h \ - $(top_srcdir)/include/sys/vfs_opreg.h \ - $(top_srcdir)/include/sys/vmem.h \ - $(top_srcdir)/include/sys/vmsystm.h \ - $(top_srcdir)/include/sys/vnode.h \ - $(top_srcdir)/include/sys/zmod.h \ - $(top_srcdir)/include/sys/zone.h - -USER_H = - -EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H) - -if CONFIG_KERNEL -kerneldir = @prefix@/src/spl-$(VERSION)/include/sys -kernel_HEADERS = $(KERNEL_H) -endif - diff --git a/include/sys/acl.h b/include/sys/acl.h deleted file mode 100644 index 9fc79c025..000000000 --- a/include/sys/acl.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ACL_H -#define _SPL_ACL_H - -#include <sys/types.h> - -typedef struct ace { - uid_t a_who; - uint32_t a_access_mask; - uint16_t a_flags; - uint16_t a_type; -} ace_t; - -typedef struct ace_object { - uid_t a_who; /* uid or gid */ - uint32_t a_access_mask; /* read,write,... */ - uint16_t a_flags; /* see below */ - uint16_t a_type; /* allow or deny */ - uint8_t a_obj_type[16]; /* obj type */ - uint8_t a_inherit_obj_type[16]; /* inherit obj */ -} ace_object_t; - -#define MAX_ACL_ENTRIES 1024 - -#define ACE_READ_DATA 0x00000001 -#define ACE_LIST_DIRECTORY 0x00000001 -#define ACE_WRITE_DATA 0x00000002 -#define ACE_ADD_FILE 0x00000002 -#define ACE_APPEND_DATA 0x00000004 -#define ACE_ADD_SUBDIRECTORY 0x00000004 -#define ACE_READ_NAMED_ATTRS 0x00000008 -#define ACE_WRITE_NAMED_ATTRS 0x00000010 -#define ACE_EXECUTE 0x00000020 -#define ACE_DELETE_CHILD 0x00000040 -#define ACE_READ_ATTRIBUTES 0x00000080 -#define ACE_WRITE_ATTRIBUTES 0x00000100 -#define ACE_DELETE 0x00010000 -#define ACE_READ_ACL 0x00020000 -#define ACE_WRITE_ACL 0x00040000 -#define ACE_WRITE_OWNER 0x00080000 -#define ACE_SYNCHRONIZE 0x00100000 - -#define ACE_FILE_INHERIT_ACE 0x0001 -#define ACE_DIRECTORY_INHERIT_ACE 0x0002 -#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004 -#define ACE_INHERIT_ONLY_ACE 0x0008 -#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010 -#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020 -#define ACE_IDENTIFIER_GROUP 0x0040 -#define ACE_INHERITED_ACE 0x0080 -#define ACE_OWNER 0x1000 -#define ACE_GROUP 0x2000 -#define ACE_EVERYONE 0x4000 - -#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000 -#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001 -#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002 -#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003 - -#define ACL_AUTO_INHERIT 0x0001 -#define ACL_PROTECTED 0x0002 -#define ACL_DEFAULTED 0x0004 -#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED) - -#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04 -#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 -#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09 -#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A -#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B -#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C -#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D -#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E -#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F -#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 - -#define ACE_ALL_TYPES 0x001F - -#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP) - -/* BEGIN CSTYLED */ -#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ - ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \ - ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \ - ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \ - ACE_WRITE_OWNER|ACE_SYNCHRONIZE) -/* END CSTYLED */ - -#define VSA_ACE 0x0010 -#define VSA_ACECNT 0x0020 -#define VSA_ACE_ALLTYPES 0x0040 -#define VSA_ACE_ACLFLAGS 0x0080 - -#endif /* _SPL_ACL_H */ diff --git a/include/sys/acl_impl.h b/include/sys/acl_impl.h deleted file mode 100644 index 9cb21124b..000000000 --- a/include/sys/acl_impl.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ACL_IMPL_H -#define _SPL_ACL_IMPL_H - -#endif /* _SPL_ACL_IMPL_H */ diff --git a/include/sys/atomic.h b/include/sys/atomic.h deleted file mode 100644 index e992fdce3..000000000 --- a/include/sys/atomic.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ATOMIC_H -#define _SPL_ATOMIC_H - -#include <linux/module.h> -#include <linux/spinlock.h> -#include <sys/types.h> - -/* - * Two approaches to atomic operations are implemented each with its - * own benefits are drawbacks imposed by the Solaris API. Neither - * approach handles the issue of word breaking when using a 64-bit - * atomic variable on a 32-bit arch. The Solaris API would need to - * add an atomic read call to correctly support this. - * - * When ATOMIC_SPINLOCK is defined all atomic operations will be - * serialized through global spin locks. This is bad for performance - * but it does allow a simple generic implementation. - * - * When ATOMIC_SPINLOCK is not defined the Linux atomic operations - * are used. This is safe as long as the core Linux implementation - * doesn't change because we are relying on the fact that an atomic - * type is really just a uint32 or uint64. If this changes at some - * point in the future we need to fall-back to the spin approach. - */ -#ifdef ATOMIC_SPINLOCK -extern spinlock_t atomic32_lock; -extern spinlock_t atomic64_lock; - -static __inline__ void -atomic_inc_32(volatile uint32_t *target) -{ - spin_lock(&atomic32_lock); - (*target)++; - spin_unlock(&atomic32_lock); -} - -static __inline__ void -atomic_dec_32(volatile uint32_t *target) -{ - spin_lock(&atomic32_lock); - (*target)--; - spin_unlock(&atomic32_lock); -} - -static __inline__ void -atomic_add_32(volatile uint32_t *target, int32_t delta) -{ - spin_lock(&atomic32_lock); - *target += delta; - spin_unlock(&atomic32_lock); -} - -static __inline__ void -atomic_sub_32(volatile uint32_t *target, int32_t delta) -{ - spin_lock(&atomic32_lock); - *target -= delta; - spin_unlock(&atomic32_lock); -} - -static __inline__ uint32_t -atomic_inc_32_nv(volatile uint32_t *target) -{ - uint32_t nv; - - spin_lock(&atomic32_lock); - nv = ++(*target); - spin_unlock(&atomic32_lock); - - return (nv); -} - -static __inline__ uint32_t -atomic_dec_32_nv(volatile uint32_t *target) -{ - uint32_t nv; - - spin_lock(&atomic32_lock); - nv = --(*target); - spin_unlock(&atomic32_lock); - - return (nv); -} - -static __inline__ uint32_t -atomic_add_32_nv(volatile uint32_t *target, uint32_t delta) -{ - uint32_t nv; - - spin_lock(&atomic32_lock); - *target += delta; - nv = *target; - spin_unlock(&atomic32_lock); - - return (nv); -} - -static __inline__ uint32_t -atomic_sub_32_nv(volatile uint32_t *target, uint32_t delta) -{ - uint32_t nv; - - spin_lock(&atomic32_lock); - *target -= delta; - nv = *target; - spin_unlock(&atomic32_lock); - - return (nv); -} - -static __inline__ uint32_t -atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) -{ - uint32_t rc; - - spin_lock(&atomic32_lock); - rc = *target; - if (*target == cmp) - *target = newval; - - spin_unlock(&atomic32_lock); - - return (rc); -} - -static __inline__ uint32_t -atomic_swap_32(volatile uint32_t *target, uint32_t newval) -{ - uint32_t rc; - - spin_lock(&atomic32_lock); - rc = *target; - *target = newval; - spin_unlock(&atomic32_lock); - - return (rc); -} - -static __inline__ void -atomic_inc_64(volatile uint64_t *target) -{ - spin_lock(&atomic64_lock); - (*target)++; - spin_unlock(&atomic64_lock); -} - -static __inline__ void -atomic_dec_64(volatile uint64_t *target) -{ - spin_lock(&atomic64_lock); - (*target)--; - spin_unlock(&atomic64_lock); -} - -static __inline__ void -atomic_add_64(volatile uint64_t *target, uint64_t delta) -{ - spin_lock(&atomic64_lock); - *target += delta; - spin_unlock(&atomic64_lock); -} - -static __inline__ void -atomic_sub_64(volatile uint64_t *target, uint64_t delta) -{ - spin_lock(&atomic64_lock); - *target -= delta; - spin_unlock(&atomic64_lock); -} - -static __inline__ uint64_t -atomic_inc_64_nv(volatile uint64_t *target) -{ - uint64_t nv; - - spin_lock(&atomic64_lock); - nv = ++(*target); - spin_unlock(&atomic64_lock); - - return (nv); -} - -static __inline__ uint64_t -atomic_dec_64_nv(volatile uint64_t *target) -{ - uint64_t nv; - - spin_lock(&atomic64_lock); - nv = --(*target); - spin_unlock(&atomic64_lock); - - return (nv); -} - -static __inline__ uint64_t -atomic_add_64_nv(volatile uint64_t *target, uint64_t delta) -{ - uint64_t nv; - - spin_lock(&atomic64_lock); - *target += delta; - nv = *target; - spin_unlock(&atomic64_lock); - - return (nv); -} - -static __inline__ uint64_t -atomic_sub_64_nv(volatile uint64_t *target, uint64_t delta) -{ - uint64_t nv; - - spin_lock(&atomic64_lock); - *target -= delta; - nv = *target; - spin_unlock(&atomic64_lock); - - return (nv); -} - -static __inline__ uint64_t -atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) -{ - uint64_t rc; - - spin_lock(&atomic64_lock); - rc = *target; - if (*target == cmp) - *target = newval; - spin_unlock(&atomic64_lock); - - return (rc); -} - -static __inline__ uint64_t -atomic_swap_64(volatile uint64_t *target, uint64_t newval) -{ - uint64_t rc; - - spin_lock(&atomic64_lock); - rc = *target; - *target = newval; - spin_unlock(&atomic64_lock); - - return (rc); -} - -#else /* ATOMIC_SPINLOCK */ - -#define atomic_inc_32(v) atomic_inc((atomic_t *)(v)) -#define atomic_dec_32(v) atomic_dec((atomic_t *)(v)) -#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v)) -#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v)) -#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v)) -#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v)) -#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v)) -#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v)) -#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y) -#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x) -#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v)) -#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v)) -#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v)) -#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v)) -#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v)) -#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v)) -#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v)) -#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v)) -#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y) -#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x) - -#endif /* ATOMIC_SPINLOCK */ - -#ifdef _LP64 -static __inline__ void * -atomic_cas_ptr(volatile void *target, void *cmp, void *newval) -{ - return ((void *)atomic_cas_64((volatile uint64_t *)target, - (uint64_t)cmp, (uint64_t)newval)); -} -#else /* _LP64 */ -static __inline__ void * -atomic_cas_ptr(volatile void *target, void *cmp, void *newval) -{ - return ((void *)atomic_cas_32((volatile uint32_t *)target, - (uint32_t)cmp, (uint32_t)newval)); -} -#endif /* _LP64 */ - -#endif /* _SPL_ATOMIC_H */ diff --git a/include/sys/attr.h b/include/sys/attr.h deleted file mode 100644 index 7941acbec..000000000 --- a/include/sys/attr.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ATTR_H -#define _SPL_ATTR_H - -#endif /* SPL_ATTR_H */ diff --git a/include/sys/bitmap.h b/include/sys/bitmap.h deleted file mode 100644 index 3e7d910c0..000000000 --- a/include/sys/bitmap.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_BITMAP_H -#define _SPL_BITMAP_H - -#endif /* SPL_BITMAP_H */ diff --git a/include/sys/bootconf.h b/include/sys/bootconf.h deleted file mode 100644 index 62730ba5d..000000000 --- a/include/sys/bootconf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_BOOTCONF_H -#define _SPL_BOOTCONF_H - -#endif /* SPL_BOOTCONF_H */ diff --git a/include/sys/bootprops.h b/include/sys/bootprops.h deleted file mode 100644 index 50150eda9..000000000 --- a/include/sys/bootprops.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_BOOTPROPS_H -#define _SPL_BOOTPROPS_H - -#endif /* SPL_BOOTPROPS_H */ diff --git a/include/sys/buf.h b/include/sys/buf.h deleted file mode 100644 index fa453e478..000000000 --- a/include/sys/buf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_BUF_H -#define _SPL_BUF_H - -#endif /* SPL_BUF_H */ diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h deleted file mode 100644 index a0ff424f8..000000000 --- a/include/sys/byteorder.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_BYTEORDER_H -#define _SPL_BYTEORDER_H - -#include <asm/byteorder.h> -#include <sys/isa_defs.h> - -#define LE_16(x) cpu_to_le16(x) -#define LE_32(x) cpu_to_le32(x) -#define LE_64(x) cpu_to_le64(x) -#define BE_16(x) cpu_to_be16(x) -#define BE_32(x) cpu_to_be32(x) -#define BE_64(x) cpu_to_be64(x) - -#define BE_IN8(xa) \ - *((uint8_t *)(xa)) - -#define BE_IN16(xa) \ - (((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1)) - -#define BE_IN32(xa) \ - (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2)) - -#ifdef _BIG_ENDIAN -static __inline__ uint64_t -htonll(uint64_t n) -{ - return (n); -} - -static __inline__ uint64_t -ntohll(uint64_t n) -{ - return (n); -} -#else -static __inline__ uint64_t -htonll(uint64_t n) -{ - return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32)); -} - -static __inline__ uint64_t -ntohll(uint64_t n) -{ - return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32)); -} -#endif - -#endif /* SPL_BYTEORDER_H */ diff --git a/include/sys/callb.h b/include/sys/callb.h deleted file mode 100644 index f1826bfd3..000000000 --- a/include/sys/callb.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CALLB_H -#define _SPL_CALLB_H - -#include <linux/module.h> -#include <sys/mutex.h> - -#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); - -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) { \ - CALLB_CPR_ASSERT(cp); \ -} - -#define CALLB_CPR_SAFE_END(cp, lockp) { \ - CALLB_CPR_ASSERT(cp); \ -} - -#define CALLB_CPR_EXIT(cp) { \ - ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ - mutex_exit((cp)->cc_lockp); \ -} - -#endif /* _SPL_CALLB_H */ diff --git a/include/sys/callo.h b/include/sys/callo.h deleted file mode 100644 index c43ac92e7..000000000 --- a/include/sys/callo.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007-2013 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CALLO_H -#define _SPL_CALLO_H - -/* - * Callout flags: - * - * CALLOUT_FLAG_ROUNDUP - * Roundup the expiration time to the next resolution boundary. - * If this flag is not specified, the expiration time is rounded down. - * CALLOUT_FLAG_ABSOLUTE - * Normally, the expiration passed to the timeout API functions is an - * expiration interval. If this flag is specified, then it is - * interpreted as the expiration time itself. - * CALLOUT_FLAG_HRESTIME - * Normally, callouts are not affected by changes to system time - * (hrestime). This flag is used to create a callout that is affected - * by system time. If system time changes, these timers must be - * handled in a special way (see callout.c). These are used by condition - * variables and LWP timers that need this behavior. - * CALLOUT_FLAG_32BIT - * Legacy interfaces timeout() and realtime_timeout() pass this flag - * to timeout_generic() to indicate that a 32-bit ID should be allocated. - */ -#define CALLOUT_FLAG_ROUNDUP 0x1 -#define CALLOUT_FLAG_ABSOLUTE 0x2 -#define CALLOUT_FLAG_HRESTIME 0x4 -#define CALLOUT_FLAG_32BIT 0x8 - -#endif /* _SPL_CALLB_H */ diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h deleted file mode 100644 index 594a76333..000000000 --- a/include/sys/cmn_err.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CMN_ERR_H -#define _SPL_CMN_ERR_H - -#include <sys/varargs.h> - -#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 */ - -extern void cmn_err(int, const char *, ...); -extern void vcmn_err(int, const char *, __va_list); -extern void vpanic(const char *, __va_list); - -#define fm_panic panic - -#endif /* SPL_CMN_ERR_H */ diff --git a/include/sys/compress.h b/include/sys/compress.h deleted file mode 100644 index e46ab0df2..000000000 --- a/include/sys/compress.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_COMPRESS_H -#define _SPL_COMPRESS_H - -#endif /* SPL_COMPRESS_H */ diff --git a/include/sys/condvar.h b/include/sys/condvar.h deleted file mode 100644 index 5fcc9068a..000000000 --- a/include/sys/condvar.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CONDVAR_H -#define _SPL_CONDVAR_H - -#include <linux/module.h> -#include <linux/wait_compat.h> -#include <linux/delay_compat.h> -#include <sys/kmem.h> -#include <sys/mutex.h> -#include <sys/callo.h> - -/* - * The kcondvar_t struct is protected by mutex taken externally before - * calling any of the wait/signal funs, and passed into the wait funs. - */ -#define CV_MAGIC 0x346545f4 -#define CV_DESTROY 0x346545f5 - -typedef struct { - int cv_magic; - spl_wait_queue_head_t cv_event; - spl_wait_queue_head_t cv_destroy; - atomic_t cv_refs; - atomic_t cv_waiters; - kmutex_t *cv_mutex; -} kcondvar_t; - -typedef enum { CV_DEFAULT = 0, CV_DRIVER } kcv_type_t; - -extern void __cv_init(kcondvar_t *, char *, kcv_type_t, void *); -extern void __cv_destroy(kcondvar_t *); -extern void __cv_wait(kcondvar_t *, kmutex_t *); -extern void __cv_wait_io(kcondvar_t *, kmutex_t *); -extern void __cv_wait_sig(kcondvar_t *, kmutex_t *); -extern clock_t __cv_timedwait(kcondvar_t *, kmutex_t *, clock_t); -extern clock_t __cv_timedwait_io(kcondvar_t *, kmutex_t *, clock_t); -extern clock_t __cv_timedwait_sig(kcondvar_t *, kmutex_t *, clock_t); -extern clock_t cv_timedwait_hires(kcondvar_t *, kmutex_t *, hrtime_t, - hrtime_t res, int flag); -extern clock_t cv_timedwait_sig_hires(kcondvar_t *, kmutex_t *, hrtime_t, - hrtime_t res, int flag); -extern void __cv_signal(kcondvar_t *); -extern void __cv_broadcast(kcondvar_t *c); - -#define cv_init(cvp, name, type, arg) __cv_init(cvp, name, type, arg) -#define cv_destroy(cvp) __cv_destroy(cvp) -#define cv_wait(cvp, mp) __cv_wait(cvp, mp) -#define cv_wait_io(cvp, mp) __cv_wait_io(cvp, mp) -#define cv_wait_sig(cvp, mp) __cv_wait_sig(cvp, mp) -#define cv_wait_interruptible(cvp, mp) cv_wait_sig(cvp, mp) -#define cv_timedwait(cvp, mp, t) __cv_timedwait(cvp, mp, t) -#define cv_timedwait_io(cvp, mp, t) __cv_timedwait_io(cvp, mp, t) -#define cv_timedwait_sig(cvp, mp, t) __cv_timedwait_sig(cvp, mp, t) -#define cv_timedwait_interruptible(cvp, mp, t) cv_timedwait_sig(cvp, mp, t) -#define cv_signal(cvp) __cv_signal(cvp) -#define cv_broadcast(cvp) __cv_broadcast(cvp) - -#endif /* _SPL_CONDVAR_H */ diff --git a/include/sys/conf.h b/include/sys/conf.h deleted file mode 100644 index 68f4095dd..000000000 --- a/include/sys/conf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CONF_H -#define _SPL_CONF_H - -#endif /* SPL_CONF_H */ diff --git a/include/sys/console.h b/include/sys/console.h deleted file mode 100644 index 3469cb762..000000000 --- a/include/sys/console.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CONSOLE_H -#define _SPL_CONSOLE_H - -void -console_vprintf(const char *fmt, va_list args) -{ - vprintk(fmt, args); -} - -void -console_printf(const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - console_vprintf(fmt, args); - va_end(args); -} - -#endif /* _SPL_CONSOLE_H */ diff --git a/include/sys/cpupart.h b/include/sys/cpupart.h deleted file mode 100644 index ba57c19e8..000000000 --- a/include/sys/cpupart.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CPUPART_H -#define _SPL_CPUPART_H - -#endif /* SPL_CPUPART_H */ diff --git a/include/sys/cpuvar.h b/include/sys/cpuvar.h deleted file mode 100644 index 075c06047..000000000 --- a/include/sys/cpuvar.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CPUVAR_H -#define _SPL_CPUVAR_H - -#endif /* SPL_CPUVAR_H */ diff --git a/include/sys/crc32.h b/include/sys/crc32.h deleted file mode 100644 index eb021b1ff..000000000 --- a/include/sys/crc32.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CRC32_H -#define _SPL_CRC32_H - -#endif /* SPL_CRC32_H */ diff --git a/include/sys/cred.h b/include/sys/cred.h deleted file mode 100644 index e4b18b665..000000000 --- a/include/sys/cred.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CRED_H -#define _SPL_CRED_H - -#include <linux/module.h> -#include <sys/types.h> -#include <sys/vfs.h> - -typedef struct cred cred_t; - -#define kcred ((cred_t *)(init_task.cred)) -#define CRED() ((cred_t *)current_cred()) - -/* Linux 4.9 API change, GROUP_AT was removed */ -#ifndef GROUP_AT -#define GROUP_AT(gi, i) ((gi)->gid[i]) -#endif - -#ifdef HAVE_KUIDGID_T - -#define KUID_TO_SUID(x) (__kuid_val(x)) -#define KGID_TO_SGID(x) (__kgid_val(x)) -#define SUID_TO_KUID(x) (KUIDT_INIT(x)) -#define SGID_TO_KGID(x) (KGIDT_INIT(x)) -#define KGIDP_TO_SGIDP(x) (&(x)->val) - -#else /* HAVE_KUIDGID_T */ - -#define KUID_TO_SUID(x) (x) -#define KGID_TO_SGID(x) (x) -#define SUID_TO_KUID(x) (x) -#define SGID_TO_KGID(x) (x) -#define KGIDP_TO_SGIDP(x) (x) - -#endif /* HAVE_KUIDGID_T */ - -extern void crhold(cred_t *cr); -extern void crfree(cred_t *cr); -extern uid_t crgetuid(const cred_t *cr); -extern uid_t crgetruid(const cred_t *cr); -extern uid_t crgetsuid(const cred_t *cr); -extern uid_t crgetfsuid(const cred_t *cr); -extern gid_t crgetgid(const cred_t *cr); -extern gid_t crgetrgid(const cred_t *cr); -extern gid_t crgetsgid(const cred_t *cr); -extern gid_t crgetfsgid(const cred_t *cr); -extern int crgetngroups(const cred_t *cr); -extern gid_t *crgetgroups(const cred_t *cr); -extern int groupmember(gid_t gid, const cred_t *cr); - -#endif /* _SPL_CRED_H */ diff --git a/include/sys/ctype.h b/include/sys/ctype.h deleted file mode 100644 index 18beb1daa..000000000 --- a/include/sys/ctype.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_CTYPE_H -#define _SPL_CTYPE_H - -#include <linux/ctype.h> - -#endif /* SPL_CTYPE_H */ diff --git a/include/sys/ddi.h b/include/sys/ddi.h deleted file mode 100644 index af2806ee7..000000000 --- a/include/sys/ddi.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DDI_H -#define _SPL_DDI_H - -#endif /* SPL_DDI_H */ diff --git a/include/sys/debug.h b/include/sys/debug.h deleted file mode 100644 index a4a458066..000000000 --- a/include/sys/debug.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -/* - * Available Solaris debug functions. All of the ASSERT() macros will be - * compiled out when NDEBUG is defined, this is the default behavior for - * the SPL. To enable assertions use the --enable-debug with configure. - * The VERIFY() functions are never compiled out and cannot be disabled. - * - * PANIC() - Panic the node and print message. - * ASSERT() - Assert X is true, if not panic. - * ASSERTV() - Wraps a variable declaration which is only used by ASSERT(). - * ASSERT3B() - Assert boolean X OP Y is true, if not panic. - * ASSERT3S() - Assert signed X OP Y is true, if not panic. - * ASSERT3U() - Assert unsigned X OP Y is true, if not panic. - * ASSERT3P() - Assert pointer X OP Y is true, if not panic. - * ASSERT0() - Assert value is zero, if not panic. - * VERIFY() - Verify X is true, if not panic. - * VERIFY3B() - Verify boolean X OP Y is true, if not panic. - * VERIFY3S() - Verify signed X OP Y is true, if not panic. - * VERIFY3U() - Verify unsigned X OP Y is true, if not panic. - * VERIFY3P() - Verify pointer X OP Y is true, if not panic. - * VERIFY0() - Verify value is zero, if not panic. - */ - -#ifndef _SPL_DEBUG_H -#define _SPL_DEBUG_H - -/* - * Common DEBUG functionality. - */ -int spl_panic(const char *file, const char *func, int line, - const char *fmt, ...); -void spl_dumpstack(void); - -/* BEGIN CSTYLED */ -#define PANIC(fmt, a...) \ - spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) - -#define VERIFY(cond) \ - (void) (unlikely(!(cond)) && \ - spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "%s", "VERIFY(" #cond ") failed\n")) - -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) do { \ - TYPE _verify3_left = (TYPE)(LEFT); \ - TYPE _verify3_right = (TYPE)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ - spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (_verify3_left), CAST (_verify3_right)); \ - } while (0) - -#define VERIFY3B(x,y,z) VERIFY3_IMPL(x, y, z, boolean_t, "%d", (boolean_t)) -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ - (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) - -#define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) -#define CTASSERT(x) { _CTASSERT(x, __LINE__); } -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) \ - typedef char __attribute__ ((unused)) \ - __compile_time_assertion__ ## y[(x) ? 1 : -1] - -/* - * Debugging disabled (--disable-debug) - */ -#ifdef NDEBUG - -#define SPL_DEBUG_STR "" -#define ASSERT(x) ((void)0) -#define ASSERTV(x) -#define ASSERT3B(x,y,z) ((void)0) -#define ASSERT3S(x,y,z) ((void)0) -#define ASSERT3U(x,y,z) ((void)0) -#define ASSERT3P(x,y,z) ((void)0) -#define ASSERT0(x) ((void)0) -#define IMPLY(A, B) ((void)0) -#define EQUIV(A, B) ((void)0) - -/* - * Debugging enabled (--enable-debug) - */ -#else - -#define SPL_DEBUG_STR " (DEBUG mode)" -#define ASSERT(cond) VERIFY(cond) -#define ASSERTV(x) x -#define ASSERT3B(x,y,z) VERIFY3B(x, y, z) -#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) -#define ASSERT0(x) VERIFY0(x) -#define IMPLY(A, B) \ - ((void)(((!(A)) || (B)) || \ - spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "(" #A ") implies (" #B ")"))) -#define EQUIV(A, B) \ - ((void)((!!(A) == !!(B)) || \ - spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "(" #A ") is equivalent to (" #B ")"))) -/* END CSTYLED */ - -#endif /* NDEBUG */ - -#endif /* SPL_DEBUG_H */ diff --git a/include/sys/dirent.h b/include/sys/dirent.h deleted file mode 100644 index 8237d0dd9..000000000 --- a/include/sys/dirent.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DIRENT_H -#define _SPL_DIRENT_H - -#endif /* SPL_DIRENT_H */ diff --git a/include/sys/disp.h b/include/sys/disp.h deleted file mode 100644 index 413b623c8..000000000 --- a/include/sys/disp.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DISP_H -#define _SPL_DISP_H - -#include <linux/preempt.h> - -#define kpreempt(unused) schedule() -#define kpreempt_disable() preempt_disable() -#define kpreempt_enable() preempt_enable() - -#endif /* SPL_DISP_H */ diff --git a/include/sys/dkio.h b/include/sys/dkio.h deleted file mode 100644 index 49f166a9c..000000000 --- a/include/sys/dkio.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DKIO_H -#define _SPL_DKIO_H - -#define DFL_SZ(num_exts) \ - (sizeof (dkioc_free_list_t) + (num_exts - 1) * 16) - -#define DKIOC (0x04 << 8) -#define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ - -/* - * ioctl to free space (e.g. SCSI UNMAP) off a disk. - * Pass a dkioc_free_list_t containing a list of extents to be freed. - */ -#define DKIOCFREE (DKIOC|50) - -#endif /* _SPL_DKIO_H */ diff --git a/include/sys/dkioc_free_util.h b/include/sys/dkioc_free_util.h deleted file mode 100644 index d519b2f8e..000000000 --- a/include/sys/dkioc_free_util.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DKIOC_UTIL_H -#define _SPL_DKIOC_UTIL_H - -#include <sys/dkio.h> - -typedef struct dkioc_free_list_ext_s { - uint64_t dfle_start; - uint64_t dfle_length; -} dkioc_free_list_ext_t; - -typedef struct dkioc_free_list_s { - uint64_t dfl_flags; - uint64_t dfl_num_exts; - int64_t dfl_offset; - - /* - * N.B. this is only an internal debugging API! This is only called - * from debug builds of sd for pre-release checking. Remove before GA! - */ - void (*dfl_ck_func)(uint64_t, uint64_t, void *); - void *dfl_ck_arg; - - dkioc_free_list_ext_t dfl_exts[1]; -} dkioc_free_list_t; - -static inline void dfl_free(dkioc_free_list_t *dfl) { - vmem_free(dfl, DFL_SZ(dfl->dfl_num_exts)); -} - -static inline dkioc_free_list_t *dfl_alloc(uint64_t dfl_num_exts, int flags) { - return (vmem_zalloc(DFL_SZ(dfl_num_exts), flags)); -} - -#endif /* _SPL_DKIOC_UTIL_H */ diff --git a/include/sys/dklabel.h b/include/sys/dklabel.h deleted file mode 100644 index ff58059c6..000000000 --- a/include/sys/dklabel.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DKLABEL_H -#define _SPL_DKLABEL_H - -#endif /* _SPL_DKLABEL_H */ diff --git a/include/sys/dnlc.h b/include/sys/dnlc.h deleted file mode 100644 index cda112c18..000000000 --- a/include/sys/dnlc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DNLC_H -#define _SPL_DNLC_H - -#endif /* SPL_DNLC_H */ diff --git a/include/sys/dumphdr.h b/include/sys/dumphdr.h deleted file mode 100644 index a452fe35d..000000000 --- a/include/sys/dumphdr.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_DUMPHDR_H -#define _SPL_DUMPHDR_H - -#endif /* SPL_DUMPHDR_H */ diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h deleted file mode 100644 index d0c9c2005..000000000 --- a/include/sys/efi_partition.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_EFI_PARTITION_H -#define _SPL_EFI_PARTITION_H - -#endif /* SPL_EFI_PARTITION_H */ diff --git a/include/sys/errno.h b/include/sys/errno.h deleted file mode 100644 index 2dd378bc8..000000000 --- a/include/sys/errno.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ERRNO_H -#define _SPL_ERRNO_H - -#endif /* SPL_ERRNO_H */ diff --git a/include/sys/extdirent.h b/include/sys/extdirent.h deleted file mode 100644 index e0567fa6e..000000000 --- a/include/sys/extdirent.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_EXTDIRENT_H -#define _SPL_EXTDIRENT_H - -#define ED_CASE_CONFLICT 0x10 - -#endif /* _SPL_EXTDIRENT_H */ diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h deleted file mode 100644 index 3faa5dad7..000000000 --- a/include/sys/fcntl.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_FCNTL_H -#define _SPL_FCNTL_H - -#include <asm/fcntl.h> - -#define F_FREESP 11 - -#ifdef CONFIG_64BIT -typedef struct flock flock64_t; -#else -typedef struct flock64 flock64_t; -#endif /* CONFIG_64BIT */ - -#endif /* _SPL_FCNTL_H */ diff --git a/include/sys/file.h b/include/sys/file.h deleted file mode 100644 index b6c40aff2..000000000 --- a/include/sys/file.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_FILE_H -#define _SPL_FILE_H - -#define FIGNORECASE 0x00080000 -#define FKIOCTL 0x80000000 - -#endif /* SPL_FILE_H */ diff --git a/include/sys/fm/Makefile.am b/include/sys/fm/Makefile.am deleted file mode 100644 index 2821cbe33..000000000 --- a/include/sys/fm/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -COMMON_H = - -KERNEL_H = \ - $(top_srcdir)/include/sys/fm/protocol.h \ - $(top_srcdir)/include/sys/fm/util.h - -USER_H = - -EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H) - -if CONFIG_KERNEL -kerneldir = @prefix@/src/spl-$(VERSION)/include/sys/fm -kernel_HEADERS = $(KERNEL_H) -endif diff --git a/include/sys/fm/protocol.h b/include/sys/fm/protocol.h deleted file mode 100644 index 39f6cb1e5..000000000 --- a/include/sys/fm/protocol.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_FM_PROTOCOL_H -#define _SPL_FM_PROTOCOL_H - -#endif /* _SPL_FM_PROTOCOL_H */ diff --git a/include/sys/fm/util.h b/include/sys/fm/util.h deleted file mode 100644 index d8f68433d..000000000 --- a/include/sys/fm/util.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_FM_UTIL_H -#define _SPL_FM_UTIL_H - -#endif /* _SPL_FM_UTIL_H */ diff --git a/include/sys/fs/Makefile.am b/include/sys/fs/Makefile.am deleted file mode 100644 index 581083e9c..000000000 --- a/include/sys/fs/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -COMMON_H = - -KERNEL_H = \ - $(top_srcdir)/include/sys/fs/swapnode.h - -USER_H = - -EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H) - -if CONFIG_KERNEL -kerneldir = @prefix@/src/spl-$(VERSION)/include/sys/fs -kernel_HEADERS = $(KERNEL_H) -endif diff --git a/include/sys/fs/swapnode.h b/include/sys/fs/swapnode.h deleted file mode 100644 index 1fa5fdc83..000000000 --- a/include/sys/fs/swapnode.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SWAPNODE_H -#define _SPL_SWAPNODE_H - -#endif /* SPL_SWAPNODE_H */ diff --git a/include/sys/idmap.h b/include/sys/idmap.h deleted file mode 100644 index abbfcbed1..000000000 --- a/include/sys/idmap.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_IDMAP_H -#define _SPL_IDMAP_H - -#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U - -#endif /* SPL_IDMAP_H */ diff --git a/include/sys/int_limits.h b/include/sys/int_limits.h deleted file mode 100644 index 5d7e9be89..000000000 --- a/include/sys/int_limits.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_INT_LIMITS_H -#define _SPL_INT_LIMITS_H - -#endif /* SPL_INT_LIMITS_H */ diff --git a/include/sys/int_types.h b/include/sys/int_types.h deleted file mode 100644 index 7e3b7329f..000000000 --- a/include/sys/int_types.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_INT_TYPES_H -#define _SPL_INT_TYPES_H - -#include <sys/inttypes.h> - -#endif /* SPL_INT_TYPES_H */ diff --git a/include/sys/inttypes.h b/include/sys/inttypes.h deleted file mode 100644 index 92e76206b..000000000 --- a/include/sys/inttypes.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_INTTYPES_H -#define _SPL_INTTYPES_H - -#endif /* SPL_INTTYPES_H */ diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h deleted file mode 100644 index 089ae0f85..000000000 --- a/include/sys/isa_defs.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ISA_DEFS_H -#define _SPL_ISA_DEFS_H - -/* x86_64 arch specific defines */ -#if defined(__x86_64) || defined(__x86_64__) - -#if !defined(__x86_64) -#define __x86_64 -#endif - -#if !defined(__amd64) -#define __amd64 -#endif - -#if !defined(__x86) -#define __x86 -#endif - -#if !defined(_LP64) -#define _LP64 -#endif - -#define _ALIGNMENT_REQUIRED 1 - - -/* i386 arch specific defines */ -#elif defined(__i386) || defined(__i386__) - -#if !defined(__i386) -#define __i386 -#endif - -#if !defined(__x86) -#define __x86 -#endif - -#if !defined(_ILP32) -#define _ILP32 -#endif - -#define _ALIGNMENT_REQUIRED 0 - -/* powerpc (ppc64) arch specific defines */ -#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) - -#if !defined(__powerpc) -#define __powerpc -#endif - -#if !defined(__powerpc__) -#define __powerpc__ -#endif - -#if defined(__powerpc64__) -#if !defined(_LP64) -#define _LP64 -#endif -#else -#if !defined(_ILP32) -#define _ILP32 -#endif -#endif - -/* - * Illumos doesn't define _ALIGNMENT_REQUIRED for PPC, so default to 1 - * out of paranoia. - */ -#define _ALIGNMENT_REQUIRED 1 - -/* arm arch specific defines */ -#elif defined(__arm) || defined(__arm__) || defined(__aarch64__) - -#if !defined(__arm) -#define __arm -#endif - -#if !defined(__arm__) -#define __arm__ -#endif - -#if defined(__aarch64__) -#if !defined(_LP64) -#define _LP64 -#endif -#else -#if !defined(_ILP32) -#define _ILP32 -#endif -#endif - -#if defined(__ARMEL__) || defined(__AARCH64EL__) -#define _LITTLE_ENDIAN -#else -#define _BIG_ENDIAN -#endif - -/* - * Illumos doesn't define _ALIGNMENT_REQUIRED for ARM, so default to 1 - * out of paranoia. - */ -#define _ALIGNMENT_REQUIRED 1 - -/* sparc arch specific defines */ -#elif defined(__sparc) || defined(__sparc__) - -#if !defined(__sparc) -#define __sparc -#endif - -#if !defined(__sparc__) -#define __sparc__ -#endif - -#if defined(__arch64__) -#if !defined(_LP64) -#define _LP64 -#endif -#else -#if !defined(_ILP32) -#define _ILP32 -#endif -#endif - -#define _BIG_ENDIAN -#define _SUNOS_VTOC_16 -#define _ALIGNMENT_REQUIRED 1 - -/* s390 arch specific defines */ -#elif defined(__s390__) -#if defined(__s390x__) -#if !defined(_LP64) -#define _LP64 -#endif -#else -#if !defined(_ILP32) -#define _ILP32 -#endif -#endif - -#define _BIG_ENDIAN - -/* - * Illumos doesn't define _ALIGNMENT_REQUIRED for s390, so default to 1 - * out of paranoia. - */ -#define _ALIGNMENT_REQUIRED 1 - -/* MIPS arch specific defines */ -#elif defined(__mips__) - -#if defined(__MIPSEB__) -#define _BIG_ENDIAN -#elif defined(__MIPSEL__) -#define _LITTLE_ENDIAN -#else -#error MIPS no endian specified -#endif - -#ifndef _LP64 -#define _ILP32 -#endif - -#define _SUNOS_VTOC_16 - -/* - * Illumos doesn't define _ALIGNMENT_REQUIRED for MIPS, so default to 1 - * out of paranoia. - */ -#define _ALIGNMENT_REQUIRED 1 - -#else -/* - * Currently supported: - * x86_64, i386, arm, powerpc, s390, sparc, and mips - */ -#error "Unsupported ISA type" -#endif - -#if defined(_ILP32) && defined(_LP64) -#error "Both _ILP32 and _LP64 are defined" -#endif - -#if !defined(_ILP32) && !defined(_LP64) -#error "Neither _ILP32 or _LP64 are defined" -#endif - -#include <sys/byteorder.h> - -#if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN) -#define _LITTLE_ENDIAN __LITTLE_ENDIAN -#endif - -#if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN) -#define _BIG_ENDIAN __BIG_ENDIAN -#endif - -#if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) -#error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined" -#endif - -#if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -#error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined" -#endif - -#endif /* _SPL_ISA_DEFS_H */ diff --git a/include/sys/kidmap.h b/include/sys/kidmap.h deleted file mode 100644 index a5e6375c3..000000000 --- a/include/sys/kidmap.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_KIDMAP_H -#define _SPL_KIDMAP_H - -#include <sys/idmap.h> - -#endif /* SPL_KIDMAP_H */ diff --git a/include/sys/kmem.h b/include/sys/kmem.h deleted file mode 100644 index d6b428551..000000000 --- a/include/sys/kmem.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_KMEM_H -#define _SPL_KMEM_H - -#include <sys/debug.h> -#include <linux/slab.h> -#include <linux/sched.h> - -extern int kmem_debugging(void); -extern char *kmem_vasprintf(const char *fmt, va_list ap); -extern char *kmem_asprintf(const char *fmt, ...); -extern char *strdup(const char *str); -extern void strfree(char *str); - -/* - * Memory allocation interfaces - */ -#define KM_SLEEP 0x0000 /* can block for memory; success guaranteed */ -#define KM_NOSLEEP 0x0001 /* cannot block for memory; may fail */ -#define KM_PUSHPAGE 0x0004 /* can block for memory; may use reserve */ -#define KM_ZERO 0x1000 /* zero the allocation */ -#define KM_VMEM 0x2000 /* caller is vmem_* wrapper */ - -#define KM_PUBLIC_MASK (KM_SLEEP | KM_NOSLEEP | KM_PUSHPAGE) - -static int spl_fstrans_check(void); - -/* - * Convert a KM_* flags mask to its Linux GFP_* counterpart. The conversion - * function is context aware which means that KM_SLEEP allocations can be - * safely used in syncing contexts which have set PF_FSTRANS. - */ -static inline gfp_t -kmem_flags_convert(int flags) -{ - gfp_t lflags = __GFP_NOWARN | __GFP_COMP; - - if (flags & KM_NOSLEEP) { - lflags |= GFP_ATOMIC | __GFP_NORETRY; - } else { - lflags |= GFP_KERNEL; - if (spl_fstrans_check()) - lflags &= ~(__GFP_IO|__GFP_FS); - } - - if (flags & KM_PUSHPAGE) - lflags |= __GFP_HIGH; - - if (flags & KM_ZERO) - lflags |= __GFP_ZERO; - - return (lflags); -} - -typedef struct { - struct task_struct *fstrans_thread; - unsigned int saved_flags; -} fstrans_cookie_t; - -/* - * Introduced in Linux 3.9, however this cannot be solely relied on before - * Linux 3.18 as it doesn't turn off __GFP_FS as it should. - */ -#ifdef PF_MEMALLOC_NOIO -#define __SPL_PF_MEMALLOC_NOIO (PF_MEMALLOC_NOIO) -#else -#define __SPL_PF_MEMALLOC_NOIO (0) -#endif - -/* - * PF_FSTRANS is removed from Linux 4.12 - */ -#ifdef PF_FSTRANS -#define __SPL_PF_FSTRANS (PF_FSTRANS) -#else -#define __SPL_PF_FSTRANS (0) -#endif - -#define SPL_FSTRANS (__SPL_PF_FSTRANS|__SPL_PF_MEMALLOC_NOIO) - -static inline fstrans_cookie_t -spl_fstrans_mark(void) -{ - fstrans_cookie_t cookie; - - BUILD_BUG_ON(SPL_FSTRANS == 0); - - cookie.fstrans_thread = current; - cookie.saved_flags = current->flags & SPL_FSTRANS; - current->flags |= SPL_FSTRANS; - - return (cookie); -} - -static inline void -spl_fstrans_unmark(fstrans_cookie_t cookie) -{ - ASSERT3P(cookie.fstrans_thread, ==, current); - ASSERT((current->flags & SPL_FSTRANS) == SPL_FSTRANS); - - current->flags &= ~SPL_FSTRANS; - current->flags |= cookie.saved_flags; -} - -static inline int -spl_fstrans_check(void) -{ - return (current->flags & SPL_FSTRANS); -} - -/* - * specifically used to check PF_FSTRANS flag, cannot be relied on for - * checking spl_fstrans_mark(). - */ -static inline int -__spl_pf_fstrans_check(void) -{ - return (current->flags & __SPL_PF_FSTRANS); -} - -#ifdef HAVE_ATOMIC64_T -#define kmem_alloc_used_add(size) atomic64_add(size, &kmem_alloc_used) -#define kmem_alloc_used_sub(size) atomic64_sub(size, &kmem_alloc_used) -#define kmem_alloc_used_read() atomic64_read(&kmem_alloc_used) -#define kmem_alloc_used_set(size) atomic64_set(&kmem_alloc_used, size) -extern atomic64_t kmem_alloc_used; -extern unsigned long long kmem_alloc_max; -#else /* HAVE_ATOMIC64_T */ -#define kmem_alloc_used_add(size) atomic_add(size, &kmem_alloc_used) -#define kmem_alloc_used_sub(size) atomic_sub(size, &kmem_alloc_used) -#define kmem_alloc_used_read() atomic_read(&kmem_alloc_used) -#define kmem_alloc_used_set(size) atomic_set(&kmem_alloc_used, size) -extern atomic_t kmem_alloc_used; -extern unsigned long long kmem_alloc_max; -#endif /* HAVE_ATOMIC64_T */ - -extern unsigned int spl_kmem_alloc_warn; -extern unsigned int spl_kmem_alloc_max; - -#define kmem_alloc(sz, fl) spl_kmem_alloc((sz), (fl), __func__, __LINE__) -#define kmem_zalloc(sz, fl) spl_kmem_zalloc((sz), (fl), __func__, __LINE__) -#define kmem_free(ptr, sz) spl_kmem_free((ptr), (sz)) - -extern void *spl_kmem_alloc(size_t sz, int fl, const char *func, int line); -extern void *spl_kmem_zalloc(size_t sz, int fl, const char *func, int line); -extern void spl_kmem_free(const void *ptr, size_t sz); - -/* - * The following functions are only available for internal use. - */ -extern void *spl_kmem_alloc_impl(size_t size, int flags, int node); -extern void *spl_kmem_alloc_debug(size_t size, int flags, int node); -extern void *spl_kmem_alloc_track(size_t size, int flags, - const char *func, int line, int node); -extern void spl_kmem_free_impl(const void *buf, size_t size); -extern void spl_kmem_free_debug(const void *buf, size_t size); -extern void spl_kmem_free_track(const void *buf, size_t size); - -extern int spl_kmem_init(void); -extern void spl_kmem_fini(void); - -#endif /* _SPL_KMEM_H */ diff --git a/include/sys/kmem_cache.h b/include/sys/kmem_cache.h deleted file mode 100644 index 8fa14f67e..000000000 --- a/include/sys/kmem_cache.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_KMEM_CACHE_H -#define _SPL_KMEM_CACHE_H - -#include <sys/taskq.h> - -/* - * Slab allocation interfaces. The SPL slab differs from the standard - * Linux SLAB or SLUB primarily in that each cache may be backed by slabs - * allocated from the physical or virtal memory address space. The virtual - * slabs allow for good behavior when allocation large objects of identical - * size. This slab implementation also supports both constructors and - * destructors which the Linux slab does not. - */ -enum { - KMC_BIT_NOTOUCH = 0, /* Don't update ages */ - KMC_BIT_NODEBUG = 1, /* Default behavior */ - KMC_BIT_NOMAGAZINE = 2, /* XXX: Unsupported */ - KMC_BIT_NOHASH = 3, /* XXX: Unsupported */ - KMC_BIT_QCACHE = 4, /* XXX: Unsupported */ - KMC_BIT_KMEM = 5, /* Use kmem cache */ - KMC_BIT_VMEM = 6, /* Use vmem cache */ - KMC_BIT_SLAB = 7, /* Use Linux slab cache */ - KMC_BIT_OFFSLAB = 8, /* Objects not on slab */ - KMC_BIT_NOEMERGENCY = 9, /* Disable emergency objects */ - KMC_BIT_DEADLOCKED = 14, /* Deadlock detected */ - KMC_BIT_GROWING = 15, /* Growing in progress */ - KMC_BIT_REAPING = 16, /* Reaping in progress */ - KMC_BIT_DESTROY = 17, /* Destroy in progress */ - KMC_BIT_TOTAL = 18, /* Proc handler helper bit */ - KMC_BIT_ALLOC = 19, /* Proc handler helper bit */ - KMC_BIT_MAX = 20, /* Proc handler helper bit */ -}; - -/* kmem move callback return values */ -typedef enum kmem_cbrc { - KMEM_CBRC_YES = 0, /* Object moved */ - KMEM_CBRC_NO = 1, /* Object not moved */ - KMEM_CBRC_LATER = 2, /* Object not moved, try again later */ - KMEM_CBRC_DONT_NEED = 3, /* Neither object is needed */ - KMEM_CBRC_DONT_KNOW = 4, /* Object unknown */ -} kmem_cbrc_t; - -#define KMC_NOTOUCH (1 << KMC_BIT_NOTOUCH) -#define KMC_NODEBUG (1 << KMC_BIT_NODEBUG) -#define KMC_NOMAGAZINE (1 << KMC_BIT_NOMAGAZINE) -#define KMC_NOHASH (1 << KMC_BIT_NOHASH) -#define KMC_QCACHE (1 << KMC_BIT_QCACHE) -#define KMC_KMEM (1 << KMC_BIT_KMEM) -#define KMC_VMEM (1 << KMC_BIT_VMEM) -#define KMC_SLAB (1 << KMC_BIT_SLAB) -#define KMC_OFFSLAB (1 << KMC_BIT_OFFSLAB) -#define KMC_NOEMERGENCY (1 << KMC_BIT_NOEMERGENCY) -#define KMC_DEADLOCKED (1 << KMC_BIT_DEADLOCKED) -#define KMC_GROWING (1 << KMC_BIT_GROWING) -#define KMC_REAPING (1 << KMC_BIT_REAPING) -#define KMC_DESTROY (1 << KMC_BIT_DESTROY) -#define KMC_TOTAL (1 << KMC_BIT_TOTAL) -#define KMC_ALLOC (1 << KMC_BIT_ALLOC) -#define KMC_MAX (1 << KMC_BIT_MAX) - -#define KMC_REAP_CHUNK INT_MAX -#define KMC_DEFAULT_SEEKS 1 - -#define KMC_EXPIRE_AGE 0x1 /* Due to age */ -#define KMC_EXPIRE_MEM 0x2 /* Due to low memory */ - -#define KMC_RECLAIM_ONCE 0x1 /* Force a single shrinker pass */ - -extern unsigned int spl_kmem_cache_expire; -extern struct list_head spl_kmem_cache_list; -extern struct rw_semaphore spl_kmem_cache_sem; - -#define SKM_MAGIC 0x2e2e2e2e -#define SKO_MAGIC 0x20202020 -#define SKS_MAGIC 0x22222222 -#define SKC_MAGIC 0x2c2c2c2c - -#define SPL_KMEM_CACHE_DELAY 15 /* Minimum slab release age */ -#define SPL_KMEM_CACHE_REAP 0 /* Default reap everything */ -#define SPL_KMEM_CACHE_OBJ_PER_SLAB 8 /* Target objects per slab */ -#define SPL_KMEM_CACHE_OBJ_PER_SLAB_MIN 1 /* Minimum objects per slab */ -#define SPL_KMEM_CACHE_ALIGN 8 /* Default object alignment */ -#ifdef _LP64 -#define SPL_KMEM_CACHE_MAX_SIZE 32 /* Max slab size in MB */ -#else -#define SPL_KMEM_CACHE_MAX_SIZE 4 /* Max slab size in MB */ -#endif - -#define SPL_MAX_ORDER (MAX_ORDER - 3) -#define SPL_MAX_ORDER_NR_PAGES (1 << (SPL_MAX_ORDER - 1)) - -#ifdef CONFIG_SLUB -#define SPL_MAX_KMEM_CACHE_ORDER PAGE_ALLOC_COSTLY_ORDER -#define SPL_MAX_KMEM_ORDER_NR_PAGES (1 << (SPL_MAX_KMEM_CACHE_ORDER - 1)) -#else -#define SPL_MAX_KMEM_ORDER_NR_PAGES (KMALLOC_MAX_SIZE >> PAGE_SHIFT) -#endif - -#define POINTER_IS_VALID(p) 0 /* Unimplemented */ -#define POINTER_INVALIDATE(pp) /* Unimplemented */ - -typedef int (*spl_kmem_ctor_t)(void *, void *, int); -typedef void (*spl_kmem_dtor_t)(void *, void *); -typedef void (*spl_kmem_reclaim_t)(void *); - -typedef struct spl_kmem_magazine { - uint32_t skm_magic; /* Sanity magic */ - uint32_t skm_avail; /* Available objects */ - uint32_t skm_size; /* Magazine size */ - uint32_t skm_refill; /* Batch refill size */ - struct spl_kmem_cache *skm_cache; /* Owned by cache */ - unsigned long skm_age; /* Last cache access */ - unsigned int skm_cpu; /* Owned by cpu */ - void *skm_objs[0]; /* Object pointers */ -} spl_kmem_magazine_t; - -typedef struct spl_kmem_obj { - uint32_t sko_magic; /* Sanity magic */ - void *sko_addr; /* Buffer address */ - struct spl_kmem_slab *sko_slab; /* Owned by slab */ - struct list_head sko_list; /* Free object list linkage */ -} spl_kmem_obj_t; - -typedef struct spl_kmem_slab { - uint32_t sks_magic; /* Sanity magic */ - uint32_t sks_objs; /* Objects per slab */ - struct spl_kmem_cache *sks_cache; /* Owned by cache */ - struct list_head sks_list; /* Slab list linkage */ - struct list_head sks_free_list; /* Free object list */ - unsigned long sks_age; /* Last modify jiffie */ - uint32_t sks_ref; /* Ref count used objects */ -} spl_kmem_slab_t; - -typedef struct spl_kmem_alloc { - struct spl_kmem_cache *ska_cache; /* Owned by cache */ - int ska_flags; /* Allocation flags */ - taskq_ent_t ska_tqe; /* Task queue entry */ -} spl_kmem_alloc_t; - -typedef struct spl_kmem_emergency { - struct rb_node ske_node; /* Emergency tree linkage */ - unsigned long ske_obj; /* Buffer address */ -} spl_kmem_emergency_t; - -typedef struct spl_kmem_cache { - uint32_t skc_magic; /* Sanity magic */ - uint32_t skc_name_size; /* Name length */ - char *skc_name; /* Name string */ - spl_kmem_magazine_t **skc_mag; /* Per-CPU warm cache */ - uint32_t skc_mag_size; /* Magazine size */ - uint32_t skc_mag_refill; /* Magazine refill count */ - spl_kmem_ctor_t skc_ctor; /* Constructor */ - spl_kmem_dtor_t skc_dtor; /* Destructor */ - spl_kmem_reclaim_t skc_reclaim; /* Reclaimator */ - void *skc_private; /* Private data */ - void *skc_vmp; /* Unused */ - struct kmem_cache *skc_linux_cache; /* Linux slab cache if used */ - unsigned long skc_flags; /* Flags */ - uint32_t skc_obj_size; /* Object size */ - uint32_t skc_obj_align; /* Object alignment */ - uint32_t skc_slab_objs; /* Objects per slab */ - uint32_t skc_slab_size; /* Slab size */ - uint32_t skc_delay; /* Slab reclaim interval */ - uint32_t skc_reap; /* Slab reclaim count */ - atomic_t skc_ref; /* Ref count callers */ - taskqid_t skc_taskqid; /* Slab reclaim task */ - struct list_head skc_list; /* List of caches linkage */ - struct list_head skc_complete_list; /* Completely alloc'ed */ - struct list_head skc_partial_list; /* Partially alloc'ed */ - struct rb_root skc_emergency_tree; /* Min sized objects */ - spinlock_t skc_lock; /* Cache lock */ - spl_wait_queue_head_t skc_waitq; /* Allocation waiters */ - uint64_t skc_slab_fail; /* Slab alloc failures */ - uint64_t skc_slab_create; /* Slab creates */ - uint64_t skc_slab_destroy; /* Slab destroys */ - uint64_t skc_slab_total; /* Slab total current */ - uint64_t skc_slab_alloc; /* Slab alloc current */ - uint64_t skc_slab_max; /* Slab max historic */ - uint64_t skc_obj_total; /* Obj total current */ - uint64_t skc_obj_alloc; /* Obj alloc current */ - uint64_t skc_obj_max; /* Obj max historic */ - uint64_t skc_obj_deadlock; /* Obj emergency deadlocks */ - uint64_t skc_obj_emergency; /* Obj emergency current */ - uint64_t skc_obj_emergency_max; /* Obj emergency max */ -} spl_kmem_cache_t; -#define kmem_cache_t spl_kmem_cache_t - -extern spl_kmem_cache_t *spl_kmem_cache_create(char *name, size_t size, - size_t align, spl_kmem_ctor_t ctor, spl_kmem_dtor_t dtor, - spl_kmem_reclaim_t reclaim, void *priv, void *vmp, int flags); -extern void spl_kmem_cache_set_move(spl_kmem_cache_t *, - kmem_cbrc_t (*)(void *, void *, size_t, void *)); -extern void spl_kmem_cache_destroy(spl_kmem_cache_t *skc); -extern void *spl_kmem_cache_alloc(spl_kmem_cache_t *skc, int flags); -extern void spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj); -extern void spl_kmem_cache_set_allocflags(spl_kmem_cache_t *skc, gfp_t flags); -extern void spl_kmem_cache_reap_now(spl_kmem_cache_t *skc, int count); -extern void spl_kmem_reap(void); - -#define kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl) \ - spl_kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl) -#define kmem_cache_set_move(skc, move) spl_kmem_cache_set_move(skc, move) -#define kmem_cache_destroy(skc) spl_kmem_cache_destroy(skc) -#define kmem_cache_alloc(skc, flags) spl_kmem_cache_alloc(skc, flags) -#define kmem_cache_free(skc, obj) spl_kmem_cache_free(skc, obj) -#define kmem_cache_reap_now(skc) \ - spl_kmem_cache_reap_now(skc, skc->skc_reap) -#define kmem_reap() spl_kmem_reap() - -/* - * The following functions are only available for internal use. - */ -extern int spl_kmem_cache_init(void); -extern void spl_kmem_cache_fini(void); - -#endif /* _SPL_KMEM_CACHE_H */ diff --git a/include/sys/kobj.h b/include/sys/kobj.h deleted file mode 100644 index 558ec39a8..000000000 --- a/include/sys/kobj.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_KOBJ_H -#define _SPL_KOBJ_H - -#include <sys/vnode.h> - -typedef struct _buf { - vnode_t *vp; -} _buf_t; - -typedef struct _buf buf_t; - -extern struct _buf *kobj_open_file(const char *name); -extern void kobj_close_file(struct _buf *file); -extern int kobj_read_file(struct _buf *file, char *buf, unsigned size, - unsigned off); -extern int kobj_get_filesize(struct _buf *file, uint64_t *size); - -#endif /* SPL_KOBJ_H */ diff --git a/include/sys/kstat.h b/include/sys/kstat.h deleted file mode 100644 index e9aff7386..000000000 --- a/include/sys/kstat.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_KSTAT_H -#define _SPL_KSTAT_H - -#include <linux/module.h> -#include <linux/proc_compat.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/kmem.h> -#include <sys/mutex.h> - -#define KSTAT_STRLEN 255 -#define KSTAT_RAW_MAX (128*1024) - -/* - * For reference valid classes are: - * disk, tape, net, controller, vm, kvm, hat, streams, kstat, misc - */ - -#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */ -#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */ -#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */ -#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */ -#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */ -#define KSTAT_NUM_TYPES 5 - -#define KSTAT_DATA_CHAR 0 -#define KSTAT_DATA_INT32 1 -#define KSTAT_DATA_UINT32 2 -#define KSTAT_DATA_INT64 3 -#define KSTAT_DATA_UINT64 4 -#define KSTAT_DATA_LONG 5 -#define KSTAT_DATA_ULONG 6 -#define KSTAT_DATA_STRING 7 -#define KSTAT_NUM_DATAS 8 - -#define KSTAT_INTR_HARD 0 -#define KSTAT_INTR_SOFT 1 -#define KSTAT_INTR_WATCHDOG 2 -#define KSTAT_INTR_SPURIOUS 3 -#define KSTAT_INTR_MULTSVC 4 -#define KSTAT_NUM_INTRS 5 - -#define KSTAT_FLAG_VIRTUAL 0x01 -#define KSTAT_FLAG_VAR_SIZE 0x02 -#define KSTAT_FLAG_WRITABLE 0x04 -#define KSTAT_FLAG_PERSISTENT 0x08 -#define KSTAT_FLAG_DORMANT 0x10 -#define KSTAT_FLAG_UNSUPPORTED \ - (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \ - KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT) - - -#define KS_MAGIC 0x9d9d9d9d - -/* Dynamic updates */ -#define KSTAT_READ 0 -#define KSTAT_WRITE 1 - -struct kstat_s; -typedef struct kstat_s kstat_t; - -typedef int kid_t; /* unique kstat id */ -typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */ - -typedef struct kstat_module { - char ksm_name[KSTAT_STRLEN+1]; /* module name */ - struct list_head ksm_module_list; /* module linkage */ - struct list_head ksm_kstat_list; /* list of kstat entries */ - struct proc_dir_entry *ksm_proc; /* proc entry */ -} kstat_module_t; - -typedef struct kstat_raw_ops { - int (*headers)(char *buf, size_t size); - int (*data)(char *buf, size_t size, void *data); - void *(*addr)(kstat_t *ksp, loff_t index); -} kstat_raw_ops_t; - -struct kstat_s { - int ks_magic; /* magic value */ - kid_t ks_kid; /* unique kstat ID */ - hrtime_t ks_crtime; /* creation time */ - hrtime_t ks_snaptime; /* last access time */ - char ks_module[KSTAT_STRLEN+1]; /* provider module name */ - int ks_instance; /* provider module instance */ - char ks_name[KSTAT_STRLEN+1]; /* kstat name */ - char ks_class[KSTAT_STRLEN+1]; /* kstat class */ - uchar_t ks_type; /* kstat data type */ - uchar_t ks_flags; /* kstat flags */ - void *ks_data; /* kstat type-specific data */ - uint_t ks_ndata; /* # of data records */ - size_t ks_data_size; /* size of kstat data section */ - struct proc_dir_entry *ks_proc; /* proc linkage */ - kstat_update_t *ks_update; /* dynamic updates */ - void *ks_private; /* private data */ - kmutex_t ks_private_lock; /* kstat private data lock */ - kmutex_t *ks_lock; /* kstat data lock */ - struct list_head ks_list; /* kstat linkage */ - kstat_module_t *ks_owner; /* kstat module linkage */ - kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */ - char *ks_raw_buf; /* buf used for raw ops */ - size_t ks_raw_bufsize; /* size of raw ops buffer */ -}; - -typedef struct kstat_named_s { - char name[KSTAT_STRLEN]; /* name of counter */ - uchar_t data_type; /* data type */ - union { - char c[16]; /* 128-bit int */ - int32_t i32; /* 32-bit signed int */ - uint32_t ui32; /* 32-bit unsigned int */ - int64_t i64; /* 64-bit signed int */ - uint64_t ui64; /* 64-bit unsigned int */ - long l; /* native signed long */ - ulong_t ul; /* native unsigned long */ - struct { - union { - char *ptr; /* NULL-term string */ - char __pad[8]; /* 64-bit padding */ - } addr; - uint32_t len; /* # bytes for strlen + '\0' */ - } string; - } value; -} kstat_named_t; - -#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr) -#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len) - -typedef struct kstat_intr { - uint_t intrs[KSTAT_NUM_INTRS]; -} kstat_intr_t; - -typedef struct kstat_io { - u_longlong_t nread; /* number of bytes read */ - u_longlong_t nwritten; /* number of bytes written */ - uint_t reads; /* number of read operations */ - uint_t writes; /* number of write operations */ - hrtime_t wtime; /* cumulative wait (pre-service) time */ - hrtime_t wlentime; /* cumulative wait len*time product */ - hrtime_t wlastupdate; /* last time wait queue changed */ - hrtime_t rtime; /* cumulative run (service) time */ - hrtime_t rlentime; /* cumulative run length*time product */ - hrtime_t rlastupdate; /* last time run queue changed */ - uint_t wcnt; /* count of elements in wait state */ - uint_t rcnt; /* count of elements in run state */ -} kstat_io_t; - -typedef struct kstat_timer { - char name[KSTAT_STRLEN+1]; /* event name */ - u_longlong_t num_events; /* number of events */ - hrtime_t elapsed_time; /* cumulative elapsed time */ - hrtime_t min_time; /* shortest event duration */ - hrtime_t max_time; /* longest event duration */ - hrtime_t start_time; /* previous event start time */ - hrtime_t stop_time; /* previous event stop time */ -} kstat_timer_t; - -int spl_kstat_init(void); -void spl_kstat_fini(void); - -extern void __kstat_set_raw_ops(kstat_t *ksp, - int (*headers)(char *buf, size_t size), - int (*data)(char *buf, size_t size, void *data), - void* (*addr)(kstat_t *ksp, loff_t index)); - -extern kstat_t *__kstat_create(const char *ks_module, int ks_instance, - const char *ks_name, const char *ks_class, uchar_t ks_type, - uint_t ks_ndata, uchar_t ks_flags); - -extern void __kstat_install(kstat_t *ksp); -extern void __kstat_delete(kstat_t *ksp); -extern void kstat_waitq_enter(kstat_io_t *); -extern void kstat_waitq_exit(kstat_io_t *); -extern void kstat_runq_enter(kstat_io_t *); -extern void kstat_runq_exit(kstat_io_t *); - -#define kstat_set_raw_ops(k, h, d, a) \ - __kstat_set_raw_ops(k, h, d, a) -#define kstat_create(m, i, n, c, t, s, f) \ - __kstat_create(m, i, n, c, t, s, f) - -#define kstat_install(k) __kstat_install(k) -#define kstat_delete(k) __kstat_delete(k) - -#endif /* _SPL_KSTAT_H */ diff --git a/include/sys/list.h b/include/sys/list.h deleted file mode 100644 index d80c8474e..000000000 --- a/include/sys/list.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_LIST_H -#define _SPL_LIST_H - -#include <sys/types.h> -#include <linux/list.h> - -/* - * NOTE: I have implemented the Solaris list API in terms of the native - * linux API. This has certain advantages in terms of leveraging the linux - * list debugging infrastructure, but it also means that the internals of a - * list differ slightly than on Solaris. This is not a problem as long as - * all callers stick to the published API. The two major differences are: - * - * 1) A list_node_t is mapped to a linux list_head struct which changes - * the name of the list_next/list_prev pointers to next/prev respectively. - * - * 2) A list_node_t which is not attached to a list on Solaris is denoted - * by having its list_next/list_prev pointers set to NULL. Under linux - * the next/prev pointers are set to LIST_POISON1 and LIST_POISON2 - * respectively. At this moment this only impacts the implementation - * of the list_link_init() and list_link_active() functions. - */ - -typedef struct list_head list_node_t; - -typedef struct list { - size_t list_size; - size_t list_offset; - list_node_t list_head; -} list_t; - -#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) -#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) - -static inline int -list_is_empty(list_t *list) -{ - return (list_empty(&list->list_head)); -} - -static inline void -list_link_init(list_node_t *node) -{ - node->next = LIST_POISON1; - node->prev = LIST_POISON2; -} - -static inline void -list_create(list_t *list, size_t size, size_t offset) -{ - ASSERT(list); - ASSERT(size > 0); - ASSERT(size >= offset + sizeof (list_node_t)); - - list->list_size = size; - list->list_offset = offset; - INIT_LIST_HEAD(&list->list_head); -} - -static inline void -list_destroy(list_t *list) -{ - ASSERT(list); - ASSERT(list_is_empty(list)); - - list_del(&list->list_head); -} - -static inline void -list_insert_head(list_t *list, void *object) -{ - list_add(list_d2l(list, object), &list->list_head); -} - -static inline void -list_insert_tail(list_t *list, void *object) -{ - list_add_tail(list_d2l(list, object), &list->list_head); -} - -static inline void -list_insert_after(list_t *list, void *object, void *nobject) -{ - if (object == NULL) - list_insert_head(list, nobject); - else - list_add(list_d2l(list, nobject), list_d2l(list, object)); -} - -static inline void -list_insert_before(list_t *list, void *object, void *nobject) -{ - if (object == NULL) - list_insert_tail(list, nobject); - else - list_add_tail(list_d2l(list, nobject), list_d2l(list, object)); -} - -static inline void -list_remove(list_t *list, void *object) -{ - ASSERT(!list_is_empty(list)); - list_del(list_d2l(list, object)); -} - -static inline void * -list_remove_head(list_t *list) -{ - list_node_t *head = list->list_head.next; - if (head == &list->list_head) - return (NULL); - - list_del(head); - return (list_object(list, head)); -} - -static inline void * -list_remove_tail(list_t *list) -{ - list_node_t *tail = list->list_head.prev; - if (tail == &list->list_head) - return (NULL); - - list_del(tail); - return (list_object(list, tail)); -} - -static inline void * -list_head(list_t *list) -{ - if (list_is_empty(list)) - return (NULL); - - return (list_object(list, list->list_head.next)); -} - -static inline void * -list_tail(list_t *list) -{ - if (list_is_empty(list)) - return (NULL); - - return (list_object(list, list->list_head.prev)); -} - -static inline void * -list_next(list_t *list, void *object) -{ - list_node_t *node = list_d2l(list, object); - - if (node->next != &list->list_head) - return (list_object(list, node->next)); - - return (NULL); -} - -static inline void * -list_prev(list_t *list, void *object) -{ - list_node_t *node = list_d2l(list, object); - - if (node->prev != &list->list_head) - return (list_object(list, node->prev)); - - return (NULL); -} - -static inline int -list_link_active(list_node_t *node) -{ - return (node->next != LIST_POISON1) && (node->prev != LIST_POISON2); -} - -static inline void -spl_list_move_tail(list_t *dst, list_t *src) -{ - list_splice_init(&src->list_head, dst->list_head.prev); -} - -#define list_move_tail(dst, src) spl_list_move_tail(dst, src) - -static inline void -list_link_replace(list_node_t *old_node, list_node_t *new_node) -{ - ASSERT(list_link_active(old_node)); - ASSERT(!list_link_active(new_node)); - - new_node->next = old_node->next; - new_node->prev = old_node->prev; - old_node->prev->next = new_node; - old_node->next->prev = new_node; - list_link_init(old_node); -} - -#endif /* SPL_LIST_H */ diff --git a/include/sys/mkdev.h b/include/sys/mkdev.h deleted file mode 100644 index 7dff2d22d..000000000 --- a/include/sys/mkdev.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_MKDEV_H -#define _SPL_MKDEV_H - -#endif /* SPL_MKDEV_H */ diff --git a/include/sys/mntent.h b/include/sys/mntent.h deleted file mode 100644 index cac28c530..000000000 --- a/include/sys/mntent.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_MNTENT_H -#define _SPL_MNTENT_H - -#endif /* SPL_MNTENT_H */ diff --git a/include/sys/modctl.h b/include/sys/modctl.h deleted file mode 100644 index 8f9ae496d..000000000 --- a/include/sys/modctl.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_MODCTL_H -#define _SPL_MODCTL_H - -#endif /* SPL_MODCTL_H */ diff --git a/include/sys/mode.h b/include/sys/mode.h deleted file mode 100644 index 02802d0d4..000000000 --- a/include/sys/mode.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_MODE_H -#define _SPL_MODE_H - -#define IFTOVT(mode) vn_mode_to_vtype(mode) -#define VTTOIF(vtype) vn_vtype_to_mode(vtype) -#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) - -#endif /* SPL_MODE_H */ diff --git a/include/sys/mount.h b/include/sys/mount.h deleted file mode 100644 index fdd1c6678..000000000 --- a/include/sys/mount.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_MOUNT_H -#define _SPL_MOUNT_H - -#endif /* SPL_MOUNT_H */ diff --git a/include/sys/mutex.h b/include/sys/mutex.h deleted file mode 100644 index c7084b3c3..000000000 --- a/include/sys/mutex.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_MUTEX_H -#define _SPL_MUTEX_H - -#include <sys/types.h> -#include <linux/mutex.h> -#include <linux/compiler_compat.h> -#include <linux/lockdep.h> - -typedef enum { - MUTEX_DEFAULT = 0, - MUTEX_SPIN = 1, - MUTEX_ADAPTIVE = 2, - MUTEX_NOLOCKDEP = 3 -} kmutex_type_t; - -typedef struct { - struct mutex m_mutex; - spinlock_t m_lock; /* used for serializing mutex_exit */ - kthread_t *m_owner; -#ifdef CONFIG_LOCKDEP - kmutex_type_t m_type; -#endif /* CONFIG_LOCKDEP */ -} kmutex_t; - -#define MUTEX(mp) (&((mp)->m_mutex)) - -static inline void -spl_mutex_set_owner(kmutex_t *mp) -{ - mp->m_owner = current; -} - -static inline void -spl_mutex_clear_owner(kmutex_t *mp) -{ - mp->m_owner = NULL; -} - -#define mutex_owner(mp) (ACCESS_ONCE((mp)->m_owner)) -#define mutex_owned(mp) (mutex_owner(mp) == current) -#define MUTEX_HELD(mp) mutex_owned(mp) -#define MUTEX_NOT_HELD(mp) (!MUTEX_HELD(mp)) - -#ifdef CONFIG_LOCKDEP -static inline void -spl_mutex_set_type(kmutex_t *mp, kmutex_type_t type) -{ - mp->m_type = type; -} -static inline void -spl_mutex_lockdep_off_maybe(kmutex_t *mp) \ -{ \ - if (mp && mp->m_type == MUTEX_NOLOCKDEP) \ - lockdep_off(); \ -} -static inline void -spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ -{ \ - if (mp && mp->m_type == MUTEX_NOLOCKDEP) \ - lockdep_on(); \ -} -#else /* CONFIG_LOCKDEP */ -#define spl_mutex_set_type(mp, type) -#define spl_mutex_lockdep_off_maybe(mp) -#define spl_mutex_lockdep_on_maybe(mp) -#endif /* CONFIG_LOCKDEP */ - -/* - * The following functions must be a #define and not static inline. - * This ensures that the native linux mutex functions (lock/unlock) - * will be correctly located in the users code which is important - * for the built in kernel lock analysis tools - */ -#undef mutex_init -#define mutex_init(mp, name, type, ibc) \ -{ \ - static struct lock_class_key __key; \ - ASSERT(type == MUTEX_DEFAULT || type == MUTEX_NOLOCKDEP); \ - \ - __mutex_init(MUTEX(mp), (name) ? (#name) : (#mp), &__key); \ - spin_lock_init(&(mp)->m_lock); \ - spl_mutex_clear_owner(mp); \ - spl_mutex_set_type(mp, type); \ -} - -#undef mutex_destroy -#define mutex_destroy(mp) \ -{ \ - VERIFY3P(mutex_owner(mp), ==, NULL); \ -} - -/* BEGIN CSTYLED */ -#define mutex_tryenter(mp) \ -({ \ - int _rc_; \ - \ - spl_mutex_lockdep_off_maybe(mp); \ - if ((_rc_ = mutex_trylock(MUTEX(mp))) == 1) \ - spl_mutex_set_owner(mp); \ - spl_mutex_lockdep_on_maybe(mp); \ - \ - _rc_; \ -}) -/* END CSTYLED */ - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -#define mutex_enter_nested(mp, subclass) \ -{ \ - ASSERT3P(mutex_owner(mp), !=, current); \ - spl_mutex_lockdep_off_maybe(mp); \ - mutex_lock_nested(MUTEX(mp), (subclass)); \ - spl_mutex_lockdep_on_maybe(mp); \ - spl_mutex_set_owner(mp); \ -} -#else /* CONFIG_DEBUG_LOCK_ALLOC */ -#define mutex_enter_nested(mp, subclass) \ -{ \ - ASSERT3P(mutex_owner(mp), !=, current); \ - spl_mutex_lockdep_off_maybe(mp); \ - mutex_lock(MUTEX(mp)); \ - spl_mutex_lockdep_on_maybe(mp); \ - spl_mutex_set_owner(mp); \ -} -#endif /* CONFIG_DEBUG_LOCK_ALLOC */ - -#define mutex_enter(mp) mutex_enter_nested((mp), 0) - -/* - * The reason for the spinlock: - * - * The Linux mutex is designed with a fast-path/slow-path design such that it - * does not guarantee serialization upon itself, allowing a race where latter - * acquirers finish mutex_unlock before former ones. - * - * The race renders it unsafe to be used for serializing the freeing of an - * object in which the mutex is embedded, where the latter acquirer could go - * on to free the object while the former one is still doing mutex_unlock and - * causing memory corruption. - * - * However, there are many places in ZFS where the mutex is used for - * serializing object freeing, and the code is shared among other OSes without - * this issue. Thus, we need the spinlock to force the serialization on - * mutex_exit(). - * - * See http://lwn.net/Articles/575477/ for the information about the race. - */ -#define mutex_exit(mp) \ -{ \ - spl_mutex_clear_owner(mp); \ - spin_lock(&(mp)->m_lock); \ - spl_mutex_lockdep_off_maybe(mp); \ - mutex_unlock(MUTEX(mp)); \ - spl_mutex_lockdep_on_maybe(mp); \ - spin_unlock(&(mp)->m_lock); \ - /* NOTE: do not dereference mp after this point */ \ -} - -int spl_mutex_init(void); -void spl_mutex_fini(void); - -#endif /* _SPL_MUTEX_H */ diff --git a/include/sys/note.h b/include/sys/note.h deleted file mode 100644 index f7f9b70ef..000000000 --- a/include/sys/note.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_NOTE_H -#define _SPL_NOTE_H - -#endif /* SPL_NOTE_H */ diff --git a/include/sys/open.h b/include/sys/open.h deleted file mode 100644 index 7c9e0cb7a..000000000 --- a/include/sys/open.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_OPEN_H -#define _SPL_OPEN_H - -#endif /* SPL_OPEN_H */ diff --git a/include/sys/param.h b/include/sys/param.h deleted file mode 100644 index 4ef929151..000000000 --- a/include/sys/param.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_PARAM_H -#define _SPL_PARAM_H - -#include <asm/page.h> - -/* Pages to bytes and back */ -#define ptob(pages) ((pages) << PAGE_SHIFT) -#define btop(bytes) ((bytes) >> PAGE_SHIFT) - -#define MAXUID UINT32_MAX - -#endif /* SPL_PARAM_H */ diff --git a/include/sys/pathname.h b/include/sys/pathname.h deleted file mode 100644 index fde1b3c1e..000000000 --- a/include/sys/pathname.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_PATHNAME_H -#define _SPL_PATHNAME_H - -typedef struct pathname { - char *pn_buf; /* underlying storage */ - char *pn_path; /* remaining pathname */ - size_t pn_pathlen; /* remaining length */ - size_t pn_bufsize; /* total size of pn_buf */ -} pathname_t; - -#endif /* SPL_PATHNAME_H */ diff --git a/include/sys/policy.h b/include/sys/policy.h deleted file mode 100644 index e4333cfcf..000000000 --- a/include/sys/policy.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_POLICY_H -#define _SPL_POLICY_H - -#define secpolicy_fs_unmount(c, vfs) (0) -#define secpolicy_nfs(c) (0) -#define secpolicy_sys_config(c, co) (0) -#define secpolicy_zfs(c) (0) -#define secpolicy_zinject(c) (0) -#define secpolicy_vnode_setids_setgids(c, id) (0) -#define secpolicy_vnode_setid_retain(c, sr) (0) -#define secpolicy_setid_clear(v, c) (0) -#define secpolicy_vnode_any_access(c, vp, o) (0) -#define secpolicy_vnode_access2(c, cp, o, m1, m2) (0) -#define secpolicy_vnode_chown(c, o) (0) -#define secpolicy_vnode_setdac(c, o) (0) -#define secpolicy_vnode_remove(c) (0) -#define secpolicy_vnode_setattr(c, v, a, o, f, func, n) (0) -#define secpolicy_xvattr(x, o, c, t) (0) -#define secpolicy_vnode_stky_modify(c) (0) -#define secpolicy_setid_setsticky_clear(v, a, o, c) (0) -#define secpolicy_basic_link(c) (0) - -#endif /* SPL_POLICY_H */ diff --git a/include/sys/pool.h b/include/sys/pool.h deleted file mode 100644 index 392c14b5e..000000000 --- a/include/sys/pool.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_POOL_H -#define _SPL_POOL_H - -#include <sys/pset.h> - -#endif /* SPL_POOL_H */ diff --git a/include/sys/priv_impl.h b/include/sys/priv_impl.h deleted file mode 100644 index 822c2dec1..000000000 --- a/include/sys/priv_impl.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_PRIV_IMPL_H -#define _SPL_PRIV_IMPL_H - -#endif /* _SPL_PRIV_IMPL_H */ diff --git a/include/sys/proc.h b/include/sys/proc.h deleted file mode 100644 index 95fc8cc5f..000000000 --- a/include/sys/proc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_PROC_H -#define _SPL_PROC_H - -#endif /* SPL_PROC_H */ diff --git a/include/sys/processor.h b/include/sys/processor.h deleted file mode 100644 index a70101fa2..000000000 --- a/include/sys/processor.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_PROCESSOR_H -#define _SPL_PROCESSOR_H - -#define getcpuid() smp_processor_id() - -typedef int processorid_t; - -#endif /* _SPL_PROCESSOR_H */ diff --git a/include/sys/pset.h b/include/sys/pset.h deleted file mode 100644 index a6a9d343b..000000000 --- a/include/sys/pset.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_PSET_H -#define _SPL_PSET_H - -typedef int psetid_t; - -/* special processor set id's */ -#define PS_NONE -1 -#define PS_QUERY -2 -#define PS_MYID -3 -#define PS_SOFT -4 -#define PS_HARD -5 -#define PS_QUERY_TYPE -6 - -#endif /* SPL_PSET_H */ diff --git a/include/sys/random.h b/include/sys/random.h deleted file mode 100644 index 93e244f56..000000000 --- a/include/sys/random.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_RANDOM_H -#define _SPL_RANDOM_H - -#include <linux/module.h> -#include <linux/random.h> - -static __inline__ int -random_get_bytes(uint8_t *ptr, size_t len) -{ - get_random_bytes((void *)ptr, (int)len); - return (0); -} - -extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len); - -#endif /* _SPL_RANDOM_H */ diff --git a/include/sys/refstr.h b/include/sys/refstr.h deleted file mode 100644 index 1b54dab45..000000000 --- a/include/sys/refstr.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_REFSTR_H -#define _SPL_REFSTR_H - -#endif /* SPL_REFSTR_H */ diff --git a/include/sys/resource.h b/include/sys/resource.h deleted file mode 100644 index d1ffb6c2d..000000000 --- a/include/sys/resource.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_RESOURCE_H -#define _SPL_RESOURCE_H - -#include <linux/resource.h> - -#endif /* SPL_RESOURCE_H */ diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h deleted file mode 100644 index bb8b785e8..000000000 --- a/include/sys/rwlock.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_RWLOCK_H -#define _SPL_RWLOCK_H - -#include <sys/types.h> -#include <linux/rwsem.h> -#include <linux/rwsem_compat.h> - -typedef enum { - RW_DRIVER = 2, - RW_DEFAULT = 4, - RW_NOLOCKDEP = 5 -} krw_type_t; - -typedef enum { - RW_NONE = 0, - RW_WRITER = 1, - RW_READER = 2 -} krw_t; - -/* - * If CONFIG_RWSEM_SPIN_ON_OWNER is defined, rw_semaphore will have an owner - * field, so we don't need our own. - */ -typedef struct { - struct rw_semaphore rw_rwlock; -#ifndef CONFIG_RWSEM_SPIN_ON_OWNER - kthread_t *rw_owner; -#endif -#ifdef CONFIG_LOCKDEP - krw_type_t rw_type; -#endif /* CONFIG_LOCKDEP */ -} krwlock_t; - -#define SEM(rwp) (&(rwp)->rw_rwlock) - -static inline void -spl_rw_set_owner(krwlock_t *rwp) -{ -/* - * If CONFIG_RWSEM_SPIN_ON_OWNER is defined, down_write, up_write, - * downgrade_write and __init_rwsem will set/clear owner for us. - */ -#ifndef CONFIG_RWSEM_SPIN_ON_OWNER - rwp->rw_owner = current; -#endif -} - -static inline void -spl_rw_clear_owner(krwlock_t *rwp) -{ -#ifndef CONFIG_RWSEM_SPIN_ON_OWNER - rwp->rw_owner = NULL; -#endif -} - -static inline kthread_t * -rw_owner(krwlock_t *rwp) -{ -#ifdef CONFIG_RWSEM_SPIN_ON_OWNER - return (SEM(rwp)->owner); -#else - return (rwp->rw_owner); -#endif -} - -#ifdef CONFIG_LOCKDEP -static inline void -spl_rw_set_type(krwlock_t *rwp, krw_type_t type) -{ - rwp->rw_type = type; -} -static inline void -spl_rw_lockdep_off_maybe(krwlock_t *rwp) \ -{ \ - if (rwp && rwp->rw_type == RW_NOLOCKDEP) \ - lockdep_off(); \ -} -static inline void -spl_rw_lockdep_on_maybe(krwlock_t *rwp) \ -{ \ - if (rwp && rwp->rw_type == RW_NOLOCKDEP) \ - lockdep_on(); \ -} -#else /* CONFIG_LOCKDEP */ -#define spl_rw_set_type(rwp, type) -#define spl_rw_lockdep_off_maybe(rwp) -#define spl_rw_lockdep_on_maybe(rwp) -#endif /* CONFIG_LOCKDEP */ - -static inline int -RW_READ_HELD(krwlock_t *rwp) -{ - /* - * Linux 4.8 will set owner to 1 when read held instead of leave it - * NULL. So we check whether owner <= 1. - */ - return (spl_rwsem_is_locked(SEM(rwp)) && - (unsigned long)rw_owner(rwp) <= 1); -} - -static inline int -RW_WRITE_HELD(krwlock_t *rwp) -{ - return (rw_owner(rwp) == current); -} - -static inline int -RW_LOCK_HELD(krwlock_t *rwp) -{ - return (spl_rwsem_is_locked(SEM(rwp))); -} - -/* - * The following functions must be a #define and not static inline. - * This ensures that the native linux semaphore functions (down/up) - * will be correctly located in the users code which is important - * for the built in kernel lock analysis tools - */ -/* BEGIN CSTYLED */ -#define rw_init(rwp, name, type, arg) \ -({ \ - static struct lock_class_key __key; \ - ASSERT(type == RW_DEFAULT || type == RW_NOLOCKDEP); \ - \ - __init_rwsem(SEM(rwp), #rwp, &__key); \ - spl_rw_clear_owner(rwp); \ - spl_rw_set_type(rwp, type); \ -}) - -#define rw_destroy(rwp) \ -({ \ - VERIFY(!RW_LOCK_HELD(rwp)); \ -}) - -#define rw_tryenter(rwp, rw) \ -({ \ - int _rc_ = 0; \ - \ - spl_rw_lockdep_off_maybe(rwp); \ - switch (rw) { \ - case RW_READER: \ - _rc_ = down_read_trylock(SEM(rwp)); \ - break; \ - case RW_WRITER: \ - if ((_rc_ = down_write_trylock(SEM(rwp)))) \ - spl_rw_set_owner(rwp); \ - break; \ - default: \ - VERIFY(0); \ - } \ - spl_rw_lockdep_on_maybe(rwp); \ - _rc_; \ -}) - -#define rw_enter(rwp, rw) \ -({ \ - spl_rw_lockdep_off_maybe(rwp); \ - switch (rw) { \ - case RW_READER: \ - down_read(SEM(rwp)); \ - break; \ - case RW_WRITER: \ - down_write(SEM(rwp)); \ - spl_rw_set_owner(rwp); \ - break; \ - default: \ - VERIFY(0); \ - } \ - spl_rw_lockdep_on_maybe(rwp); \ -}) - -#define rw_exit(rwp) \ -({ \ - spl_rw_lockdep_off_maybe(rwp); \ - if (RW_WRITE_HELD(rwp)) { \ - spl_rw_clear_owner(rwp); \ - up_write(SEM(rwp)); \ - } else { \ - ASSERT(RW_READ_HELD(rwp)); \ - up_read(SEM(rwp)); \ - } \ - spl_rw_lockdep_on_maybe(rwp); \ -}) - -#define rw_downgrade(rwp) \ -({ \ - spl_rw_lockdep_off_maybe(rwp); \ - spl_rw_clear_owner(rwp); \ - downgrade_write(SEM(rwp)); \ - spl_rw_lockdep_on_maybe(rwp); \ -}) - -#define rw_tryupgrade(rwp) \ -({ \ - int _rc_ = 0; \ - \ - if (RW_WRITE_HELD(rwp)) { \ - _rc_ = 1; \ - } else { \ - spl_rw_lockdep_off_maybe(rwp); \ - if ((_rc_ = rwsem_tryupgrade(SEM(rwp)))) \ - spl_rw_set_owner(rwp); \ - spl_rw_lockdep_on_maybe(rwp); \ - } \ - _rc_; \ -}) -/* END CSTYLED */ - -int spl_rw_init(void); -void spl_rw_fini(void); - -#endif /* _SPL_RWLOCK_H */ diff --git a/include/sys/sdt.h b/include/sys/sdt.h deleted file mode 100644 index 2d4679d65..000000000 --- a/include/sys/sdt.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SDT_H -#define _SPL_SDT_H - -#define SET_ERROR(x) (x) - -#endif /* SPL_SDT_H */ diff --git a/include/sys/sid.h b/include/sys/sid.h deleted file mode 100644 index 731b62c47..000000000 --- a/include/sys/sid.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SID_H -#define _SPL_SID_H - -typedef struct ksiddomain { - char *kd_name; -} ksiddomain_t; - -typedef enum ksid_index { - KSID_USER, - KSID_GROUP, - KSID_OWNER, - KSID_COUNT -} ksid_index_t; - -typedef int ksid_t; - -static inline ksiddomain_t * -ksid_lookupdomain(const char *dom) -{ - ksiddomain_t *kd; - int len = strlen(dom); - - kd = kmem_zalloc(sizeof (ksiddomain_t), KM_SLEEP); - kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP); - memcpy(kd->kd_name, dom, len); - - return (kd); -} - -static inline void -ksiddomain_rele(ksiddomain_t *ksid) -{ - kmem_free(ksid->kd_name, strlen(ksid->kd_name) + 1); - kmem_free(ksid, sizeof (ksiddomain_t)); -} - -#endif /* _SPL_SID_H */ diff --git a/include/sys/signal.h b/include/sys/signal.h deleted file mode 100644 index 36b8b5d98..000000000 --- a/include/sys/signal.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SIGNAL_H -#define _SPL_SIGNAL_H - -#include <linux/sched.h> - -#ifdef HAVE_SCHED_SIGNAL_HEADER -#include <linux/sched/signal.h> -#endif - -#define FORREAL 0 /* Usual side-effects */ -#define JUSTLOOKING 1 /* Don't stop the process */ - -/* - * The "why" argument indicates the allowable side-effects of the call: - * - * FORREAL: Extract the next pending signal from p_sig into p_cursig; - * stop the process if a stop has been requested or if a traced signal - * is pending. - * - * JUSTLOOKING: Don't stop the process, just indicate whether or not - * a signal might be pending (FORREAL is needed to tell for sure). - */ -static __inline__ int -issig(int why) -{ - ASSERT(why == FORREAL || why == JUSTLOOKING); - - return (signal_pending(current)); -} - -#endif /* SPL_SIGNAL_H */ diff --git a/include/sys/stat.h b/include/sys/stat.h deleted file mode 100644 index 83018e894..000000000 --- a/include/sys/stat.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_STAT_H -#define _SPL_STAT_H - -#include <linux/stat.h> - -#endif /* SPL_STAT_H */ diff --git a/include/sys/stropts.h b/include/sys/stropts.h deleted file mode 100644 index 746141fe8..000000000 --- a/include/sys/stropts.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_STROPTS_H -#define _SPL_STROPTS_H - -#endif /* SPL_STROPTS_H */ diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h deleted file mode 100644 index 1bae594c8..000000000 --- a/include/sys/sunddi.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SUNDDI_H -#define _SPL_SUNDDI_H - -#include <sys/cred.h> -#include <sys/uio.h> -#include <sys/sunldi.h> -#include <sys/mutex.h> -#include <sys/u8_textprep.h> -#include <sys/vnode.h> - -typedef int ddi_devid_t; - -#define DDI_DEV_T_NONE ((dev_t)-1) -#define DDI_DEV_T_ANY ((dev_t)-2) -#define DI_MAJOR_T_UNKNOWN ((major_t)0) - -#define DDI_PROP_DONTPASS 0x0001 -#define DDI_PROP_CANSLEEP 0x0002 - -#define DDI_SUCCESS 0 -#define DDI_FAILURE -1 - -#define ddi_prop_lookup_string(x1, x2, x3, x4, x5) (*x5 = NULL) -#define ddi_prop_free(x) (void)0 -#define ddi_root_node() (void)0 - -extern int ddi_strtoul(const char *, char **, int, unsigned long *); -extern int ddi_strtol(const char *, char **, int, long *); -extern int ddi_strtoull(const char *, char **, int, unsigned long long *); -extern int ddi_strtoll(const char *, char **, int, long long *); - -extern int ddi_copyin(const void *from, void *to, size_t len, int flags); -extern int ddi_copyout(const void *from, void *to, size_t len, int flags); - -#endif /* SPL_SUNDDI_H */ diff --git a/include/sys/sunldi.h b/include/sys/sunldi.h deleted file mode 100644 index a5045f891..000000000 --- a/include/sys/sunldi.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SUNLDI_H -#define _SPL_SUNLDI_H - -#include <sys/types.h> -#include <linux/fs.h> -#include <linux/genhd.h> -#include <linux/hdreg.h> -#include <linux/bio.h> -#include <linux/blkdev.h> - -/* - * SECTOR_SIZE can be defined in blkdev.h. See - * https://github.com/torvalds/linux/commit/233bde21. - */ -#ifndef SECTOR_SIZE -#define SECTOR_SIZE 512 -#endif - -#endif /* SPL_SUNLDI_H */ diff --git a/include/sys/sysdc.h b/include/sys/sysdc.h deleted file mode 100644 index d963774ac..000000000 --- a/include/sys/sysdc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SYSDC_H -#define _SPL_SYSDC_H - -#endif /* SPL_SYSDC_H */ diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h deleted file mode 100644 index d083cebda..000000000 --- a/include/sys/sysmacros.h +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SYSMACROS_H -#define _SPL_SYSMACROS_H - -#include <linux/module.h> -#include <linux/sched.h> -#include <linux/cpumask.h> -#include <sys/debug.h> -#include <sys/varargs.h> -#include <sys/zone.h> -#include <sys/signal.h> -#include <asm/page.h> - -#ifdef HAVE_SCHED_RT_HEADER -#include <linux/sched/rt.h> -#endif - -#ifndef _KERNEL -#define _KERNEL __KERNEL__ -#endif - -#define FALSE 0 -#define TRUE 1 - -#define INT8_MAX (127) -#define INT8_MIN (-128) -#define UINT8_MAX (255) -#define UINT8_MIN (0) - -#define INT16_MAX (32767) -#define INT16_MIN (-32768) -#define UINT16_MAX (65535) -#define UINT16_MIN (0) - -#define INT32_MAX INT_MAX -#define INT32_MIN INT_MIN -#define UINT32_MAX UINT_MAX -#define UINT32_MIN UINT_MIN - -#define INT64_MAX LLONG_MAX -#define INT64_MIN LLONG_MIN -#define UINT64_MAX ULLONG_MAX -#define UINT64_MIN ULLONG_MIN - -#define NBBY 8 -#define ENOTSUP EOPNOTSUPP - -#define MAXMSGLEN 256 -#define MAXNAMELEN 256 -#define MAXPATHLEN PATH_MAX -#define MAXOFFSET_T LLONG_MAX -#define MAXBSIZE 8192 -#define DEV_BSIZE 512 -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ - -#define proc_pageout NULL -#define curproc current -#define max_ncpus num_possible_cpus() -#define boot_ncpus num_online_cpus() -#define CPU_SEQID smp_processor_id() -#define _NOTE(x) -#define is_system_labeled() 0 - -#ifndef RLIM64_INFINITY -#define RLIM64_INFINITY (~0ULL) -#endif - -/* - * 0..MAX_PRIO-1: Process priority - * 0..MAX_RT_PRIO-1: RT priority tasks - * MAX_RT_PRIO..MAX_PRIO-1: SCHED_NORMAL tasks - * - * Treat shim tasks as SCHED_NORMAL tasks - */ -#define minclsyspri (MAX_PRIO-1) -#define maxclsyspri (MAX_RT_PRIO) -#define defclsyspri (DEFAULT_PRIO) - -#ifndef NICE_TO_PRIO -#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) -#endif -#ifndef PRIO_TO_NICE -#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) -#endif - -/* - * Missing macros - */ -#ifndef PAGESIZE -#define PAGESIZE PAGE_SIZE -#endif - -#ifndef PAGESHIFT -#define PAGESHIFT PAGE_SHIFT -#endif - -/* from Solaris sys/byteorder.h */ -#define BSWAP_8(x) ((x) & 0xff) -#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) -#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) -#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) - -/* - * Map some simple functions. - */ -#define bzero(ptr, size) memset(ptr, 0, size) -#define bcopy(src, dest, size) memmove(dest, src, size) -#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size)) - -/* Dtrace probes do not exist in the linux kernel */ -#ifdef DTRACE_PROBE -#undef DTRACE_PROBE -#endif /* DTRACE_PROBE */ -#define DTRACE_PROBE(a) ((void)0) - -#ifdef DTRACE_PROBE1 -#undef DTRACE_PROBE1 -#endif /* DTRACE_PROBE1 */ -#define DTRACE_PROBE1(a, b, c) ((void)0) - -#ifdef DTRACE_PROBE2 -#undef DTRACE_PROBE2 -#endif /* DTRACE_PROBE2 */ -#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) - -#ifdef DTRACE_PROBE3 -#undef DTRACE_PROBE3 -#endif /* DTRACE_PROBE3 */ -#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) - -#ifdef DTRACE_PROBE4 -#undef DTRACE_PROBE4 -#endif /* DTRACE_PROBE4 */ -#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) - -/* Missing globals */ -extern char spl_version[32]; -extern unsigned long spl_hostid; - -/* Missing misc functions */ -extern uint32_t zone_get_hostid(void *zone); -extern void spl_setup(void); -extern void spl_cleanup(void); - -#define highbit(x) __fls(x) -#define lowbit(x) __ffs(x) - -#define highbit64(x) fls64(x) -#define makedevice(maj, min) makedev(maj, min) - -/* common macros */ -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif -#ifndef MAX -#define MAX(a, b) ((a) < (b) ? (b) : (a)) -#endif -#ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) -#endif -#ifndef DIV_ROUND_UP -#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) -#endif -#ifndef roundup -#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#endif -#ifndef howmany -#define howmany(x, y) (((x) + ((y) - 1)) / (y)) -#endif - -/* - * Compatibility macros/typedefs needed for Solaris -> Linux port - */ -#define P2ALIGN(x, align) ((x) & -(align)) -#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) -#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) -#define P2PHASE(x, align) ((x) & ((align) - 1)) -#define P2NPHASE(x, align) (-(x) & ((align) - 1)) -#define ISP2(x) (((x) & ((x) - 1)) == 0) -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) -#define P2BOUNDARY(off, len, align) \ - (((off) ^ ((off) + (len) - 1)) > (align) - 1) - -/* - * Typed version of the P2* macros. These macros should be used to ensure - * that the result is correctly calculated based on the data type of (x), - * which is passed in as the last argument, regardless of the data - * type of the alignment. For example, if (x) is of type uint64_t, - * and we want to round it up to a page boundary using "PAGESIZE" as - * the alignment, we can do either - * - * P2ROUNDUP(x, (uint64_t)PAGESIZE) - * or - * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t) - */ -#define P2ALIGN_TYPED(x, align, type) \ - ((type)(x) & -(type)(align)) -#define P2PHASE_TYPED(x, align, type) \ - ((type)(x) & ((type)(align) - 1)) -#define P2NPHASE_TYPED(x, align, type) \ - (-(type)(x) & ((type)(align) - 1)) -#define P2ROUNDUP_TYPED(x, align, type) \ - ((((type)(x) - 1) | ((type)(align) - 1)) + 1) -#define P2END_TYPED(x, align, type) \ - (-(~(type)(x) & -(type)(align))) -#define P2PHASEUP_TYPED(x, align, phase, type) \ - ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) -#define P2CROSS_TYPED(x, y, align, type) \ - (((type)(x) ^ (type)(y)) > (type)(align) - 1) -#define P2SAMEHIGHBIT_TYPED(x, y, type) \ - (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) - -#if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof) - -/* avoid any possibility of clashing with <stddef.h> version */ - -#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) -#endif - -#endif /* _SPL_SYSMACROS_H */ diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h deleted file mode 100644 index 225569158..000000000 --- a/include/sys/systeminfo.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SYSTEMINFO_H -#define _SPL_SYSTEMINFO_H - -#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ - /* to hold a decimal or hex */ - /* hostid string */ - -/* Supplemental definitions for Linux. */ -#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */ -#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */ - -#endif /* SPL_SYSTEMINFO_H */ diff --git a/include/sys/systm.h b/include/sys/systm.h deleted file mode 100644 index 2420e7e9d..000000000 --- a/include/sys/systm.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_SYSTM_H -#define _SPL_SYSTM_H - -#include <sys/sunddi.h> - -typedef uintptr_t pc_t; - -#endif /* SPL_SYSTM_H */ diff --git a/include/sys/t_lock.h b/include/sys/t_lock.h deleted file mode 100644 index dcdfaeec5..000000000 --- a/include/sys/t_lock.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_T_LOCK_H -#define _SPL_T_LOCK_H - -#include <sys/param.h> -#include <sys/mutex.h> -#include <sys/rwlock.h> -#include <sys/condvar.h> - -#endif /* SPL_T_LOCK_H */ diff --git a/include/sys/taskq.h b/include/sys/taskq.h deleted file mode 100644 index 4d90a3563..000000000 --- a/include/sys/taskq.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_TASKQ_H -#define _SPL_TASKQ_H - -#include <linux/module.h> -#include <linux/gfp.h> -#include <linux/slab.h> -#include <linux/interrupt.h> -#include <linux/kthread.h> -#include <linux/wait_compat.h> -#include <sys/types.h> -#include <sys/thread.h> -#include <sys/rwlock.h> - -#define TASKQ_NAMELEN 31 - -#define TASKQ_PREPOPULATE 0x00000001 -#define TASKQ_CPR_SAFE 0x00000002 -#define TASKQ_DYNAMIC 0x00000004 -#define TASKQ_THREADS_CPU_PCT 0x00000008 -#define TASKQ_DC_BATCH 0x00000010 -#define TASKQ_ACTIVE 0x80000000 - -/* - * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as - * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly - * large so as not to conflict with already used GFP_* defines. - */ -#define TQ_SLEEP 0x00000000 -#define TQ_NOSLEEP 0x00000001 -#define TQ_PUSHPAGE 0x00000002 -#define TQ_NOQUEUE 0x01000000 -#define TQ_NOALLOC 0x02000000 -#define TQ_NEW 0x04000000 -#define TQ_FRONT 0x08000000 - -/* - * Reserved taskqid values. - */ -#define TASKQID_INVALID ((taskqid_t)0) -#define TASKQID_INITIAL ((taskqid_t)1) - -/* - * spin_lock(lock) and spin_lock_nested(lock,0) are equivalent, - * so TQ_LOCK_DYNAMIC must not evaluate to 0 - */ -typedef enum tq_lock_role { - TQ_LOCK_GENERAL = 0, - TQ_LOCK_DYNAMIC = 1, -} tq_lock_role_t; - -typedef unsigned long taskqid_t; -typedef void (task_func_t)(void *); - -typedef struct taskq { - spinlock_t tq_lock; /* protects taskq_t */ - char *tq_name; /* taskq name */ - int tq_instance; /* instance of tq_name */ - struct list_head tq_thread_list; /* list of all threads */ - struct list_head tq_active_list; /* list of active threads */ - int tq_nactive; /* # of active threads */ - int tq_nthreads; /* # of existing threads */ - int tq_nspawn; /* # of threads being spawned */ - int tq_maxthreads; /* # of threads maximum */ - int tq_pri; /* priority */ - int tq_minalloc; /* min taskq_ent_t pool size */ - int tq_maxalloc; /* max taskq_ent_t pool size */ - int tq_nalloc; /* cur taskq_ent_t pool size */ - uint_t tq_flags; /* flags */ - taskqid_t tq_next_id; /* next pend/work id */ - taskqid_t tq_lowest_id; /* lowest pend/work id */ - struct list_head tq_free_list; /* free taskq_ent_t's */ - struct list_head tq_pend_list; /* pending taskq_ent_t's */ - struct list_head tq_prio_list; /* priority taskq_ent_t's */ - struct list_head tq_delay_list; /* delayed taskq_ent_t's */ - struct list_head tq_taskqs; /* all taskq_t's */ - spl_wait_queue_head_t tq_work_waitq; /* new work waitq */ - spl_wait_queue_head_t tq_wait_waitq; /* wait waitq */ - tq_lock_role_t tq_lock_class; /* class when taking tq_lock */ -} taskq_t; - -typedef struct taskq_ent { - spinlock_t tqent_lock; - spl_wait_queue_head_t tqent_waitq; - struct timer_list tqent_timer; - struct list_head tqent_list; - taskqid_t tqent_id; - task_func_t *tqent_func; - void *tqent_arg; - taskq_t *tqent_taskq; - uintptr_t tqent_flags; - unsigned long tqent_birth; -} taskq_ent_t; - -#define TQENT_FLAG_PREALLOC 0x1 -#define TQENT_FLAG_CANCEL 0x2 - -typedef struct taskq_thread { - struct list_head tqt_thread_list; - struct list_head tqt_active_list; - struct task_struct *tqt_thread; - taskq_t *tqt_tq; - taskqid_t tqt_id; - taskq_ent_t *tqt_task; - uintptr_t tqt_flags; -} taskq_thread_t; - -/* Global system-wide dynamic task queue available for all consumers */ -extern taskq_t *system_taskq; -/* Global dynamic task queue for long delay */ -extern taskq_t *system_delay_taskq; - -/* List of all taskqs */ -extern struct list_head tq_list; -extern struct rw_semaphore tq_list_sem; - -extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); -extern taskqid_t taskq_dispatch_delay(taskq_t *, task_func_t, void *, - uint_t, clock_t); -extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, - taskq_ent_t *); -extern int taskq_empty_ent(taskq_ent_t *); -extern void taskq_init_ent(taskq_ent_t *); -extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); -extern void taskq_destroy(taskq_t *); -extern void taskq_wait_id(taskq_t *, taskqid_t); -extern void taskq_wait_outstanding(taskq_t *, taskqid_t); -extern void taskq_wait(taskq_t *); -extern int taskq_cancel_id(taskq_t *, taskqid_t); -extern int taskq_member(taskq_t *, kthread_t *); - -#define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ - taskq_create(name, nthreads, pri, min, max, flags) -#define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \ - taskq_create(name, nthreads, maxclsyspri, min, max, flags) - -int spl_taskq_init(void); -void spl_taskq_fini(void); - -#endif /* _SPL_TASKQ_H */ diff --git a/include/sys/thread.h b/include/sys/thread.h deleted file mode 100644 index 80cf49914..000000000 --- a/include/sys/thread.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_THREAD_H -#define _SPL_THREAD_H - -#include <linux/module.h> -#include <linux/mm.h> -#include <linux/spinlock.h> -#include <linux/kthread.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/tsd.h> - -/* - * Thread interfaces - */ -#define TP_MAGIC 0x53535353 - -#define TS_SLEEP TASK_INTERRUPTIBLE -#define TS_RUN TASK_RUNNING -#define TS_ZOMB EXIT_ZOMBIE -#define TS_STOPPED TASK_STOPPED - -typedef void (*thread_func_t)(void *); - -/* BEGIN CSTYLED */ -#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ - __thread_create(stk, stksize, (thread_func_t)func, \ - #func, arg, len, pp, state, pri) -/* END CSTYLED */ - -#define thread_exit() __thread_exit() -#define thread_join(t) VERIFY(0) -#define curthread current -#define getcomm() current->comm -#define getpid() current->pid - -extern kthread_t *__thread_create(caddr_t stk, size_t stksize, - thread_func_t func, const char *name, void *args, size_t len, proc_t *pp, - int state, pri_t pri); -extern void __thread_exit(void); -extern struct task_struct *spl_kthread_create(int (*func)(void *), - void *data, const char namefmt[], ...); - -#endif /* _SPL_THREAD_H */ diff --git a/include/sys/time.h b/include/sys/time.h deleted file mode 100644 index d6aaca913..000000000 --- a/include/sys/time.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_TIME_H -#define _SPL_TIME_H - -#include <linux/module.h> -#include <linux/time.h> -#include <sys/types.h> -#include <sys/timer.h> - -#if defined(CONFIG_64BIT) -#define TIME_MAX INT64_MAX -#define TIME_MIN INT64_MIN -#else -#define TIME_MAX INT32_MAX -#define TIME_MIN INT32_MIN -#endif - -#define SEC 1 -#define MILLISEC 1000 -#define MICROSEC 1000000 -#define NANOSEC 1000000000 - -#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC)) -#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC)) - -#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC)) -#define NSEC2USEC(n) ((n) / (NANOSEC / MICROSEC)) - -#define NSEC2SEC(n) ((n) / (NANOSEC / SEC)) -#define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC)) - -static const int hz = HZ; - -#define TIMESPEC_OVERFLOW(ts) \ - ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX) - -static inline void -gethrestime(timestruc_t *now) -{ - *now = current_kernel_time(); -} - -static inline time_t -gethrestime_sec(void) -{ - struct timespec ts; - ts = current_kernel_time(); - return (ts.tv_sec); -} - -static inline hrtime_t -gethrtime(void) -{ - struct timespec now; - getrawmonotonic(&now); - return (((hrtime_t)now.tv_sec * NSEC_PER_SEC) + now.tv_nsec); -} - -#endif /* _SPL_TIME_H */ diff --git a/include/sys/timer.h b/include/sys/timer.h deleted file mode 100644 index 821590e3a..000000000 --- a/include/sys/timer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_TIMER_H -#define _SPL_TIMER_H - -#include <linux/module.h> -#include <linux/sched.h> -#include <linux/timer.h> - -#define lbolt ((clock_t)jiffies) -#define lbolt64 ((int64_t)get_jiffies_64()) - -#define ddi_get_lbolt() ((clock_t)jiffies) -#define ddi_get_lbolt64() ((int64_t)get_jiffies_64()) - -#define ddi_time_before(a, b) (typecheck(clock_t, a) && \ - typecheck(clock_t, b) && \ - ((a) - (b) < 0)) -#define ddi_time_after(a, b) ddi_time_before(b, a) -#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b)) -#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a) - -#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \ - typecheck(int64_t, b) && \ - ((a) - (b) < 0)) -#define ddi_time_after64(a, b) ddi_time_before64(b, a) -#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b)) -#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a) - -#define delay(ticks) schedule_timeout_uninterruptible(ticks) - -#define SEC_TO_TICK(sec) ((sec) * HZ) -#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) -#define USEC_TO_TICK(us) usecs_to_jiffies(us) -#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC) - -#endif /* _SPL_TIMER_H */ diff --git a/include/sys/tsd.h b/include/sys/tsd.h deleted file mode 100644 index 39a291bf3..000000000 --- a/include/sys/tsd.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_TSD_H -#define _SPL_TSD_H - -#include <sys/types.h> - -#define TSD_HASH_TABLE_BITS_DEFAULT 9 -#define TSD_KEYS_MAX 32768 -#define DTOR_PID (PID_MAX_LIMIT+1) -#define PID_KEY (TSD_KEYS_MAX+1) - -typedef void (*dtor_func_t)(void *); - -extern int tsd_set(uint_t, void *); -extern void *tsd_get(uint_t); -extern void *tsd_get_by_thread(uint_t, kthread_t *); -extern void tsd_create(uint_t *, dtor_func_t); -extern void tsd_destroy(uint_t *); -extern void tsd_exit(void); - -int spl_tsd_init(void); -void spl_tsd_fini(void); - -#endif /* _SPL_TSD_H */ diff --git a/include/sys/types.h b/include/sys/types.h deleted file mode 100644 index e159dda21..000000000 --- a/include/sys/types.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_TYPES_H -#define _SPL_TYPES_H - -#include <linux/types.h> -#include <sys/sysmacros.h> - -#ifndef ULLONG_MAX -#define ULLONG_MAX (~0ULL) -#endif - -#ifndef LLONG_MAX -#define LLONG_MAX ((long long)(~0ULL>>1)) -#endif - -typedef enum { B_FALSE = 0, B_TRUE = 1 } boolean_t; -typedef unsigned long intptr_t; -typedef unsigned long ulong_t; -typedef unsigned int uint_t; -typedef unsigned char uchar_t; -typedef unsigned long long u_longlong_t; -typedef unsigned long long u_offset_t; -typedef unsigned long long rlim64_t; -typedef long long longlong_t; -typedef long long offset_t; -typedef struct task_struct kthread_t; -typedef struct task_struct proc_t; -typedef short pri_t; -typedef struct timespec timestruc_t; /* definition per SVr4 */ -typedef struct timespec timespec_t; -typedef longlong_t hrtime_t; -typedef unsigned short ushort_t; -typedef u_longlong_t len_t; -typedef longlong_t diskaddr_t; -typedef ushort_t o_mode_t; -typedef uint_t major_t; -typedef uint_t minor_t; -typedef ulong_t pgcnt_t; -typedef long spgcnt_t; -typedef short index_t; -typedef int id_t; - -extern proc_t p0; - -#endif /* _SPL_TYPES_H */ diff --git a/include/sys/types32.h b/include/sys/types32.h deleted file mode 100644 index 1b05b2a47..000000000 --- a/include/sys/types32.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_TYPES32_H -#define _SPL_TYPES32_H - -#include <sys/int_types.h> -#include <sys/types.h> - -typedef uint32_t caddr32_t; -typedef int32_t daddr32_t; -typedef int32_t time32_t; -typedef uint32_t size32_t; - -#endif /* _SPL_TYPES32_H */ diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h deleted file mode 100644 index 6e76651d5..000000000 --- a/include/sys/u8_textprep.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_U8_TEXTPREP_H -#define _SPL_U8_TEXTPREP_H - -#endif /* SPL_U8_TEXTPREP_H */ diff --git a/include/sys/uio.h b/include/sys/uio.h deleted file mode 100644 index 64c452b8d..000000000 --- a/include/sys/uio.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Copyright (c) 2015 by Chunwei Chen. All rights reserved. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_UIO_H -#define _SPL_UIO_H - -#include <linux/uio.h> -#include <linux/blkdev.h> -#include <asm/uaccess.h> -#include <sys/types.h> - -typedef struct iovec iovec_t; - -typedef enum uio_rw { - UIO_READ = 0, - UIO_WRITE = 1, -} uio_rw_t; - -typedef enum uio_seg { - UIO_USERSPACE = 0, - UIO_SYSSPACE = 1, - UIO_USERISPACE = 2, - UIO_BVEC = 3, -} uio_seg_t; - -typedef struct uio { - union { - const struct iovec *uio_iov; - const struct bio_vec *uio_bvec; - }; - int uio_iovcnt; - offset_t uio_loffset; - uio_seg_t uio_segflg; - uint16_t uio_fmode; - uint16_t uio_extflg; - offset_t uio_limit; - ssize_t uio_resid; - size_t uio_skip; -} uio_t; - -typedef struct aio_req { - uio_t *aio_uio; - void *aio_private; -} aio_req_t; - -typedef enum xuio_type { - UIOTYPE_ASYNCIO, - UIOTYPE_ZEROCOPY, -} xuio_type_t; - - -#define UIOA_IOV_MAX 16 - -typedef struct uioa_page_s { - int uioa_pfncnt; - void **uioa_ppp; - caddr_t uioa_base; - size_t uioa_len; -} uioa_page_t; - -typedef struct xuio { - uio_t xu_uio; - enum xuio_type xu_type; - union { - struct { - uint32_t xu_a_state; - ssize_t xu_a_mbytes; - uioa_page_t *xu_a_lcur; - void **xu_a_lppp; - void *xu_a_hwst[4]; - uioa_page_t xu_a_locked[UIOA_IOV_MAX]; - } xu_aio; - - struct { - int xu_zc_rw; - void *xu_zc_priv; - } xu_zc; - } xu_ext; -} xuio_t; - -#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv -#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw - -#endif /* SPL_UIO_H */ diff --git a/include/sys/unistd.h b/include/sys/unistd.h deleted file mode 100644 index d86de891c..000000000 --- a/include/sys/unistd.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_UNISTD_H -#define _SPL_UNISTD_H - -#endif /* SPL_UNISTD_H */ diff --git a/include/sys/user.h b/include/sys/user.h deleted file mode 100644 index b12cb240e..000000000 --- a/include/sys/user.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2015 Cluster Inc. - * Produced at ClusterHQ Inc (cf, DISCLAIMER). - * Written by Richard Yao <[email protected]>. - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_USER_H -#define _SPL_USER_H - -/* - * We have uf_info_t for areleasef(). We implement areleasef() using a global - * linked list of all open file descriptors with the task structs referenced, - * so accessing the correct descriptor from areleasef() only requires knowing - * about the Linux task_struct. Since this is internal to our compatibility - * layer, we make it an opaque type. - * - * XXX: If the descriptor changes under us and we do not do a getf() between - * the change and using it, we would get an incorrect reference. - */ - -struct uf_info; -typedef struct uf_info uf_info_t; - -#define P_FINFO(x) ((uf_info_t *)x) - -#endif /* SPL_USER_H */ diff --git a/include/sys/va_list.h b/include/sys/va_list.h deleted file mode 100644 index 62d18b9ae..000000000 --- a/include/sys/va_list.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_VA_LIST_H -#define _SPL_VA_LIST_H - -#endif /* SPL_VA_LIST_H */ diff --git a/include/sys/varargs.h b/include/sys/varargs.h deleted file mode 100644 index cdb73fbbd..000000000 --- a/include/sys/varargs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_VARARGS_H -#define _SPL_VARARGS_H - -#define __va_list va_list - -#endif /* SPL_VARARGS_H */ diff --git a/include/sys/vfs.h b/include/sys/vfs.h deleted file mode 100644 index 0d5e1d51d..000000000 --- a/include/sys/vfs.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ZFS_H -#define _SPL_ZFS_H - -#include <linux/mount.h> -#include <linux/fs.h> -#include <linux/dcache.h> -#include <linux/statfs.h> -#include <linux/xattr.h> -#include <linux/security.h> -#include <linux/seq_file.h> - -#define MAXFIDSZ 64 - -typedef struct spl_fid { - union { - long fid_pad; - struct { - ushort_t len; /* length of data in bytes */ - char data[MAXFIDSZ]; /* data (variable len) */ - } _fid; - } un; -} fid_t; - -#define fid_len un._fid.len -#define fid_data un._fid.data - -#endif /* SPL_ZFS_H */ diff --git a/include/sys/vfs_opreg.h b/include/sys/vfs_opreg.h deleted file mode 100644 index 1d48f2d5a..000000000 --- a/include/sys/vfs_opreg.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_OPREG_H -#define _SPL_OPREG_H - -#endif /* SPL_OPREG_H */ diff --git a/include/sys/vmem.h b/include/sys/vmem.h deleted file mode 100644 index a9b12eeb9..000000000 --- a/include/sys/vmem.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_VMEM_H -#define _SPL_VMEM_H - -#include <sys/kmem.h> -#include <linux/sched.h> -#include <linux/vmalloc.h> - -typedef struct vmem { } vmem_t; - -extern vmem_t *heap_arena; -extern vmem_t *zio_alloc_arena; -extern vmem_t *zio_arena; - -extern size_t vmem_size(vmem_t *vmp, int typemask); - -/* - * Memory allocation interfaces - */ -#define VMEM_ALLOC 0x01 -#define VMEM_FREE 0x02 - -#ifndef VMALLOC_TOTAL -#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) -#endif - -/* - * vmem_* is an interface to a low level arena-based memory allocator on - * Illumos that is used to allocate virtual address space. The kmem SLAB - * allocator allocates slabs from it. Then the generic allocation functions - * kmem_{alloc,zalloc,free}() are layered on top of SLAB allocators. - * - * On Linux, the primary means of doing allocations is via kmalloc(), which - * is similarly layered on top of something called the buddy allocator. The - * buddy allocator is not available to kernel modules, it uses physical - * memory addresses rather than virtual memory addresses and is prone to - * fragmentation. - * - * Linux sets aside a relatively small address space for in-kernel virtual - * memory from which allocations can be done using vmalloc(). It might seem - * like a good idea to use vmalloc() to implement something similar to - * Illumos' allocator. However, this has the following problems: - * - * 1. Page directory table allocations are hard coded to use GFP_KERNEL. - * Consequently, any KM_PUSHPAGE or KM_NOSLEEP allocations done using - * vmalloc() will not have proper semantics. - * - * 2. Address space exhaustion is a real issue on 32-bit platforms where - * only a few 100MB are available. The kernel will handle it by spinning - * when it runs out of address space. - * - * 3. All vmalloc() allocations and frees are protected by a single global - * lock which serializes all allocations. - * - * 4. Accessing /proc/meminfo and /proc/vmallocinfo will iterate the entire - * list. The former will sum the allocations while the latter will print - * them to user space in a way that user space can keep the lock held - * indefinitely. When the total number of mapped allocations is large - * (several 100,000) a large amount of time will be spent waiting on locks. - * - * 5. Linux has a wait_on_bit() locking primitive that assumes physical - * memory is used, it simply does not work on virtual memory. Certain - * Linux structures (e.g. the superblock) use them and might be embedded - * into a structure from Illumos. This makes using Linux virtual memory - * unsafe in certain situations. - * - * It follows that we cannot obtain identical semantics to those on Illumos. - * Consequently, we implement the kmem_{alloc,zalloc,free}() functions in - * such a way that they can be used as drop-in replacements for small vmem_* - * allocations (8MB in size or smaller) and map vmem_{alloc,zalloc,free}() - * to them. - */ - -#define vmem_alloc(sz, fl) spl_vmem_alloc((sz), (fl), __func__, __LINE__) -#define vmem_zalloc(sz, fl) spl_vmem_zalloc((sz), (fl), __func__, __LINE__) -#define vmem_free(ptr, sz) spl_vmem_free((ptr), (sz)) -#define vmem_qcache_reap(ptr) ((void)0) - -extern void *spl_vmem_alloc(size_t sz, int fl, const char *func, int line); -extern void *spl_vmem_zalloc(size_t sz, int fl, const char *func, int line); -extern void spl_vmem_free(const void *ptr, size_t sz); - -int spl_vmem_init(void); -void spl_vmem_fini(void); - -#endif /* _SPL_VMEM_H */ diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h deleted file mode 100644 index 2b48fe0e3..000000000 --- a/include/sys/vmsystm.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_VMSYSTM_H -#define _SPL_VMSYSTM_H - -#include <linux/mmzone.h> -#include <linux/mm.h> -#include <linux/swap.h> -#include <linux/highmem.h> -#include <linux/vmalloc.h> -#include <sys/types.h> -#include <asm/uaccess.h> - -#define membar_producer() smp_wmb() -#define physmem totalram_pages -#define freemem (nr_free_pages() + \ - global_page_state(NR_INACTIVE_FILE) + \ - global_page_state(NR_INACTIVE_ANON) + \ - global_page_state(NR_SLAB_RECLAIMABLE)) - -#define xcopyin(from, to, size) copy_from_user(to, from, size) -#define xcopyout(from, to, size) copy_to_user(to, from, size) - -static __inline__ int -copyin(const void *from, void *to, size_t len) -{ - /* On error copyin routine returns -1 */ - if (xcopyin(from, to, len)) - return (-1); - - return (0); -} - -static __inline__ int -copyout(const void *from, void *to, size_t len) -{ - /* On error copyout routine returns -1 */ - if (xcopyout(from, to, len)) - return (-1); - - return (0); -} - -static __inline__ int -copyinstr(const void *from, void *to, size_t len, size_t *done) -{ - size_t rc; - - if (len == 0) - return (-ENAMETOOLONG); - - /* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */ - - memset(to, 0, len); - rc = copyin(from, to, len - 1); - if (done != NULL) - *done = rc; - - return (0); -} - -#endif /* SPL_VMSYSTM_H */ diff --git a/include/sys/vnode.h b/include/sys/vnode.h deleted file mode 100644 index 946654b7b..000000000 --- a/include/sys/vnode.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_VNODE_H -#define _SPL_VNODE_H - -#include <linux/module.h> -#include <linux/syscalls.h> -#include <linux/fcntl.h> -#include <linux/buffer_head.h> -#include <linux/dcache.h> -#include <linux/namei.h> -#include <linux/file.h> -#include <linux/fs.h> -#include <linux/fs_struct.h> -#include <linux/mount.h> -#include <sys/kmem.h> -#include <sys/mutex.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/uio.h> -#include <sys/user.h> -#include <sys/sunldi.h> - -/* - * Prior to linux-2.6.33 only O_DSYNC semantics were implemented and - * they used the O_SYNC flag. As of linux-2.6.33 the this behavior - * was properly split in to O_SYNC and O_DSYNC respectively. - */ -#ifndef O_DSYNC -#define O_DSYNC O_SYNC -#endif - -#define FREAD 1 -#define FWRITE 2 -#define FCREAT O_CREAT -#define FTRUNC O_TRUNC -#define FOFFMAX O_LARGEFILE -#define FSYNC O_SYNC -#define FDSYNC O_DSYNC -#define FRSYNC O_SYNC -#define FEXCL O_EXCL -#define FDIRECT O_DIRECT -#define FAPPEND O_APPEND - -#define FNODSYNC 0x10000 /* fsync pseudo flag */ -#define FNOFOLLOW 0x20000 /* don't follow symlinks */ - -#define F_FREESP 11 /* Free file space */ - - -/* - * The vnode AT_ flags are mapped to the Linux ATTR_* flags. - * This allows them to be used safely with an iattr structure. - * The AT_XVATTR flag has been added and mapped to the upper - * bit range to avoid conflicting with the standard Linux set. - */ -#undef AT_UID -#undef AT_GID - -#define AT_MODE ATTR_MODE -#define AT_UID ATTR_UID -#define AT_GID ATTR_GID -#define AT_SIZE ATTR_SIZE -#define AT_ATIME ATTR_ATIME -#define AT_MTIME ATTR_MTIME -#define AT_CTIME ATTR_CTIME - -#define ATTR_XVATTR (1 << 31) -#define AT_XVATTR ATTR_XVATTR - -#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \ - ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_FILE) - -#define CRCREAT 0x01 -#define RMFILE 0x02 - -#define B_INVAL 0x01 -#define B_TRUNC 0x02 - -#define LOOKUP_DIR 0x01 -#define LOOKUP_XATTR 0x02 -#define CREATE_XATTR_DIR 0x04 -#define ATTR_NOACLCHECK 0x20 - -typedef enum vtype { - VNON = 0, - VREG = 1, - VDIR = 2, - VBLK = 3, - VCHR = 4, - VLNK = 5, - VFIFO = 6, - VDOOR = 7, - VPROC = 8, - VSOCK = 9, - VPORT = 10, - VBAD = 11 -} vtype_t; - -typedef struct vattr { - enum vtype va_type; /* vnode type */ - uint_t va_mask; /* attribute bit-mask */ - ushort_t va_mode; /* acc mode */ - uid_t va_uid; /* owner uid */ - gid_t va_gid; /* owner gid */ - long va_fsid; /* fs id */ - long va_nodeid; /* node # */ - uint32_t va_nlink; /* # links */ - uint64_t va_size; /* file size */ - struct timespec va_atime; /* last acc */ - struct timespec va_mtime; /* last mod */ - struct timespec va_ctime; /* last chg */ - dev_t va_rdev; /* dev */ - uint64_t va_nblocks; /* space used */ - uint32_t va_blksize; /* block size */ - uint32_t va_seq; /* sequence */ - struct dentry *va_dentry; /* dentry to wire */ -} vattr_t; - -typedef struct vnode { - struct file *v_file; - kmutex_t v_lock; /* protects vnode fields */ - uint_t v_flag; /* vnode flags (see below) */ - uint_t v_count; /* reference count */ - void *v_data; /* private data for fs */ - struct vfs *v_vfsp; /* ptr to containing VFS */ - struct stdata *v_stream; /* associated stream */ - enum vtype v_type; /* vnode type */ - dev_t v_rdev; /* device (VCHR, VBLK) */ - gfp_t v_gfp_mask; /* original mapping gfp mask */ -} vnode_t; - -typedef struct vn_file { - int f_fd; /* linux fd for lookup */ - struct task_struct *f_task; /* linux task this fd belongs to */ - struct file *f_file; /* linux file struct */ - atomic_t f_ref; /* ref count */ - kmutex_t f_lock; /* struct lock */ - loff_t f_offset; /* offset */ - vnode_t *f_vnode; /* vnode */ - struct list_head f_list; /* list referenced file_t's */ -} file_t; - -extern vnode_t *vn_alloc(int flag); -void vn_free(vnode_t *vp); -extern vtype_t vn_mode_to_vtype(mode_t); -extern mode_t vn_vtype_to_mode(vtype_t); -extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode, - vnode_t **vpp, int x1, void *x2); -extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode, - vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd); -extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, - offset_t off, uio_seg_t seg, int x1, rlim64_t x2, - void *x3, ssize_t *residp); -extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4); -extern int vn_seek(vnode_t *vp, offset_t o, offset_t *op, void *ct); - -extern int vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4); -extern int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4); -extern int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag, - offset_t offset, void *x6, void *x7); -extern file_t *vn_getf(int fd); -extern void vn_releasef(int fd); -extern void vn_areleasef(int fd, uf_info_t *fip); -extern int vn_set_pwd(const char *filename); - -int spl_vn_init(void); -void spl_vn_fini(void); - -#define VOP_CLOSE vn_close -#define VOP_SEEK vn_seek -#define VOP_GETATTR vn_getattr -#define VOP_FSYNC vn_fsync -#define VOP_SPACE vn_space -#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0) -#define vn_is_readonly(vp) 0 -#define getf vn_getf -#define releasef vn_releasef -#define areleasef vn_areleasef - -extern vnode_t *rootdir; - -#endif /* SPL_VNODE_H */ diff --git a/include/sys/zmod.h b/include/sys/zmod.h deleted file mode 100644 index 5380bd6fd..000000000 --- a/include/sys/zmod.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - * - * - * z_compress_level/z_uncompress are nearly identical copies of the - * compress2/uncompress functions provided by the official zlib package - * available at http://zlib.net/. The only changes made we to slightly - * adapt the functions called to match the linux kernel implementation - * of zlib. The full zlib license follows: - * - * zlib.h -- interface of the 'zlib' general purpose compression library - * version 1.2.5, April 19th, 2010 - * - * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - * Jean-loup Gailly - * Mark Adler - */ - -#ifndef _SPL_ZMOD_H -#define _SPL_ZMOD_H - -#include <sys/types.h> -#include <linux/zlib.h> - -extern int z_compress_level(void *dest, size_t *destLen, const void *source, - size_t sourceLen, int level); -extern int z_uncompress(void *dest, size_t *destLen, const void *source, - size_t sourceLen); - -int spl_zlib_init(void); -void spl_zlib_fini(void); - -#endif /* SPL_ZMOD_H */ diff --git a/include/sys/zone.h b/include/sys/zone.h deleted file mode 100644 index b2efd13b8..000000000 --- a/include/sys/zone.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _SPL_ZONE_H -#define _SPL_ZONE_H - -#include <sys/byteorder.h> - -#define GLOBAL_ZONEID 0 - -#define zone_dataset_visible(x, y) (1) -#define crgetzoneid(x) (GLOBAL_ZONEID) -#define INGLOBALZONE(z) (1) - -#endif /* SPL_ZONE_H */ |