]> git.proxmox.com Git - mirror_zfs.git/blobdiff - lib/libspl/include/sys/sysmacros.h
cstyle: Resolve C style issues
[mirror_zfs.git] / lib / libspl / include / sys / sysmacros.h
index 07ab8c93499a176c4e56e643253e7092b74b42c7..698b0a7a34fedb50587ef6fd5e3431002b31925a 100644 (file)
  */
 
 #ifndef _LIBSPL_SYS_SYSMACROS_H
-#define _LIBSPL_SYS_SYSMACROS_H
+#define        _LIBSPL_SYS_SYSMACROS_H
 
 #include_next <sys/sysmacros.h>
 
 /* common macros */
 #ifndef MIN
-#define MIN(a, b)       ((a) < (b) ? (a) : (b))
+#define        MIN(a, b)       ((a) < (b) ? (a) : (b))
 #endif
 #ifndef MAX
-#define MAX(a, b)       ((a) < (b) ? (b) : (a))
+#define        MAX(a, b)       ((a) < (b) ? (b) : (a))
 #endif
 #ifndef ABS
-#define ABS(a)          ((a) < 0 ? -(a) : (a))
+#define        ABS(a)          ((a) < 0 ? -(a) : (a))
 #endif
 
-#define makedevice(maj,min)    makedev(maj,min)
-#define _sysconf(a)            sysconf(a)
-#define __NORETURN             __attribute__ ((noreturn))
+#define        makedevice(maj, min)    makedev(maj, min)
+#define        _sysconf(a)             sysconf(a)
+#define        __NORETURN              __attribute__((noreturn))
 
 /*
  * 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 P2ROUNDUP_TYPED(x, align, type) \
+#define        P2ALIGN(x, align)       ((x) & -(align))
+#define        P2CROSS(x, y, align)    (((x) ^ (y)) > (align) - 1)
+#define        P2ROUNDUP(x, align)     (-(-(x) & -(align)))
+#define        P2ROUNDUP_TYPED(x, align, type) \
                                (-(-(type)(x) & -(type)(align)))
-#define P2BOUNDARY(off, len, align) \
+#define        P2BOUNDARY(off, len, align) \
                                (((off) ^ ((off) + (len) - 1)) > (align) - 1)
-#define P2PHASE(x, align)      ((x) & ((align) - 1))
-#define P2NPHASE(x, align)     (-(x) & ((align) - 1))
-#define P2NPHASE_TYPED(x, align, type) \
+#define        P2PHASE(x, align)       ((x) & ((align) - 1))
+#define        P2NPHASE(x, align)      (-(x) & ((align) - 1))
+#define        P2NPHASE_TYPED(x, align, type) \
                                (-(type)(x) & ((type)(align) - 1))
-#define ISP2(x)                        (((x) & ((x) - 1)) == 0)
-#define IS_P2ALIGNED(v, a)     ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
+#define        ISP2(x)                 (((x) & ((x) - 1)) == 0)
+#define        IS_P2ALIGNED(v, a)      ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
 
 /*
  * Typed version of the P2* macros.  These macros should be used to ensure
  * or
  *      P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
  */
-#define P2ALIGN_TYPED(x, align, type)   \
-        ((type)(x) & -(type)(align))
-#define P2PHASE_TYPED(x, align, type)   \
-        ((type)(x) & ((type)(align) - 1))
-#define P2NPHASE_TYPED(x, align, type)  \
-        (-(type)(x) & ((type)(align) - 1))
-#define P2ROUNDUP_TYPED(x, align, type) \
-        (-(-(type)(x) & -(type)(align)))
-#define P2END_TYPED(x, align, type)     \
-        (-(~(type)(x) & -(type)(align)))
-#define P2PHASEUP_TYPED(x, align, phase, type)  \
-        ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
-#define P2CROSS_TYPED(x, y, align, type)        \
-        (((type)(x) ^ (type)(y)) > (type)(align) - 1)
-#define P2SAMEHIGHBIT_TYPED(x, y, type) \
-        (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
+#define        P2ALIGN_TYPED(x, align, type)           \
+       ((type)(x) & -(type)(align))
+#define        P2PHASE_TYPED(x, align, type)           \
+       ((type)(x) & ((type)(align) - 1))
+#define        P2NPHASE_TYPED(x, align, type)          \
+       (-(type)(x) & ((type)(align) - 1))
+#define        P2ROUNDUP_TYPED(x, align, type)         \
+       (-(-(type)(x) & -(type)(align)))
+#define        P2END_TYPED(x, align, type)             \
+       (-(~(type)(x) & -(type)(align)))
+#define        P2PHASEUP_TYPED(x, align, phase, type)  \
+       ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
+#define        P2CROSS_TYPED(x, y, align, type)        \
+       (((type)(x) ^ (type)(y)) > (type)(align) - 1)
+#define        P2SAMEHIGHBIT_TYPED(x, y, type)         \
+       (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
 
 
 /* avoid any possibility of clashing with <stddef.h> version */