Merge pull request #41 from dmacvicar/master
[platform/upstream/libsolv.git] / src / repopage.h
index 0cc8600..739345e 100644 (file)
@@ -1,43 +1,50 @@
 /*
- * Copyright (c) 2007-2008, Novell Inc.
+ * Copyright (c) 2007-2011, Novell Inc.
  *
  * This program is licensed under the BSD license, read LICENSE.BSD
  * for further information
  */
 
-#ifndef SATSOLVER_REPOPAGE_H
-#define SATSOLVER_REPOPAGE_H
+#ifndef LIBSOLV_REPOPAGE_H
+#define LIBSOLV_REPOPAGE_H
 
-#define BLOB_PAGEBITS 15
-#define BLOB_PAGESIZE (1 << BLOB_PAGEBITS)
+#define REPOPAGE_BLOBBITS 15
+#define REPOPAGE_BLOBSIZE (1 << REPOPAGE_BLOBBITS)
 
 typedef struct _Attrblobpage
 {
-  /* mapped_at == -1  --> not loaded, otherwise offset into
-     store->blob_store.  The size of the mapping is BLOB_PAGESIZE
-     except for the last page.  */
-  unsigned int mapped_at;
-  long file_offset;
-  /* file_size == 0 means the page is not backed by some file storage.
+  /* page_size == 0 means the page is not backed by some file storage.
      Otherwise it is L*2+(compressed ? 1 : 0), with L being the data
      length.  */
-  long file_size;
+  unsigned int page_offset;
+  unsigned int page_size;
 } Attrblobpage;
 
 typedef struct _Repopagestore {
-  int pagefd;  /* file descriptor we're paging from */
+  int pagefd;          /* file descriptor we're paging from */
+  long file_offset;    /* pages in file start here */
 
   unsigned char *blob_store;
-  Attrblobpage *pages;
   unsigned int num_pages;
 
-  /* mapped[i] is zero if nothing is mapped at logical page I,
-   otherwise it contains the pagenumber plus one (of the mapped page).  */
+  /* mapped_at[page] == -1  --> not loaded, otherwise offset into
+     store->blob_store.  The size of the mapping is REPOPAGE_BLOBSIZE
+     except for the last page.  */
+  unsigned int *mapped_at;
+
+  Attrblobpage *file_pages;
+
+  /* mapped[i] is -1 if nothing is mapped at logical page I,
+   otherwise it contains the page number (of the mapped page).  */
   unsigned int *mapped;
-  unsigned int nmapped, ncanmap;
+  unsigned int nmapped;
   unsigned int rr_counter;
 } Repopagestore;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void repopagestore_init(Repopagestore *store);
 void repopagestore_free(Repopagestore *store);
 
@@ -52,4 +59,8 @@ int repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned i
 
 void repopagestore_disable_paging(Repopagestore *store);
 
-#endif /* SATSOLVER_REPOPAGE_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LIBSOLV_REPOPAGE_H */