X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fpagecache.c;h=13ad36603fc7f69ea64c0aa9e527e74c88d8a7f5;hb=39d5e9acc6d93c07cbb408fe27144c8a485499ac;hp=955b97c18af4a51b306287b265b3bcb3e71bf039;hpb=cdceda2daaf0f3a81bcc19e8a039000cef35dc75;p=libucw.git diff --git a/lib/pagecache.c b/lib/pagecache.c index 955b97c1..13ad3660 100644 --- a/lib/pagecache.c +++ b/lib/pagecache.c @@ -1,5 +1,5 @@ /* - * Sherlock Library -- File Page Cache + * UCW Library -- File Page Cache * * (c) 1999--2002 Martin Mares * @@ -16,6 +16,7 @@ #include #include #include +#include struct page_cache { list free_pages; /* LRU queue of free non-dirty pages */ @@ -30,7 +31,7 @@ struct page_cache { uns stat_miss; /* Number of cache misses */ uns stat_write; /* Number of writes */ list *hash_table; /* List heads corresponding to hash buckets */ -#ifndef SHERLOCK_HAVE_PREAD +#ifndef HAVE_PREAD sh_off_t pos; /* Current position in the file */ int pos_fd; /* FD the position corresponds to */ #endif @@ -54,7 +55,7 @@ pgc_open(uns page_size, uns max_pages) c->hash_table = xmalloc(sizeof(list) * c->hash_size); for(i=0; ihash_size; i++) init_list(&c->hash_table[i]); -#ifndef SHERLOCK_HAVE_PREAD +#ifndef HAVE_PREAD c->pos_fd = -1; #endif return c; @@ -104,7 +105,7 @@ flush_page(struct page_cache *c, struct page *p) int s; ASSERT(p->flags & PG_FLAG_DIRTY); -#ifdef SHERLOCK_HAVE_PREAD +#ifdef HAVE_PREAD s = sh_pwrite(p->fd, p->data, c->page_size, p->pos); #else if (c->pos != p->pos || c->pos_fd != (int) p->fd) @@ -281,7 +282,7 @@ pgc_read(struct page_cache *c, int fd, sh_off_t pos) else { c->stat_miss++; -#ifdef SHERLOCK_HAVE_PREAD +#ifdef HAVE_PREAD s = sh_pread(fd, p->data, c->page_size, pos); #else if (c->pos != pos || c->pos_fd != (int)fd)