]> mj.ucw.cz Git - libucw.git/blobdiff - lib/pagecache.h
Merge with git+ssh://cvs.ucw.cz/projects/sherlock/GIT/sherlock.git#v3.8
[libucw.git] / lib / pagecache.h
index 5c2661a0e04a6aedd31356d5cdd1187ffb90856c..ef4bf5af5740c5d710e6ac58da5cc82a07dcec70 100644 (file)
@@ -1,11 +1,14 @@
 /*
 /*
- *     Sherlock Library -- File Page Cache
+ *     UCW Library -- File Page Cache
  *
  *
- *     (c) 1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1999--2002 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
  */
 
-#ifndef _SHERLOCK_PAGECACHE_H
-#define _SHERLOCK_PAGECACHE_H
+#ifndef _UCW_PAGECACHE_H
+#define _UCW_PAGECACHE_H
 
 #include "lib/lists.h"
 
 
 #include "lib/lists.h"
 
@@ -14,7 +17,8 @@ struct page_cache;
 struct page {
   node n;                              /* Node in page list */
   node hn;                             /* Node in hash table */
 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];
   uns flags;
   uns lock_count;
   byte data[0];
@@ -30,6 +34,7 @@ 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 */
 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 */
 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 */