diff --git a/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c b/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c index ffae0493736c..1c9c2aebb099 100644 --- a/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c +++ b/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c @@ -77,7 +77,9 @@ #ifdef _KERNEL #include +#ifndef __NetBSD__ #include +#endif #include #endif /* _KERNEL */ diff --git a/external/cddl/osnet/dist/uts/common/sys/bitmap.h b/external/cddl/osnet/dist/uts/common/sys/bitmap.h index 8d7054954d06..9edcf7b935ce 100644 --- a/external/cddl/osnet/dist/uts/common/sys/bitmap.h +++ b/external/cddl/osnet/dist/uts/common/sys/bitmap.h @@ -126,6 +126,12 @@ extern "C" { #endif /* _LP64 */ +#ifdef __NetBSD__ + +#include + +#else /*__NetBSD__ */ + /* * BIT_ONLYONESET is a private macro not designed for bitmaps of * arbitrary size. u must be an unsigned integer/long. It returns @@ -190,6 +196,9 @@ extern int odd_parity(ulong_t); #endif /* _KERNEL && !_ASM */ +#endif /*__NetBSD__ */ + + #ifdef __cplusplus } #endif diff --git a/external/cddl/osnet/dist/uts/common/sys/callb.h b/external/cddl/osnet/dist/uts/common/sys/callb.h index 43f14ebb369d..45461b25a475 100644 --- a/external/cddl/osnet/dist/uts/common/sys/callb.h +++ b/external/cddl/osnet/dist/uts/common/sys/callb.h @@ -130,6 +130,17 @@ typedef struct callb_cpr { * Note: lockp is the lock to protect the callb_cpr_t (cp) structure * later on. No lock held is needed for this initialization. */ +#ifdef __NetBSD__ +#define CALLB_CPR_INIT(cp, lockp, func, name) { \ + /* XXXNETBSD set thread name */ \ + bzero((caddr_t)(cp), sizeof (callb_cpr_t)); \ + (cp)->cc_lockp = lockp; \ + (cp)->cc_id = callb_add(func, (void *)(cp), \ + CB_CL_CPR_DAEMON, name); \ + cv_init(&(cp)->cc_callb_cv, NULL, CV_DEFAULT, NULL); \ + cv_init(&(cp)->cc_stop_cv, NULL, CV_DEFAULT, NULL); \ + } +#else #define CALLB_CPR_INIT(cp, lockp, func, name) { \ strlcpy(curthread->td_name, (name), \ sizeof(curthread->td_name)); \ @@ -140,6 +151,7 @@ typedef struct callb_cpr { cv_init(&(cp)->cc_callb_cv, NULL, CV_DEFAULT, NULL); \ cv_init(&(cp)->cc_stop_cv, NULL, CV_DEFAULT, NULL); \ } +#endif #ifndef __lock_lint #define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); @@ -206,6 +218,10 @@ extern boolean_t callb_generic_cpr_safe(void *, int); extern boolean_t callb_is_stopped(kthread_id_t, caddr_t *); extern void callb_lock_table(void); extern void callb_unlock_table(void); +#ifdef __NetBSD__ +extern void callb_init(void *); +extern void callb_fini(void *); +#endif #endif #ifdef __cplusplus diff --git a/external/cddl/osnet/sys/sys/bitmap.h b/external/cddl/osnet/sys/sys/bitmap.h deleted file mode 100644 index 9b6e9196ab44..000000000000 --- a/external/cddl/osnet/sys/sys/bitmap.h +++ /dev/null @@ -1,118 +0,0 @@ -/* $NetBSD: bitmap.h,v 1.3 2010/02/21 01:46:35 darran Exp $ */ - -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#ifndef _COMPAT_OPENSOLARIS_SYS_BITMAP_H -#define _COMPAT_OPENSOLARIS_SYS_BITMAP_H - -#include - -/* - * Operations on bitmaps of arbitrary size - * A bitmap is a vector of 1 or more ulong_t's. - * The user of the package is responsible for range checks and keeping - * track of sizes. - */ - -#ifdef _LP64 -#define BT_ULSHIFT 6 /* log base 2 of BT_NBIPUL, to extract word index */ -#define BT_ULSHIFT32 5 /* log base 2 of BT_NBIPUL, to extract word index */ -#else -#define BT_ULSHIFT 5 /* log base 2 of BT_NBIPUL, to extract word index */ -#endif - -#define BT_NBIPUL (1 << BT_ULSHIFT) /* n bits per ulong_t */ -#define BT_ULMASK (BT_NBIPUL - 1) /* to extract bit index */ - -#ifdef _LP64 -#define BT_NBIPUL32 (1 << BT_ULSHIFT32) /* n bits per ulong_t */ -#define BT_ULMASK32 (BT_NBIPUL32 - 1) /* to extract bit index */ -#define BT_ULMAXMASK 0xffffffffffffffff /* used by bt_getlowbit */ -#else -#define BT_ULMAXMASK 0xffffffff -#endif - -/* - * bitmap is a ulong_t *, bitindex an index_t - * - * The macros BT_WIM and BT_BIW internal; there is no need - * for users of this package to use them. - */ - -/* - * word in map - */ -#define BT_WIM(bitmap, bitindex) \ - ((bitmap)[(bitindex) >> BT_ULSHIFT]) -/* - * bit in word - */ -#define BT_BIW(bitindex) \ - (1UL << ((bitindex) & BT_ULMASK)) - -#ifdef _LP64 -#define BT_WIM32(bitmap, bitindex) \ - ((bitmap)[(bitindex) >> BT_ULSHIFT32]) - -#define BT_BIW32(bitindex) \ - (1UL << ((bitindex) & BT_ULMASK32)) -#endif - -/* - * These are public macros - * - * BT_BITOUL == n bits to n ulong_t's - */ -#define BT_BITOUL(nbits) \ - (((nbits) + BT_NBIPUL - 1l) / BT_NBIPUL) -#define BT_SIZEOFMAP(nbits) \ - (BT_BITOUL(nbits) * sizeof (ulong_t)) -#define BT_TEST(bitmap, bitindex) \ - ((BT_WIM((bitmap), (bitindex)) & BT_BIW(bitindex)) ? 1 : 0) -#define BT_SET(bitmap, bitindex) \ - { BT_WIM((bitmap), (bitindex)) |= BT_BIW(bitindex); } -#define BT_CLEAR(bitmap, bitindex) \ - { BT_WIM((bitmap), (bitindex)) &= ~BT_BIW(bitindex); } - -#ifdef _LP64 -#define BT_BITOUL32(nbits) \ - (((nbits) + BT_NBIPUL32 - 1l) / BT_NBIPUL32) -#define BT_SIZEOFMAP32(nbits) \ - (BT_BITOUL32(nbits) * sizeof (uint_t)) -#define BT_TEST32(bitmap, bitindex) \ - ((BT_WIM32((bitmap), (bitindex)) & BT_BIW32(bitindex)) ? 1 : 0) -#define BT_SET32(bitmap, bitindex) \ - { BT_WIM32((bitmap), (bitindex)) |= BT_BIW32(bitindex); } -#define BT_CLEAR32(bitmap, bitindex) \ - { BT_WIM32((bitmap), (bitindex)) &= ~BT_BIW32(bitindex); } -#endif /* _LP64 */ - -#endif /* _COMPAT_OPENSOLARIS_SYS_BITMAP_H */ diff --git a/external/cddl/osnet/sys/sys/callb.h b/external/cddl/osnet/sys/sys/callb.h deleted file mode 100644 index 0e93d1afa80f..000000000000 --- a/external/cddl/osnet/sys/sys/callb.h +++ /dev/null @@ -1,219 +0,0 @@ -/* $NetBSD: callb.h,v 1.2 2018/05/28 21:05:10 chs Exp $ */ - -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_CALLB_H -#define _SYS_CALLB_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * definitions of callback classes (c_class) - * - * Callbacks belong in the same class if (1) their callback routines - * do the same kind of processing (ideally, using the same callback function) - * and (2) they can/should be executed at the same time in a cpr - * suspend/resume operation. - * - * Note: The DAEMON class, in particular, is for stopping kernel threads - * and nothing else. The CALLB_* macros below should be used to deal - * with kernel threads, and the callback function should be callb_generic_cpr. - * Another idiosyncrasy of the DAEMON class is that if a suspend operation - * fails, some of the callback functions may be called with the RESUME - * code which were never called with SUSPEND. Not a problem currently, - * but see bug 4201851. - */ -#define CB_CL_CPR_DAEMON 0 -#define CB_CL_CPR_VM 1 -#define CB_CL_CPR_CALLOUT 2 -#define CB_CL_CPR_OBP 3 -#define CB_CL_CPR_FB 4 -#define CB_CL_PANIC 5 -#define CB_CL_CPR_RPC 6 -#define CB_CL_CPR_PROMPRINTF 7 -#define CB_CL_UADMIN 8 -#define CB_CL_CPR_PM 9 -#define CB_CL_HALT 10 -#define CB_CL_CPR_DMA 11 -#define CB_CL_CPR_POST_USER 12 -#define CB_CL_UADMIN_PRE_VFS 13 -#define CB_CL_MDBOOT CB_CL_UADMIN -#define CB_CL_ENTER_DEBUGGER 14 -#define CB_CL_CPR_POST_KERNEL 15 -#define CB_CL_CPU_DEEP_IDLE 16 -#define NCBCLASS 17 /* CHANGE ME if classes are added/removed */ - -/* - * CB_CL_CPR_DAEMON class specific definitions are given below: - */ - -/* - * code for CPR callb_execute_class - */ -#define CB_CODE_CPR_CHKPT 0 -#define CB_CODE_CPR_RESUME 1 - -typedef void * callb_id_t; -/* - * Per kernel thread structure for CPR daemon callbacks. - * Must be protected by either a existing lock in the daemon or - * a new lock created for such a purpose. - */ -typedef struct callb_cpr { - kmutex_t *cc_lockp; /* lock to protect this struct */ - char cc_events; /* various events for CPR */ - callb_id_t cc_id; /* callb id address */ - kcondvar_t cc_callb_cv; /* cv for callback waiting */ - kcondvar_t cc_stop_cv; /* cv to checkpoint block */ -} callb_cpr_t; - -/* - * cc_events definitions - */ -#define CALLB_CPR_START 1 /* a checkpoint request's started */ -#define CALLB_CPR_SAFE 2 /* thread is safe for CPR */ -#define CALLB_CPR_ALWAYS_SAFE 4 /* thread is ALWAYS safe for CPR */ - -/* - * Used when checking that all kernel threads are stopped. - */ -#define CALLB_MAX_RETRY 3 /* when waiting for kthread to sleep */ -#define CALLB_THREAD_DELAY 10 /* ticks allowed to reach sleep */ -#define CPR_KTHREAD_TIMEOUT_SEC 90 /* secs before callback times out -- */ - /* due to pwr mgmt of disks, make -- */ - /* big enough for worst spinup time */ - -#ifdef _KERNEL -/* - * - * CALLB_CPR_INIT macro is used by kernel threads to add their entry to - * the callback table and perform other initialization. It automatically - * adds the thread as being in the callback class CB_CL_CPR_DAEMON. - * - * cp - ptr to the callb_cpr_t structure for this kernel thread - * - * lockp - pointer to mutex protecting the callb_cpr_t stuct - * - * func - pointer to the callback function for this kernel thread. - * It has the prototype boolean_t (void *arg, int code) - * where: arg - ptr to the callb_cpr_t structure - * code - not used for this type of callback - * returns: B_TRUE if successful; B_FALSE if unsuccessful. - * - * name - a string giving the name of the kernel thread - * - * Note: lockp is the lock to protect the callb_cpr_t (cp) structure - * later on. No lock held is needed for this initialization. - */ -#define CALLB_CPR_INIT(cp, lockp, func, name) { \ - /* XXXNETBSD set thread name */ \ - bzero((caddr_t)(cp), sizeof (callb_cpr_t)); \ - (cp)->cc_lockp = lockp; \ - (cp)->cc_id = callb_add(func, (void *)(cp), \ - CB_CL_CPR_DAEMON, name); \ - cv_init(&(cp)->cc_callb_cv, NULL, CV_DEFAULT, NULL); \ - cv_init(&(cp)->cc_stop_cv, NULL, CV_DEFAULT, NULL); \ - } - -#ifndef __lock_lint -#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); -#else -#define CALLB_CPR_ASSERT(cp) -#endif -/* - * Some threads (like the idle threads) do not adhere to the callback - * protocol and are always considered safe. Such threads must never exit. - * They register their presence by calling this macro during their - * initialization. - * - * Args: - * t - thread pointer of the client kernel thread - * name - a string giving the name of the kernel thread - */ -#define CALLB_CPR_INIT_SAFE(t, name) { \ - (void) callb_add_thread(callb_generic_cpr_safe, \ - (void *) &callb_cprinfo_safe, CB_CL_CPR_DAEMON, \ - name, t); \ - } -/* - * The lock to protect cp's content must be held before - * calling the following two macros. - * - * Any code region between CALLB_CPR_SAFE_BEGIN and CALLB_CPR_SAFE_END - * is safe for checkpoint/resume. - */ -#define CALLB_CPR_SAFE_BEGIN(cp) { \ - CALLB_CPR_ASSERT(cp) \ - (cp)->cc_events |= CALLB_CPR_SAFE; \ - if ((cp)->cc_events & CALLB_CPR_START) \ - cv_signal(&(cp)->cc_callb_cv); \ - } -#define CALLB_CPR_SAFE_END(cp, lockp) { \ - CALLB_CPR_ASSERT(cp) \ - while ((cp)->cc_events & CALLB_CPR_START) \ - cv_wait(&(cp)->cc_stop_cv, lockp); \ - (cp)->cc_events &= ~CALLB_CPR_SAFE; \ - } -/* - * cv_destroy is nop right now but may be needed in the future. - */ -#define CALLB_CPR_EXIT(cp) { \ - CALLB_CPR_ASSERT(cp) \ - (cp)->cc_events |= CALLB_CPR_SAFE; \ - if ((cp)->cc_events & CALLB_CPR_START) \ - cv_signal(&(cp)->cc_callb_cv); \ - mutex_exit((cp)->cc_lockp); \ - (void) callb_delete((cp)->cc_id); \ - cv_destroy(&(cp)->cc_callb_cv); \ - cv_destroy(&(cp)->cc_stop_cv); \ - } - -extern callb_cpr_t callb_cprinfo_safe; -extern callb_id_t callb_add(boolean_t (*)(void *, int), void *, int, char *); -extern callb_id_t callb_add_thread(boolean_t (*)(void *, int), - void *, int, char *, kthread_id_t); -extern int callb_delete(callb_id_t); -extern void callb_execute(callb_id_t, int); -extern void *callb_execute_class(int, int); -extern boolean_t callb_generic_cpr(void *, int); -extern boolean_t callb_generic_cpr_safe(void *, int); -extern boolean_t callb_is_stopped(kthread_id_t, caddr_t *); -extern void callb_lock_table(void); -extern void callb_unlock_table(void); -extern void callb_init(void *); -extern void callb_fini(void *); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_CALLB_H */ diff --git a/external/cddl/osnet/sys/sys/cpupart.h b/external/cddl/osnet/sys/sys/cpupart.h deleted file mode 100644 index 002ac6421cf9..000000000000 --- a/external/cddl/osnet/sys/sys/cpupart.h +++ /dev/null @@ -1,38 +0,0 @@ -/* $NetBSD: cpupart.h,v 1.3 2010/02/21 01:46:35 darran Exp $ */ - -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _COMPAT_OPENSOLARIS_SYS_CPUPART_H -#define _COMPAT_OPENSOLARIS_SYS_CPUPART_H - -typedef int cpupartid_t; - -typedef struct cpupart { - cpupartid_t cp_id; /* partition ID */ -} cpupart_t; - -#endif /* _COMPAT_OPENSOLARIS_SYS_CPUPART_H */ diff --git a/external/cddl/osnet/sys/sys/cyclic.h b/external/cddl/osnet/sys/sys/cyclic.h index f6c80ab85b63..ee9f8ed4bc78 100644 --- a/external/cddl/osnet/sys/sys/cyclic.h +++ b/external/cddl/osnet/sys/sys/cyclic.h @@ -1,4 +1,4 @@ -/* $NetBSD: cyclic.h,v 1.5 2018/05/28 21:05:10 chs Exp $ */ +/* $NetBSD: cyclic.h,v 1.6 2019/07/23 07:46:22 hannken Exp $ */ /* * CDDL HEADER START @@ -40,7 +40,9 @@ typedef void cpu_t; #ifndef _ASM #include #include +#ifndef __NetBSD__ #include +#endif #endif /* !_ASM */ #define CY_LOW_LEVEL 0