2 * UCW Library -- File Page Cache
4 * (c) 1999--2002 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
10 #ifndef _UCW_PAGECACHE_H
11 #define _UCW_PAGECACHE_H
13 #include "lib/lists.h"
18 node n; /* Node in page list */
19 node hn; /* Node in hash table */
27 #define PG_FLAG_DIRTY 1
28 #define PG_FLAG_VALID 2
30 struct page_cache *pgc_open(uns page_size, uns max_pages);
31 void pgc_close(struct page_cache *);
32 void pgc_debug(struct page_cache *, int mode);
33 void pgc_flush(struct page_cache *); /* Write all unwritten pages */
34 void pgc_cleanup(struct page_cache *); /* Deallocate all unused buffers */
35 struct page *pgc_read(struct page_cache *, int fd, sh_off_t); /* Read page and lock it */
36 struct page *pgc_get(struct page_cache *, int fd, sh_off_t); /* Get page for writing */
37 struct page *pgc_get_zero(struct page_cache *, int fd, sh_off_t); /* ... and clear it */
38 void pgc_put(struct page_cache *, struct page *); /* Release page */
39 void pgc_mark_dirty(struct page_cache *, struct page *); /* Mark locked page as dirty */
40 byte *pgc_read_data(struct page_cache *, int fd, sh_off_t, uns *); /* Partial reading */