move ROUNDUP() and related macros to portfns.h to fit cpu kernels. Reference: /n/atom/patch/applied2013/fsroundup Date: Mon Aug 26 03:59:45 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/fs/ip/il.c Mon Aug 26 03:58:39 2013 +++ /sys/src/fs/ip/il.c Mon Aug 26 03:58:40 2013 @@ -1002,9 +1002,6 @@ return x; } -#define HOWMANY(x, y) (((x)+((y)-1))/(y)) -#define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) - static void ilgoaway(Msgbuf *inmb, Ifc *ifc) { --- /sys/src/fs/port/portfns.h Mon Aug 26 03:58:41 2013 +++ /sys/src/fs/port/portfns.h Mon Aug 26 03:58:42 2013 @@ -300,3 +300,11 @@ vlong strtoll(char *, char **, int); uvlong strtoull(char *, char **, int); ulong strtoul(char*, char**, int); + +#define NEXT(x, l) (((x)+1)%(l)) +#define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1) +#define HOWMANY(x, y) (((x)+((y)-1))/(y)) +#define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) +#define ROUNDDN(x, y) (((x)/(y))*(y)) + +#pragma varargck argpos panic 1 --- /sys/src/fs/port/chk.c Mon Aug 26 03:58:44 2013 +++ /sys/src/fs/port/chk.c Mon Aug 26 03:58:45 2013 @@ -1,10 +1,6 @@ #include "all.h" -/* copied from ../pc/etherif.h; should probably be in all.h */ -#define HOWMANY(x, y) (((x)+((y)-1))/(y)) -#define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) - -/* augmented Dentry */ +//* augmented Dentry */ typedef struct { Dentry *d; Off qpath; --- /sys/src/fs/pc/ata.c Mon Aug 26 03:58:47 2013 +++ /sys/src/fs/pc/ata.c Mon Aug 26 03:58:49 2013 @@ -14,10 +14,6 @@ #define dprint(...) // print(__VA_ARGS__) #define idprint(...) // print(__VA_ARGS__) - -#define HOWMANY(x, y) (((x)+((y)-1))/(y)) -#define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) - enum{ IrqATA0 = 14, IrqATA1 = 15, --- /sys/src/fs/pc/sdata.c Mon Aug 26 03:58:53 2013 +++ /sys/src/fs/pc/sdata.c Mon Aug 26 03:58:55 2013 @@ -23,10 +23,6 @@ #define dprint(...) // print(__VA_ARGS__) #define idprint(...) // print(__VA_ARGS__) - -#define HOWMANY(x, y) (((x)+((y)-1))/(y)) -#define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) - enum { /* old stuff carried forward */ NCtlr= 8, --- /sys/src/fs/pc/etherif.h Mon Aug 26 03:58:56 2013 +++ /sys/src/fs/pc/etherif.h Mon Aug 26 03:58:57 2013 @@ -34,11 +34,6 @@ int (*reset)(Ether*); }; -#define NEXT(x, l) (((x)+1)%(l)) -#define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1) -#define HOWMANY(x, y) (((x)+((y)-1))/(y)) -#define ROUNDUP(x, y) (HOWMANY((x), (y))*(y)) - extern Etherctlr etherctlr[]; extern int netherctlr; extern Ether etherif[MaxEther]; --- /sys/src/fs/pc/malloc.c Mon Aug 26 03:58:58 2013 +++ /sys/src/fs/pc/malloc.c Mon Aug 26 03:58:58 2013 @@ -54,7 +54,7 @@ iunlock(&mconf); prbanks(); - panic("ialloc(%ld, %ld): out of memory: %#p\n", n, align, getcallerpc(&n)); + panic("ialloc(%ld, %d): out of memory: %#p\n", n, align, getcallerpc(&n)); return 0; } --- /sys/src/fs/pc/mmu.c Mon Aug 26 03:58:59 2013 +++ /sys/src/fs/pc/mmu.c Mon Aug 26 03:59:00 2013 @@ -74,7 +74,6 @@ * containing kernel mappings */ static ulong *kpt; /* 2nd level page tables for kernel mem */ -#define ROUNDUP(s,v) (((s)+(v-1))&~(v-1)) /* * offset of virtual address into * top level page table