X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpagecache.h;h=a9368df9e4172913dac58745b8cbabeb0aae1fb8;hb=c49e8f00da4d1f214621a19364c64e30fa4afc7c;hp=67450e796e850b4bcf27f1b19136597c81e92516;hpb=6c02b97b704be77292bcedd9c457130414885b10;p=libucw.git diff --git a/lib/pagecache.h b/lib/pagecache.h index 67450e79..a9368df9 100644 --- a/lib/pagecache.h +++ b/lib/pagecache.h @@ -1,7 +1,10 @@ /* * Sherlock Library -- File Page Cache * - * (c) 1999 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. */ #ifndef _SHERLOCK_PAGECACHE_H @@ -14,7 +17,8 @@ struct page_cache; struct page { node n; /* Node in page list */ node hn; /* Node in hash table */ - sh_off_t key; /* Lower bits contain file handle */ + sh_off_t pos; + uns fd; uns flags; uns lock_count; byte data[0]; @@ -25,13 +29,14 @@ struct page { struct page_cache *pgc_open(uns page_size, uns max_pages); void pgc_close(struct page_cache *); -void pgc_debug(struct page_cache *); +void pgc_debug(struct page_cache *, int mode); void pgc_flush(struct page_cache *); /* Write all unwritten pages */ void pgc_cleanup(struct page_cache *); /* Deallocate all unused buffers */ struct page *pgc_read(struct page_cache *, int fd, sh_off_t); /* Read page and lock it */ struct page *pgc_get(struct page_cache *, int fd, sh_off_t); /* Get page for writing */ +struct page *pgc_get_zero(struct page_cache *, int fd, sh_off_t); /* ... and clear it */ void pgc_put(struct page_cache *, struct page *); /* Release page */ -void pgc_put_dirty(struct page_cache *, struct page *); /* Mark page as dirty and release it */ +void pgc_mark_dirty(struct page_cache *, struct page *); /* Mark locked page as dirty */ byte *pgc_read_data(struct page_cache *, int fd, sh_off_t, uns *); /* Partial reading */ #endif