2 * Sherlock Library -- File Page Cache
4 * (c) 1999 Martin Mares <mj@atrey.karlin.mff.cuni.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 */
17 sh_off_t key; /* Lower bits contain file handle */
23 #define PG_FLAG_DIRTY 1
24 #define PG_FLAG_VALID 2
26 struct page_cache *pgc_open(uns page_size, uns max_pages);
27 void pgc_close(struct page_cache *);
28 void pgc_debug(struct page_cache *, int mode);
29 void pgc_flush(struct page_cache *); /* Write all unwritten pages */
30 void pgc_cleanup(struct page_cache *); /* Deallocate all unused buffers */
31 struct page *pgc_read(struct page_cache *, int fd, sh_off_t); /* Read page and lock it */
32 struct page *pgc_get(struct page_cache *, int fd, sh_off_t); /* Get page for writing */
33 void pgc_put(struct page_cache *, struct page *); /* Release page */
34 void pgc_mark_dirty(struct page_cache *, struct page *); /* Mark locked page as dirty */
35 byte *pgc_read_data(struct page_cache *, int fd, sh_off_t, uns *); /* Partial reading */
36 sh_off_t pgc_page_pos(struct page_cache *, struct page *); /* Get page position */