return p;
}
+struct page *
+pgc_get_zero(struct page_cache *c, int fd, sh_off_t pos)
+{
+ sh_off_t key;
+ struct page *p;
+
+ ASSERT(!PAGE_OFFSET(pos));
+ ASSERT(!PAGE_NUMBER(fd));
+ key = pos | fd;
+ p = get_and_lock_page(c, key);
+ bzero(p->data, c->page_size);
+ p->flags |= PG_FLAG_VALID | PG_FLAG_DIRTY;
+ return p;
+}
+
void
pgc_put(struct page_cache *c, struct page *p)
{
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_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 */