repopage.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007-2008, Novell Inc.
00003  *
00004  * This program is licensed under the BSD license, read LICENSE.BSD
00005  * for further information
00006  */
00007 
00008 #ifndef SATSOLVER_REPOPAGE_H
00009 #define SATSOLVER_REPOPAGE_H
00010 
00011 #define BLOB_PAGEBITS 15
00012 #define BLOB_PAGESIZE (1 << BLOB_PAGEBITS)
00013 
00014 typedef struct _Attrblobpage
00015 {
00016   /* mapped_at == -1  --> not loaded, otherwise offset into
00017      store->blob_store.  The size of the mapping is BLOB_PAGESIZE
00018      except for the last page.  */
00019   unsigned int mapped_at;
00020   long file_offset;
00021   /* file_size == 0 means the page is not backed by some file storage.
00022      Otherwise it is L*2+(compressed ? 1 : 0), with L being the data
00023      length.  */
00024   long file_size;
00025 } Attrblobpage;
00026 
00027 typedef struct _Repopagestore {
00028   int pagefd;   /* file descriptor we're paging from */
00029 
00030   unsigned char *blob_store;
00031   Attrblobpage *pages;
00032   unsigned int num_pages;
00033 
00034   /* mapped[i] is zero if nothing is mapped at logical page I,
00035    otherwise it contains the pagenumber plus one (of the mapped page).  */
00036   unsigned int *mapped;
00037   unsigned int nmapped, ncanmap;
00038   unsigned int rr_counter;
00039 } Repopagestore;
00040 
00041 void repopagestore_init(Repopagestore *store);
00042 void repopagestore_free(Repopagestore *store);
00043 
00044 /* load pages pstart..pend into consecutive memory, return address */
00045 unsigned char *repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigned int pend);
00046 
00047 /* compress a page, return compressed len */
00048 unsigned int repopagestore_compress_page(unsigned char *page, unsigned int len, unsigned char *cpage, unsigned int max);
00049 
00050 /* setup page data for repodata_load_page_range */
00051 int repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int pagesz, unsigned int blobsz);
00052 
00053 void repopagestore_disable_paging(Repopagestore *store);
00054 
00055 #endif  /* SATSOLVER_REPOPAGE_H */
Generated on Mon Dec 12 11:44:12 2011 for satsolver by  doxygen 1.6.3