]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Minor cleanup and Solaris API additions.
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 Jun 2010 21:57:49 +0000 (14:57 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 Jun 2010 22:57:25 +0000 (15:57 -0700)
Minor formatting cleanups.

API additions:
* {U}INT8_{MIN,MAX}, {U}INT16_{MIN,MAX} macros.
* id_t typedef
* ddi_get_lbolt(), ddi_get_lbolt64() functions.

include/sys/sid.h
include/sys/sysmacros.h
include/sys/timer.h
include/sys/types.h

index 9d4c7192b1ab88ecd16f00d9dd59b5f4c98e0071..ac32d7bf7341f16935eefe00015e23424fdc7bbf 100644 (file)
 #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 *
index 4475431e711375479dd1125dfe229cff7558a763..eccfee34d15b08edf7443c249267261e1b13cc56 100644 (file)
 #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
  *
  * 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)
index 3af57d8f58166d75d86cc7a47f167d5e1cc47adf..ea60436966a41d64d24d84aaaee3d9e772dc6c83 100644 (file)
@@ -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 */
index 1bdd00c4837e4b4e5f75946b4d1eecdb58bd4fc3..256e7b09e6212b7eabe0582cdb7e094478b2a593 100644 (file)
@@ -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;