+static inline void write_signature(char *sig)
+{
+ char *sp = (char *) signature_page;
+
+ strncpy(sp + pagesize - 10, sig, 10);
+}
+
+#define V0_MAX_PAGES (8 * (pagesize - 10))
+/* Before 2.2.0pre9 */
+#define V1_OLD_MAX_PAGES ((0x7fffffff / pagesize) - 1)
+/* Since 2.2.0pre9:
+ error if nr of pages >= SWP_OFFSET(SWP_ENTRY(0,~0UL))
+ with variations on
+ #define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8))
+ #define SWP_OFFSET(entry) ((entry) >> 8)
+ on the various architectures. Below the result - yuk.
+
+ Machine pagesize SWP_ENTRY SWP_OFFSET bound+1 oldbound+2
+ i386 2^12 o<<8 e>>8 1<<24 1<<19
+ mips 2^12 o<<15 e>>15 1<<17 1<<19
+ alpha 2^13 o<<40 e>>40 1<<24 1<<18
+ m68k 2^12 o<<12 e>>12 1<<20 1<<19
+ sparc 2^{12,13} (o&0x3ffff)<<9 (e>>9)&0x3ffff 1<<18 1<<{19,18}
+ sparc64 2^13 o<<13 e>>13 1<<51 1<<18
+ ppc 2^12 o<<8 e>>8 1<<24 1<<19
+ armo 2^{13,14,15} o<<8 e>>8 1<<24 1<<{18,17,16}
+ armv 2^12 o<<9 e>>9 1<<23 1<<19