2 * Sherlock Library -- File Page Cache
4 * (c) 1999--2002 Martin Mares <mj@ucw.cz>
7 #ifndef _SHERLOCK_PAGECACHE_H
8 #define _SHERLOCK_PAGECACHE_H
10 #include "lib/lists.h"
15 node n; /* Node in page list */
16 node hn; /* Node in hash table */
24 #define PG_FLAG_DIRTY 1
25 #define PG_FLAG_VALID 2
27 struct page_cache *pgc_open(uns page_size, uns max_pages);
28 void pgc_close(struct page_cache *);
29 void pgc_debug(struct page_cache *, int mode);
30 void pgc_flush(struct page_cache *); /* Write all unwritten pages */
31 void pgc_cleanup(struct page_cache *); /* Deallocate all unused buffers */
32 struct page *pgc_read(struct page_cache *, int fd, sh_off_t); /* Read page and lock it */
33 struct page *pgc_get(struct page_cache *, int fd, sh_off_t); /* Get page for writing */
34 struct page *pgc_get_zero(struct page_cache *, int fd, sh_off_t); /* ... and clear it */
35 void pgc_put(struct page_cache *, struct page *); /* Release page */
36 void pgc_mark_dirty(struct page_cache *, struct page *); /* Mark locked page as dirty */
37 byte *pgc_read_data(struct page_cache *, int fd, sh_off_t, uns *); /* Partial reading */