]> git.proxmox.com Git - mirror_spl.git/blobdiff - include/sys/sysmacros.h
Make file headers conform to ZFS style standard
[mirror_spl.git] / include / sys / sysmacros.h
index c56d7e12a6203051abf79213ac88e49d14f55cac..03468d7d0d51610c1791c5d207761bf336a71c9e 100644 (file)
@@ -1,4 +1,4 @@
-/*****************************************************************************\
+/*
  *  Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
  *  Copyright (C) 2007 The Regents of the University of California.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
@@ -20,7 +20,7 @@
  *
  *  You should have received a copy of the GNU General Public License along
  *  with the SPL.  If not, see <http://www.gnu.org/licenses/>.
-\*****************************************************************************/
+ */
 
 #ifndef _SPL_SYSMACROS_H
 #define _SPL_SYSMACROS_H
@@ -32,6 +32,7 @@
 #include <sys/varargs.h>
 #include <sys/zone.h>
 #include <sys/signal.h>
+#include <asm/page.h>
 
 #ifdef HAVE_SCHED_RT_HEADER
 #include <linux/sched/rt.h>
@@ -78,6 +79,7 @@
 #define proc_pageout                   NULL
 #define curproc                                current
 #define max_ncpus                      num_possible_cpus()
+#define boot_ncpus                     num_online_cpus()
 #define CPU_SEQID                      smp_processor_id()
 #define _NOTE(x)
 #define is_system_labeled()            0
@@ -92,8 +94,9 @@
  *
  * Treat shim tasks as SCHED_NORMAL tasks
  */
-#define minclsyspri                    (MAX_RT_PRIO)
-#define maxclsyspri                    (MAX_PRIO-1)
+#define minclsyspri                    (MAX_PRIO-1)
+#define maxclsyspri                    (MAX_RT_PRIO)
+#define defclsyspri                    (DEFAULT_PRIO)
 
 #ifndef NICE_TO_PRIO
 #define NICE_TO_PRIO(nice)             (MAX_RT_PRIO + (nice) + 20)
 #define PAGESIZE                       PAGE_SIZE
 #endif
 
+#ifndef PAGESHIFT
+#define PAGESHIFT                      PAGE_SHIFT
+#endif
+
 /* from Solaris sys/byteorder.h */
 #define BSWAP_8(x)     ((x) & 0xff)
 #define BSWAP_16(x)    ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
@@ -156,6 +163,9 @@ extern uint32_t zone_get_hostid(void *zone);
 extern void spl_setup(void);
 extern void spl_cleanup(void);
 
+#define        highbit(x)              __fls(x)
+#define        lowbit(x)               __ffs(x)
+
 #define        highbit64(x)            fls64(x)
 #define        makedevice(maj,min)     makedev(maj,min)
 
@@ -184,7 +194,7 @@ extern void spl_cleanup(void);
  */
 #define P2ALIGN(x, align)      ((x) & -(align))
 #define P2CROSS(x, y, align)   (((x) ^ (y)) > (align) - 1)
-#define P2ROUNDUP(x, align)    (-(-(x) & -(align)))
+#define P2ROUNDUP(x, align)    ((((x) - 1) | ((align) - 1)) + 1)
 #define P2PHASE(x, align)      ((x) & ((align) - 1))
 #define P2NPHASE(x, align)     (-(x) & ((align) - 1))
 #define ISP2(x)                        (((x) & ((x) - 1)) == 0)
@@ -211,7 +221,7 @@ extern void spl_cleanup(void);
 #define P2NPHASE_TYPED(x, align, type)  \
         (-(type)(x) & ((type)(align) - 1))
 #define P2ROUNDUP_TYPED(x, align, type) \
-        (-(-(type)(x) & -(type)(align)))
+        ((((type)(x) - 1) | ((type)(align) - 1)) + 1)
 #define P2END_TYPED(x, align, type)     \
         (-(~(type)(x) & -(type)(align)))
 #define P2PHASEUP_TYPED(x, align, phase, type)  \