FreeBSD: make adjustments for the standalone environment
In FreeBSD, there are three compile environments that are supported: user land, the kernel and the bootloader / standalone. Adjust the headers to compile in the standalone environment. Limit kernel-only items from view when _STANDALONE is defined. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Warner Losh <imp@FreeBSD.org> Closes #10998
This commit is contained in:
parent
57dc5d42b1
commit
b302185a92
|
@ -68,7 +68,7 @@
|
||||||
#define noinline __noinline
|
#define noinline __noinline
|
||||||
#define ____cacheline_aligned __aligned(CACHE_LINE_SIZE)
|
#define ____cacheline_aligned __aligned(CACHE_LINE_SIZE)
|
||||||
|
|
||||||
#ifndef _KERNEL
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
#define likely(x) __builtin_expect(!!(x), 1)
|
#define likely(x) __builtin_expect(!!(x), 1)
|
||||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include_next <rpc/xdr.h>
|
#include_next <rpc/xdr.h>
|
||||||
|
|
||||||
#ifndef _KERNEL
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -66,6 +66,6 @@ xdrmem_control(XDR *xdrs, int request, void *info)
|
||||||
xdrmem_control((xdrs), (req), (op)) : \
|
xdrmem_control((xdrs), (req), (op)) : \
|
||||||
(*(xdrs)->x_ops->x_control)(xdrs, req, op))
|
(*(xdrs)->x_ops->x_control)(xdrs, req, op))
|
||||||
|
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL && !_STANDALONE */
|
||||||
|
|
||||||
#endif /* !_OPENSOLARIS_RPC_XDR_H_ */
|
#endif /* !_OPENSOLARIS_RPC_XDR_H_ */
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#ifndef _OPENSOLARIS_SYS_ATOMIC_H_
|
#ifndef _OPENSOLARIS_SYS_ATOMIC_H_
|
||||||
#define _OPENSOLARIS_SYS_ATOMIC_H_
|
#define _OPENSOLARIS_SYS_ATOMIC_H_
|
||||||
|
|
||||||
|
#ifndef _STANDALONE
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <machine/atomic.h>
|
#include <machine/atomic.h>
|
||||||
|
|
||||||
|
@ -179,4 +181,13 @@ atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
|
||||||
}
|
}
|
||||||
#endif /* !defined(COMPAT_32BIT) && defined(__LP64__) */
|
#endif /* !defined(COMPAT_32BIT) && defined(__LP64__) */
|
||||||
|
|
||||||
|
#else /* _STANDALONE */
|
||||||
|
/*
|
||||||
|
* sometimes atomic_add_64 is defined, sometimes not, but the
|
||||||
|
* following is always right for the boot loader.
|
||||||
|
*/
|
||||||
|
#undef atomic_add_64
|
||||||
|
#define atomic_add_64(ptr, val) *(ptr) += val
|
||||||
|
#endif /* !_STANDALONE */
|
||||||
|
|
||||||
#endif /* !_OPENSOLARIS_SYS_ATOMIC_H_ */
|
#endif /* !_OPENSOLARIS_SYS_ATOMIC_H_ */
|
||||||
|
|
|
@ -80,10 +80,11 @@
|
||||||
#define BE_64(x) BSWAP_64(x)
|
#define BE_64(x) BSWAP_64(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_STANDALONE)
|
||||||
#if BYTE_ORDER == _BIG_ENDIAN
|
#if BYTE_ORDER == _BIG_ENDIAN
|
||||||
#define htonll(x) BMASK_64(x)
|
#define htonll(x) BMASK_64(x)
|
||||||
#define ntohll(x) BMASK_64(x)
|
#define ntohll(x) BMASK_64(x)
|
||||||
#else
|
#else /* BYTE_ORDER == _LITTLE_ENDIAN */
|
||||||
#ifndef __LP64__
|
#ifndef __LP64__
|
||||||
static __inline__ uint64_t
|
static __inline__ uint64_t
|
||||||
htonll(uint64_t n)
|
htonll(uint64_t n)
|
||||||
|
@ -96,11 +97,12 @@ ntohll(uint64_t n)
|
||||||
{
|
{
|
||||||
return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
|
return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
|
||||||
}
|
}
|
||||||
#else
|
#else /* !__LP64__ */
|
||||||
#define htonll(x) BSWAP_64(x)
|
#define htonll(x) BSWAP_64(x)
|
||||||
#define ntohll(x) BSWAP_64(x)
|
#define ntohll(x) BSWAP_64(x)
|
||||||
#endif
|
#endif /* __LP64__ */
|
||||||
#endif
|
#endif /* BYTE_ORDER */
|
||||||
|
#endif /* _STANDALONE */
|
||||||
|
|
||||||
#define BE_IN32(xa) htonl(*((uint32_t *)(void *)(xa)))
|
#define BE_IN32(xa) htonl(*((uint32_t *)(void *)(xa)))
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,9 @@ extern "C" {
|
||||||
#define __VPRINTFLIKE(__n) __sun_attr__((__VPRINTFLIKE__(__n)))
|
#define __VPRINTFLIKE(__n) __sun_attr__((__VPRINTFLIKE__(__n)))
|
||||||
#define __KPRINTFLIKE(__n) __sun_attr__((__KPRINTFLIKE__(__n)))
|
#define __KPRINTFLIKE(__n) __sun_attr__((__KPRINTFLIKE__(__n)))
|
||||||
#define __KVPRINTFLIKE(__n) __sun_attr__((__KVPRINTFLIKE__(__n)))
|
#define __KVPRINTFLIKE(__n) __sun_attr__((__KVPRINTFLIKE__(__n)))
|
||||||
#ifdef _KERNEL
|
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||||
#define __NORETURN __sun_attr__((__noreturn__))
|
#define __NORETURN __sun_attr__((__noreturn__))
|
||||||
#endif
|
#endif /* _KERNEL || _STANDALONE */
|
||||||
#define __CONST __sun_attr__((__const__))
|
#define __CONST __sun_attr__((__const__))
|
||||||
#define __PURE __sun_attr__((__pure__))
|
#define __PURE __sun_attr__((__pure__))
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ typedef int enum_t;
|
||||||
#define __exit
|
#define __exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||||
#define param_set_charp(a, b) (0)
|
#define param_set_charp(a, b) (0)
|
||||||
#define ATTR_UID AT_UID
|
#define ATTR_UID AT_UID
|
||||||
#define ATTR_GID AT_GID
|
#define ATTR_GID AT_GID
|
||||||
|
@ -183,9 +183,15 @@ typedef int enum_t;
|
||||||
#define ATTR_CTIME AT_CTIME
|
#define ATTR_CTIME AT_CTIME
|
||||||
#define ATTR_MTIME AT_MTIME
|
#define ATTR_MTIME AT_MTIME
|
||||||
#define ATTR_ATIME AT_ATIME
|
#define ATTR_ATIME AT_ATIME
|
||||||
|
#if defined(_STANDALONE)
|
||||||
|
#define vmem_free kmem_free
|
||||||
|
#define vmem_zalloc kmem_zalloc
|
||||||
|
#define vmem_alloc kmem_zalloc
|
||||||
|
#else
|
||||||
#define vmem_free zfs_kmem_free
|
#define vmem_free zfs_kmem_free
|
||||||
#define vmem_zalloc(size, flags) zfs_kmem_alloc(size, flags | M_ZERO)
|
#define vmem_zalloc(size, flags) zfs_kmem_alloc(size, flags | M_ZERO)
|
||||||
#define vmem_alloc zfs_kmem_alloc
|
#define vmem_alloc zfs_kmem_alloc
|
||||||
|
#endif
|
||||||
#define MUTEX_NOLOCKDEP 0
|
#define MUTEX_NOLOCKDEP 0
|
||||||
#define RW_NOLOCKDEP 0
|
#define RW_NOLOCKDEP 0
|
||||||
|
|
||||||
|
|
|
@ -52,42 +52,33 @@ extern "C" {
|
||||||
/*PRINTFLIKE2*/
|
/*PRINTFLIKE2*/
|
||||||
extern void cmn_err(int, const char *, ...)
|
extern void cmn_err(int, const char *, ...)
|
||||||
__KPRINTFLIKE(2);
|
__KPRINTFLIKE(2);
|
||||||
#pragma rarely_called(cmn_err)
|
|
||||||
|
|
||||||
extern void vzcmn_err(zoneid_t, int, const char *, __va_list)
|
extern void vzcmn_err(zoneid_t, int, const char *, __va_list)
|
||||||
__KVPRINTFLIKE(3);
|
__KVPRINTFLIKE(3);
|
||||||
#pragma rarely_called(vzcmn_err)
|
|
||||||
|
|
||||||
extern void vcmn_err(int, const char *, __va_list)
|
extern void vcmn_err(int, const char *, __va_list)
|
||||||
__KVPRINTFLIKE(2);
|
__KVPRINTFLIKE(2);
|
||||||
#pragma rarely_called(vcmn_err)
|
|
||||||
|
|
||||||
/*PRINTFLIKE3*/
|
/*PRINTFLIKE3*/
|
||||||
extern void zcmn_err(zoneid_t, int, const char *, ...)
|
extern void zcmn_err(zoneid_t, int, const char *, ...)
|
||||||
__KPRINTFLIKE(3);
|
__KPRINTFLIKE(3);
|
||||||
#pragma rarely_called(zcmn_err)
|
|
||||||
|
|
||||||
extern void vzprintf(zoneid_t, const char *, __va_list)
|
extern void vzprintf(zoneid_t, const char *, __va_list)
|
||||||
__KVPRINTFLIKE(2);
|
__KVPRINTFLIKE(2);
|
||||||
#pragma rarely_called(vzprintf)
|
|
||||||
|
|
||||||
/*PRINTFLIKE2*/
|
/*PRINTFLIKE2*/
|
||||||
extern void zprintf(zoneid_t, const char *, ...)
|
extern void zprintf(zoneid_t, const char *, ...)
|
||||||
__KPRINTFLIKE(2);
|
__KPRINTFLIKE(2);
|
||||||
#pragma rarely_called(zprintf)
|
|
||||||
|
|
||||||
extern void vuprintf(const char *, __va_list)
|
extern void vuprintf(const char *, __va_list)
|
||||||
__KVPRINTFLIKE(1);
|
__KVPRINTFLIKE(1);
|
||||||
#pragma rarely_called(vuprintf)
|
|
||||||
|
|
||||||
/*PRINTFLIKE1*/
|
/*PRINTFLIKE1*/
|
||||||
extern void panic(const char *, ...)
|
extern void panic(const char *, ...)
|
||||||
__KPRINTFLIKE(1) __NORETURN;
|
__KPRINTFLIKE(1) __NORETURN;
|
||||||
#pragma rarely_called(panic)
|
|
||||||
|
|
||||||
extern void vpanic(const char *, __va_list)
|
extern void vpanic(const char *, __va_list)
|
||||||
__KVPRINTFLIKE(1) __NORETURN;
|
__KVPRINTFLIKE(1) __NORETURN;
|
||||||
#pragma rarely_called(vpanic)
|
|
||||||
|
|
||||||
#endif /* !_ASM */
|
#endif /* !_ASM */
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <sys/spl_condvar.h>
|
#include <sys/spl_condvar.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/errno.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cv_timedwait() is similar to cv_wait() except that it additionally expects
|
* cv_timedwait() is similar to cv_wait() except that it additionally expects
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#ifndef _OPENSOLARIS_SYS_KMEM_H_
|
#ifndef _OPENSOLARIS_SYS_KMEM_H_
|
||||||
#define _OPENSOLARIS_SYS_KMEM_H_
|
#define _OPENSOLARIS_SYS_KMEM_H_
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/vmem.h>
|
#include <sys/vmem.h>
|
||||||
|
@ -93,5 +94,14 @@ void *calloc(size_t n, size_t s);
|
||||||
zfs_kmem_alloc((size), (kmflags) | M_ZERO)
|
zfs_kmem_alloc((size), (kmflags) | M_ZERO)
|
||||||
#define kmem_free(buf, size) zfs_kmem_free((buf), (size))
|
#define kmem_free(buf, size) zfs_kmem_free((buf), (size))
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#ifdef _STANDALONE
|
||||||
|
/*
|
||||||
|
* At the moment, we just need it for the type. We redirect the alloc/free
|
||||||
|
* routines to the usual Free and Malloc in that environment.
|
||||||
|
*/
|
||||||
|
typedef int kmem_cache_t;
|
||||||
|
#endif /* _STANDALONE */
|
||||||
|
|
||||||
#endif /* _OPENSOLARIS_SYS_KMEM_H_ */
|
#endif /* _OPENSOLARIS_SYS_KMEM_H_ */
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#ifndef _SPL_KMEM_CACHE_H
|
#ifndef _SPL_KMEM_CACHE_H
|
||||||
#define _SPL_KMEM_CACHE_H
|
#define _SPL_KMEM_CACHE_H
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
#include <sys/taskq.h>
|
#include <sys/taskq.h>
|
||||||
|
|
||||||
/* kmem move callback return values */
|
/* kmem move callback return values */
|
||||||
|
@ -46,4 +47,6 @@ extern void spl_kmem_cache_set_move(kmem_cache_t *,
|
||||||
|
|
||||||
#define kmem_cache_set_move(skc, move) spl_kmem_cache_set_move(skc, move)
|
#define kmem_cache_set_move(skc, move) spl_kmem_cache_set_move(skc, move)
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,8 +23,11 @@
|
||||||
|
|
||||||
#ifndef _SPL_KSTAT_H
|
#ifndef _SPL_KSTAT_H
|
||||||
#define _SPL_KSTAT_H
|
#define _SPL_KSTAT_H
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifndef _STANDALONE
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
struct list_head {};
|
struct list_head {};
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
|
@ -128,9 +131,10 @@ struct kstat_s {
|
||||||
kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */
|
kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */
|
||||||
char *ks_raw_buf; /* buf used for raw ops */
|
char *ks_raw_buf; /* buf used for raw ops */
|
||||||
size_t ks_raw_bufsize; /* size of raw ops buffer */
|
size_t ks_raw_bufsize; /* size of raw ops buffer */
|
||||||
|
#ifndef _STANDALONE
|
||||||
struct sysctl_ctx_list ks_sysctl_ctx;
|
struct sysctl_ctx_list ks_sysctl_ctx;
|
||||||
struct sysctl_oid *ks_sysctl_root;
|
struct sysctl_oid *ks_sysctl_root;
|
||||||
|
#endif /* _STANDALONE */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct kstat_named_s {
|
typedef struct kstat_named_s {
|
||||||
|
@ -215,10 +219,16 @@ extern void kstat_runq_exit(kstat_io_t *);
|
||||||
__kstat_set_seq_raw_ops(k, h, d, a)
|
__kstat_set_seq_raw_ops(k, h, d, a)
|
||||||
#define kstat_set_raw_ops(k, h, d, a) \
|
#define kstat_set_raw_ops(k, h, d, a) \
|
||||||
__kstat_set_raw_ops(k, h, d, a)
|
__kstat_set_raw_ops(k, h, d, a)
|
||||||
|
#ifndef _STANDALONE
|
||||||
#define kstat_create(m, i, n, c, t, s, f) \
|
#define kstat_create(m, i, n, c, t, s, f) \
|
||||||
__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_install(k) __kstat_install(k)
|
||||||
#define kstat_delete(k) __kstat_delete(k)
|
#define kstat_delete(k) __kstat_delete(k)
|
||||||
|
#else
|
||||||
|
#define kstat_create(m, i, n, c, t, s, f) ((kstat_t *)0)
|
||||||
|
#define kstat_install(k)
|
||||||
|
#define kstat_delete(k)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _SPL_KSTAT_H */
|
#endif /* _SPL_KSTAT_H */
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <sys/kmem.h>
|
#include <sys/kmem.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
#define CPU curcpu
|
#define CPU curcpu
|
||||||
#define minclsyspri PRIBIO
|
#define minclsyspri PRIBIO
|
||||||
#define defclsyspri minclsyspri
|
#define defclsyspri minclsyspri
|
||||||
|
@ -111,4 +111,5 @@ zfs_proc_is_caller(proc_t *p)
|
||||||
return (p == curproc);
|
return (p == curproc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
#endif /* _OPENSOLARIS_SYS_PROC_H_ */
|
#endif /* _OPENSOLARIS_SYS_PROC_H_ */
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#ifndef _SPL_PROCFS_LIST_H
|
#ifndef _SPL_PROCFS_LIST_H
|
||||||
#define _SPL_PROCFS_LIST_H
|
#define _SPL_PROCFS_LIST_H
|
||||||
|
|
||||||
|
#ifndef _STANDALONE
|
||||||
|
|
||||||
#include <sys/kstat.h>
|
#include <sys/kstat.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
|
|
||||||
|
@ -64,4 +66,8 @@ void procfs_list_uninstall(procfs_list_t *procfs_list);
|
||||||
void procfs_list_destroy(procfs_list_t *procfs_list);
|
void procfs_list_destroy(procfs_list_t *procfs_list);
|
||||||
void procfs_list_add(procfs_list_t *procfs_list, void *p);
|
void procfs_list_add(procfs_list_t *procfs_list, void *p);
|
||||||
|
|
||||||
|
#else
|
||||||
|
typedef int procfs_list_t;
|
||||||
|
#endif /* !_STANDALONE */
|
||||||
|
|
||||||
#endif /* _SPL_PROCFS_LIST_H */
|
#endif /* _SPL_PROCFS_LIST_H */
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#ifndef _OPENSOLARIS_SYS_SIG_H_
|
#ifndef _OPENSOLARIS_SYS_SIG_H_
|
||||||
#define _OPENSOLARIS_SYS_SIG_H_
|
#define _OPENSOLARIS_SYS_SIG_H_
|
||||||
|
|
||||||
|
#ifndef _STANDALONE
|
||||||
|
|
||||||
#include_next <sys/signal.h>
|
#include_next <sys/signal.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/lock.h>
|
#include <sys/lock.h>
|
||||||
|
@ -62,4 +64,7 @@ issig(int why)
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !_STANDALONE */
|
||||||
|
|
||||||
#endif /* _OPENSOLARIS_SYS_SIG_H_ */
|
#endif /* _OPENSOLARIS_SYS_SIG_H_ */
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#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>
|
||||||
|
@ -71,7 +72,11 @@ extern "C" {
|
||||||
#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
|
||||||
|
@ -319,7 +324,7 @@ extern unsigned char bcd_to_byte[256];
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#ifndef _SYS_TASKQ_H
|
#ifndef _SYS_TASKQ_H
|
||||||
#define _SYS_TASKQ_H
|
#define _SYS_TASKQ_H
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/taskqueue.h>
|
#include <sys/taskqueue.h>
|
||||||
|
@ -112,4 +114,11 @@ void taskq_resume(taskq_t *);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#ifdef _STANDALONE
|
||||||
|
typedef int taskq_ent_t;
|
||||||
|
#define taskq_init_ent(x)
|
||||||
|
#endif /* _STANDALONE */
|
||||||
|
|
||||||
#endif /* _SYS_TASKQ_H */
|
#endif /* _SYS_TASKQ_H */
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#ifndef _OPENSOLARIS_SYS_UIO_H_
|
#ifndef _OPENSOLARIS_SYS_UIO_H_
|
||||||
#define _OPENSOLARIS_SYS_UIO_H_
|
#define _OPENSOLARIS_SYS_UIO_H_
|
||||||
|
|
||||||
|
#ifndef _STANDALONE
|
||||||
|
|
||||||
#include_next <sys/uio.h>
|
#include_next <sys/uio.h>
|
||||||
#include <sys/_uio.h>
|
#include <sys/_uio.h>
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
|
@ -107,4 +109,6 @@ uio_index_at_offset(uio_t *uio, offset_t off, uint_t *vec_idx)
|
||||||
return (off);
|
return (off);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !_STANDALONE */
|
||||||
|
|
||||||
#endif /* !_OPENSOLARIS_SYS_UIO_H_ */
|
#endif /* !_OPENSOLARIS_SYS_UIO_H_ */
|
||||||
|
|
|
@ -62,7 +62,7 @@ typedef enum {
|
||||||
DATA_TYPE_UINT8,
|
DATA_TYPE_UINT8,
|
||||||
DATA_TYPE_BOOLEAN_ARRAY,
|
DATA_TYPE_BOOLEAN_ARRAY,
|
||||||
DATA_TYPE_INT8_ARRAY,
|
DATA_TYPE_INT8_ARRAY,
|
||||||
#if !defined(_KERNEL)
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
DATA_TYPE_UINT8_ARRAY,
|
DATA_TYPE_UINT8_ARRAY,
|
||||||
DATA_TYPE_DOUBLE
|
DATA_TYPE_DOUBLE
|
||||||
#else
|
#else
|
||||||
|
@ -191,7 +191,7 @@ int nvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t);
|
||||||
int nvlist_add_string_array(nvlist_t *, const char *, char *const *, uint_t);
|
int nvlist_add_string_array(nvlist_t *, const char *, char *const *, uint_t);
|
||||||
int nvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t);
|
int nvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t);
|
||||||
int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t);
|
int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t);
|
||||||
#if !defined(_KERNEL)
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
int nvlist_add_double(nvlist_t *, const char *, double);
|
int nvlist_add_double(nvlist_t *, const char *, double);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ int nvlist_lookup_nvlist_array(nvlist_t *, const char *,
|
||||||
nvlist_t ***, uint_t *);
|
nvlist_t ***, uint_t *);
|
||||||
int nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *);
|
int nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *);
|
||||||
int nvlist_lookup_pairs(nvlist_t *, int, ...);
|
int nvlist_lookup_pairs(nvlist_t *, int, ...);
|
||||||
#if !defined(_KERNEL)
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
int nvlist_lookup_double(nvlist_t *, const char *, double *);
|
int nvlist_lookup_double(nvlist_t *, const char *, double *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *);
|
||||||
int nvpair_value_string_array(nvpair_t *, char ***, uint_t *);
|
int nvpair_value_string_array(nvpair_t *, char ***, uint_t *);
|
||||||
int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *);
|
int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *);
|
||||||
int nvpair_value_hrtime(nvpair_t *, hrtime_t *);
|
int nvpair_value_hrtime(nvpair_t *, hrtime_t *);
|
||||||
#if !defined(_KERNEL)
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
int nvpair_value_double(nvpair_t *, double *);
|
int nvpair_value_double(nvpair_t *, double *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,15 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
/*
|
||||||
|
* This code compiles in three different contexts. When __KERNEL__ is defined,
|
||||||
|
* the code uses "unix-like" kernel interfaces. When _STANDALONE is defined, the
|
||||||
|
* code is running in a reduced capacity environment of the boot loader which is
|
||||||
|
* generally a subset of both POSIX and kernel interfaces (with a few unique
|
||||||
|
* interfaces too). When neither are defined, it's in a userland POSIX or
|
||||||
|
* similar environment.
|
||||||
|
*/
|
||||||
|
#if defined(__KERNEL__) || defined(_STANDALONE)
|
||||||
#include <sys/note.h>
|
#include <sys/note.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
@ -65,7 +73,7 @@ extern "C" {
|
||||||
#include <sys/procfs_list.h>
|
#include <sys/procfs_list.h>
|
||||||
#include <sys/mod.h>
|
#include <sys/mod.h>
|
||||||
#include <sys/zfs_context_os.h>
|
#include <sys/zfs_context_os.h>
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL || _STANDALONE */
|
||||||
|
|
||||||
#define _SYS_MUTEX_H
|
#define _SYS_MUTEX_H
|
||||||
#define _SYS_RWLOCK_H
|
#define _SYS_RWLOCK_H
|
||||||
|
@ -759,7 +767,7 @@ extern int kmem_cache_reap_active(void);
|
||||||
#define __init
|
#define __init
|
||||||
#define __exit
|
#define __exit
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL || _STANDALONE */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,10 +45,6 @@
|
||||||
*/
|
*/
|
||||||
#define MAXNAMELEN 256
|
#define MAXNAMELEN 256
|
||||||
|
|
||||||
#ifndef IN_BASE
|
|
||||||
#define UID_NOBODY 60001 /* user ID no body */
|
|
||||||
#define GID_NOBODY UID_NOBODY
|
|
||||||
#endif
|
|
||||||
#define UID_NOACCESS 60002 /* user ID no access */
|
#define UID_NOACCESS 60002 /* user ID no access */
|
||||||
|
|
||||||
#define MAXUID UINT32_MAX /* max user id */
|
#define MAXUID UINT32_MAX /* max user id */
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
* Generic doubly-linked list implementation
|
* Generic doubly-linked list implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/list.h>
|
#include <sys/list.h>
|
||||||
#include <sys/list_impl.h>
|
#include <sys/list_impl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysmacros.h>
|
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
|
|
||||||
#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
|
#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
|
||||||
|
|
Loading…
Reference in New Issue