X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fpagecache.c;h=6a2643dfae7547caceae0098ec926b076fd8f141;hb=b27eca618acf30cf59bedc41d0d099cf6f3e28b2;hp=57abfeea3beb50193e798d7118cd713dc9e57ffc;hpb=e9aa499507f33db9fac50f3864609a6b292685e0;p=libucw.git diff --git a/lib/pagecache.c b/lib/pagecache.c index 57abfeea..6a2643df 100644 --- a/lib/pagecache.c +++ b/lib/pagecache.c @@ -1,7 +1,10 @@ /* * Sherlock Library -- File Page Cache * - * (c) 1999--2000 Martin Mares + * (c) 1999--2002 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ #include "lib/lib.h" @@ -13,6 +16,7 @@ #include #include #include +#include struct page_cache { list free_pages; /* LRU queue of free non-dirty pages */ @@ -104,7 +108,7 @@ flush_page(struct page_cache *c, struct page *p) #ifdef SHERLOCK_HAVE_PREAD s = sh_pwrite(p->fd, p->data, c->page_size, p->pos); #else - if (c->pos != p->pos || c->pos_fd != p->fd) + if (c->pos != p->pos || c->pos_fd != (int) p->fd) sh_seek(p->fd, p->pos, SEEK_SET); s = write(p->fd, p->data, c->page_size); c->pos = p->pos + s; @@ -139,7 +143,7 @@ static void flush_pages(struct page_cache *c, uns force) { uns cnt = 0; - uns max = force ? ~0 : c->free_count / 2; /* FIXME: Needs tuning */ + uns max = force ? ~0U : c->free_count / 2; uns i; struct page *p, *q, **req, **rr; @@ -281,7 +285,7 @@ pgc_read(struct page_cache *c, int fd, sh_off_t pos) #ifdef SHERLOCK_HAVE_PREAD s = sh_pread(fd, p->data, c->page_size, pos); #else - if (c->pos != pos || c->pos_fd != fd) + if (c->pos != pos || c->pos_fd != (int)fd) sh_seek(fd, pos, SEEK_SET); s = read(fd, p->data, c->page_size); c->pos = pos + s; @@ -339,7 +343,7 @@ pgc_put(struct page_cache *c, struct page *p) else { rem_node(&p->hn); - free(p); + xfree(p); c->total_count--; } }