Changeset View
Changeset View
Standalone View
Standalone View
head/sys/contrib/openzfs/include/os/freebsd/spl/sys/sysmacros.h
Show All 25 Lines | |||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved. | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | ||||
* Use is subject to license terms. | * Use is subject to license terms. | ||||
*/ | */ | ||||
#ifndef _SYS_SYSMACROS_H | #ifndef _SYS_SYSMACROS_H | ||||
#define _SYS_SYSMACROS_H | #define _SYS_SYSMACROS_H | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | |||||
#include <sys/isa_defs.h> | #include <sys/isa_defs.h> | ||||
#include <sys/libkern.h> | #include <sys/libkern.h> | ||||
#include <sys/zone.h> | #include <sys/zone.h> | ||||
#include <sys/condvar.h> | #include <sys/condvar.h> | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" { | extern "C" { | ||||
#endif | #endif | ||||
Show All 24 Lines | |||||
#endif | #endif | ||||
#ifndef ARRAY_SIZE | #ifndef ARRAY_SIZE | ||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0])) | #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0])) | ||||
#endif | #endif | ||||
#ifndef DIV_ROUND_UP | #ifndef DIV_ROUND_UP | ||||
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) | #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) | ||||
#endif | #endif | ||||
#ifdef _STANDALONE | |||||
#define boot_ncpus 1 | |||||
#else /* _STANDALONE */ | |||||
#define boot_ncpus mp_ncpus | #define boot_ncpus mp_ncpus | ||||
#endif /* _STANDALONE */ | |||||
#define kpreempt_disable() critical_enter() | #define kpreempt_disable() critical_enter() | ||||
#define kpreempt_enable() critical_exit() | #define kpreempt_enable() critical_exit() | ||||
#define CPU_SEQID curcpu | #define CPU_SEQID curcpu | ||||
#define is_system_labeled() 0 | #define is_system_labeled() 0 | ||||
/* | /* | ||||
* Convert a single byte to/from binary-coded decimal (BCD). | * Convert a single byte to/from binary-coded decimal (BCD). | ||||
*/ | */ | ||||
extern unsigned char byte_to_bcd[256]; | extern unsigned char byte_to_bcd[256]; | ||||
▲ Show 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | |||||
#else | #else | ||||
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined | #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined | ||||
#endif /* _BIT_FIELDS_LTOH */ | #endif /* _BIT_FIELDS_LTOH */ | ||||
#if !defined(_KMEMUSER) && !defined(offsetof) | #if !defined(_KMEMUSER) && !defined(offsetof) | ||||
/* avoid any possibility of clashing with <stddef.h> version */ | /* avoid any possibility of clashing with <stddef.h> version */ | ||||
#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) | #define offsetof(type, field) __offsetof(type, field) | ||||
#endif | #endif | ||||
/* | /* | ||||
* Find highest one bit set. | * Find highest one bit set. | ||||
* Returns bit number + 1 of highest bit that is set, otherwise returns 0. | * Returns bit number + 1 of highest bit that is set, otherwise returns 0. | ||||
* High order bit is 31 (or 63 in _LP64 kernel). | * High order bit is 31 (or 63 in _LP64 kernel). | ||||
*/ | */ | ||||
static __inline int | static __inline int | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |