* UCRL-CODE-235197
*
* This file is part of the SPL, Solaris Porting Layer.
- * For details, see <http://github.com/behlendorf/spl/>.
+ * For details, see <http://zfsonlinux.org/>.
*
* The SPL is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#define _SPL_SYSMACROS_H
#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/cpumask.h>
#include <sys/debug.h>
#include <sys/varargs.h>
#include <sys/zone.h>
#include <sys/signal.h>
+#ifdef HAVE_SCHED_RT_HEADER
+#include <linux/sched/rt.h>
+#endif
+
#ifndef _KERNEL
#define _KERNEL __KERNEL__
#endif
#define UINT64_MIN ULLONG_MIN
#define NBBY 8
-#define ENOTSUP ENOTSUPP
+#define ENOTSUP EOPNOTSUPP
#define MAXMSGLEN 256
#define MAXNAMELEN 256
#define MAXPATHLEN PATH_MAX
-
-#ifdef _LP64
-#define MAXOFFSET_T 0x7fffffffffffffffl
-#else
-#define MAXOFFSET_T 0x7fffffffl
-#endif
-
+#define MAXOFFSET_T LLONG_MAX
#define MAXBSIZE 8192
#define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define proc_pageout NULL
-#define curproc get_current()
-#define max_ncpus 64
-#define CPU_SEQID smp_processor_id() /* I think... */
+#define curproc current
+#define max_ncpus num_possible_cpus()
+#define CPU_SEQID smp_processor_id()
#define _NOTE(x)
#define is_system_labeled() 0
-
-#define RLIM64_INFINITY RLIM_INFINITY
+#ifndef RLIM64_INFINITY
+#define RLIM64_INFINITY (~0ULL)
+#endif
/* 0..MAX_PRIO-1: Process priority
* 0..MAX_RT_PRIO-1: RT priority tasks
#define minclsyspri (MAX_RT_PRIO)
#define maxclsyspri (MAX_PRIO-1)
+#ifndef NICE_TO_PRIO
#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
+#endif
+#ifndef PRIO_TO_NICE
#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
+#endif
-/* Missing macros
+/*
+ * Missing macros
*/
+#ifndef PAGESIZE
#define PAGESIZE PAGE_SIZE
+#endif
/* from Solaris sys/byteorder.h */
#define BSWAP_8(x) ((x) & 0xff)
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
/* Missing globals */
-extern char spl_version[16];
-extern long spl_hostid;
-extern char hw_serial[11];
+extern char spl_version[32];
+extern unsigned long spl_hostid;
/* Missing misc functions */
-extern int highbit(unsigned long i);
extern uint32_t zone_get_hostid(void *zone);
extern void spl_setup(void);
extern void spl_cleanup(void);
-#define makedevice(maj,min) makedev(maj,min)
+#define highbit64(x) fls64(x)
+#define makedevice(maj,min) makedev(maj,min)
/* common macros */
#ifndef MIN
#ifndef roundup
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#endif
+#ifndef howmany
+#define howmany(x, y) (((x) + ((y) - 1)) / (y))
+#endif
/*
* Compatibility macros/typedefs needed for Solaris -> Linux port