diff options
author | Brian Behlendorf <[email protected]> | 2010-06-11 14:57:49 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-06-11 15:57:25 -0700 |
commit | 32c6147dee702e6033a9f3b4999a0b9025a88260 (patch) | |
tree | 9d7f8713aee5e545eaf4cedb3361e6edb6ae01cd | |
parent | b868e22f05fd85be16afee800207f72b8e310d32 (diff) |
Minor cleanup and Solaris API additions.
Minor formatting cleanups.
API additions:
* {U}INT8_{MIN,MAX}, {U}INT16_{MIN,MAX} macros.
* id_t typedef
* ddi_get_lbolt(), ddi_get_lbolt64() functions.
-rw-r--r-- | include/sys/sid.h | 3 | ||||
-rw-r--r-- | include/sys/sysmacros.h | 62 | ||||
-rw-r--r-- | include/sys/timer.h | 3 | ||||
-rw-r--r-- | include/sys/types.h | 1 |
4 files changed, 41 insertions, 28 deletions
diff --git a/include/sys/sid.h b/include/sys/sid.h index 9d4c7192b..ac32d7bf7 100644 --- a/include/sys/sid.h +++ b/include/sys/sid.h @@ -26,10 +26,7 @@ #define _SPL_SID_H typedef struct ksiddomain { - uint_t kd_ref; - uint_t kd_len; char *kd_name; - avl_node_t kd_link; } ksiddomain_t; static inline ksiddomain_t * diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 4475431e7..eccfee34d 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -32,27 +32,38 @@ #include <sys/signal.h> #ifndef _KERNEL -#define _KERNEL __KERNEL__ +#define _KERNEL __KERNEL__ #endif #define FALSE 0 #define TRUE 1 -#define INT32_MAX INT_MAX -#define INT32_MIN INT_MIN +#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_MAX ULLONG_MAX #define UINT64_MIN ULLONG_MIN -#define NBBY 8 -#define ENOTSUP ENOTSUPP +#define NBBY 8 +#define ENOTSUP ENOTSUPP #define MAXMSGLEN 256 -#define MAXNAMELEN 256 -#define MAXPATHLEN PATH_MAX +#define MAXNAMELEN 256 +#define MAXPATHLEN PATH_MAX #ifdef _LP64 #define MAXOFFSET_T 0x7fffffffffffffffl @@ -80,26 +91,26 @@ * * Treat shim tasks as SCHED_NORMAL tasks */ -#define minclsyspri (MAX_RT_PRIO) -#define maxclsyspri (MAX_PRIO-1) +#define minclsyspri (MAX_RT_PRIO) +#define maxclsyspri (MAX_PRIO-1) #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) #define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) /* Missing macros */ -#define PAGESIZE PAGE_SIZE +#define PAGESIZE PAGE_SIZE /* 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)) +#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) memcpy(dest,src,size) +#define bzero(ptr,size) memset(ptr,0,size) +#define bcopy(src,dest,size) memcpy(dest,src,size) #define bcmp(src,dest,size) memcmp((src), (dest), (size_t)(size)) /* Dtrace probes do not exist in the linux kernel */ @@ -161,15 +172,15 @@ extern void spl_cleanup(void); /* * 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) & -(align))) -#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 P2ALIGN(x, align) ((x) & -(align)) +#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) +#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) + (((off) ^ ((off) + (len) - 1)) > (align) - 1) /* * Typed version of the P2* macros. These macros should be used to ensure @@ -178,6 +189,7 @@ extern void spl_cleanup(void); * 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) diff --git a/include/sys/timer.h b/include/sys/timer.h index 3af57d8f5..ea6043696 100644 --- a/include/sys/timer.h +++ b/include/sys/timer.h @@ -32,6 +32,9 @@ #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 delay(ticks) schedule_timeout((long)(ticks)) #endif /* _SPL_TIMER_H */ diff --git a/include/sys/types.h b/include/sys/types.h index 1bdd00c48..256e7b09e 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -80,6 +80,7 @@ typedef ulong_t pfn_t; typedef ulong_t pgcnt_t; typedef long spgcnt_t; typedef short index_t; +typedef int id_t; extern proc_t p0; |