* 200000 - 2.0 branch
* 200100 - base development version after 2.0 branch
* 200101 - lchflags syscall
+ * 200200 - 2.2 branch
+ * 200201 - base development version after 2.2 branch
+ * 200202 - major changes to libc
+ * 200203 - introduce PCI domain
+ * 200204 - suser() & suser_cred() removal
+ * 200205 - devfs import
+ * 200206 - *sleep() renames
+ * 200400 - 2.4 release
+ * 200500 - 2.5 master
+ * 200600 - 2.6 release
+ * 200700 - 2.7 master
+ * 200800 - 2.8 release October 2010
+ * 200900 - 2.9 master
*/
#undef __DragonFly_version
-#define __DragonFly_version 200101 /* Master, propagated to newvers */
-
-#ifdef __FreeBSD__
-/*
- * __FreeBSD_version numbers for source compatibility. This is temporary
- * along with the __FreeBSD__ define in gcc2. Note that gcc3 does not
- * define __FreeBSD__ by default, only __DragonFly__.
- */
-#undef __FreeBSD_version
-#define __FreeBSD_version 480101
-#endif
+#define __DragonFly_version 200900 /* propagated to newvers */
#include <sys/_null.h>
#define PCATCH 0x00000100 /* tsleep checks signals */
#define PUSRFLAG1 0x00000200 /* Subsystem specific flag */
+#define PINTERLOCKED 0x00000400 /* Interlocked tsleep */
#define PWAKEUP_CPUMASK 0x00003FFF /* start cpu for chained wakeups */
#define PWAKEUP_MYCPU 0x00004000 /* wakeup on current cpu only */
#define PWAKEUP_ONE 0x00008000 /* argument to wakeup: only one */
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define rounddown(x, y) (((x)/(y))*(y))
+#define rounddown2(x, y) ((x) & ~((y) - 1)) /* y power of two */
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0)
+/*
+ * VM objects can be larger than the virtual address space, make sure
+ * we don't cut-off the mask.
+ */
+#define trunc_page64(x) ((x) & ~(int64_t)PAGE_MASK)
+#define round_page64(x) (((x) + PAGE_MASK) & ~(int64_t)PAGE_MASK)
+
/* Macros for min/max. */
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define ctodb(db) /* calculates pages to devblks */ \
((db) << (PAGE_SHIFT - DEV_BSHIFT))
+#define MJUMPAGESIZE PAGE_SIZE /* jumbo cluster 4k */
+#define MJUM9BYTES (9 * 1024) /* jumbo cluster 9k */
+#define MJUM16BYTES (16 * 1024) /* jumbo cluster 16k */
+
+/*
+ * MBUF Management.
+ *
+ * Because many drivers can't deal with multiple DMA segments all mbufs
+ * must avoid crossing a page boundary. While we can accomodate mbufs
+ * which are not a power-of-2 sized kmalloc() will only guarantee
+ * non-crossing alignment if we use a power-of-2. 256 is no longer large
+ * enough due to m_hdr and m_pkthdr bloat.
+ *
+ * MCLBYTES must be a power of 2 and is typically significantly larger
+ * than MSIZE, sufficient to hold a standard-mtu packet. 2K is considered
+ * reasonable.
+ */
+#ifndef MSIZE
+#define MSIZE 512 /* size of an mbuf */
+#endif
+
+#ifndef MCLSHIFT
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+#endif
+#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
/*
* Make this available for most of the kernel. There were too many