X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fpartmap.c;h=d3892ff58ffd56816fd4a1ca40d17060e939306d;hb=e29c6b7097c92fb1ee0587d167e1c434db198056;hp=756fdb635aeb826e1b40121af6efe27bfb6fd37a;hpb=22d2bb38fbca404d5f53a962591f1ce1574b8c04;p=libucw.git diff --git a/lib/partmap.c b/lib/partmap.c index 756fdb63..d3892ff5 100644 --- a/lib/partmap.c +++ b/lib/partmap.c @@ -17,6 +17,7 @@ #include #include #include +#include struct partmap { int fd; @@ -32,14 +33,9 @@ struct partmap { #define PARTMAP_WINDOW 16777216 #endif -static uns page_size; - struct partmap * partmap_open(byte *name, int writeable) { - if (!page_size) - page_size = getpagesize(); - struct partmap *p = xmalloc_zero(sizeof(struct partmap)); p->fd = sh_open(name, writeable ? O_RDWR : O_RDONLY); @@ -76,7 +72,7 @@ partmap_map(struct partmap *p, sh_off_t start, uns size) uns win = PARTMAP_WINDOW; ASSERT(win >= size); sh_off_t end = start + size; - start = start/page_size * page_size; + start = start/PAGE_SIZE * PAGE_SIZE; if (start+win > p->file_size) win = p->file_size - start; if (start+win < end)