diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/venti/srv/fixarenas.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/venti/srv/fixarenas.c b/src/cmd/venti/srv/fixarenas.c index 009c8e27..fd9dccc5 100644 --- a/src/cmd/venti/srv/fixarenas.c +++ b/src/cmd/venti/srv/fixarenas.c @@ -15,6 +15,8 @@ #include "fns.h" #include "whack.h" +#define ROUNDUP(x,n) (((x)+(n)-1)&~((n)-1)) + #pragma varargck type "z" uvlong #pragma varargck type "z" vlong #pragma varargck type "t" uint @@ -793,8 +795,8 @@ guessgeometry(void) } ap.arenabase = bestdiff; } - - ap.tabbase = (PartBlank+HeadSize+ap.blocksize-1)&~(ap.blocksize-1); + + ap.tabbase = ROUNDUP(PartBlank+HeadSize, ap.blocksize); /* * XXX pick up table, check arenabase. * XXX pick up table, record base name. @@ -806,7 +808,7 @@ guessgeometry(void) */ if(ap.arenabase == 0){ for(i=0; i<nelem(tabsizes); i++){ - ap.arenabase = (PartBlank+HeadSize+tabsizes[i]+ap.blocksize-1)&~(ap.blocksize-1); + ap.arenabase = ROUNDUP(PartBlank+HeadSize, ap.blocksize); p = pagein(ap.arenabase, Block); if(u32(p) == ArenaHeadMagic) break; |