diff options
-rw-r--r-- | ext/repo_write.c | 10 | ||||
-rw-r--r-- | src/repodata.c | 6 | ||||
-rw-r--r-- | src/repopage.c | 40 | ||||
-rw-r--r-- | src/repopage.h | 8 |
4 files changed, 32 insertions, 32 deletions
diff --git a/ext/repo_write.c b/ext/repo_write.c index 13917fa..ece080c 100644 --- a/ext/repo_write.c +++ b/ext/repo_write.c @@ -901,7 +901,7 @@ static void write_compressed_page(FILE *fp, unsigned char *page, int len) { int clen; - unsigned char cpage[BLOB_PAGESIZE]; + unsigned char cpage[REPOPAGE_BLOBSIZE]; clen = repopagestore_compress_page(page, len, cpage, len - 1); if (!clen) @@ -1864,10 +1864,10 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); if (i < target.nkeys) { /* yes, write it in pages */ - unsigned char *dp, vpage[BLOB_PAGESIZE]; + unsigned char *dp, vpage[REPOPAGE_BLOBSIZE]; int l, ll, lpage = 0; - write_u32(fp, BLOB_PAGESIZE); + write_u32(fp, REPOPAGE_BLOBSIZE); for (i = 1; i < target.nkeys; i++) { if (!cbdata.extdata[i].len) @@ -1876,14 +1876,14 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); dp = cbdata.extdata[i].buf; while (l) { - ll = BLOB_PAGESIZE - lpage; + ll = REPOPAGE_BLOBSIZE - lpage; if (l < ll) ll = l; memcpy(vpage + lpage, dp, ll); dp += ll; lpage += ll; l -= ll; - if (lpage == BLOB_PAGESIZE) + if (lpage == REPOPAGE_BLOBSIZE) { write_compressed_page(fp, vpage, lpage); lpage = 0; diff --git a/src/repodata.c b/src/repodata.c index 70718f4..814993d 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -425,10 +425,10 @@ get_vertical_data(Repodata *data, Repokey *key, Id off, Id len) return 0; /* we now have the offset, go into vertical */ off += data->verticaloffset[key - data->keys]; - /* fprintf(stderr, "key %d page %d\n", key->name, off / BLOB_PAGESIZE); */ - dp = repopagestore_load_page_range(&data->store, off / BLOB_PAGESIZE, (off + len - 1) / BLOB_PAGESIZE); + /* fprintf(stderr, "key %d page %d\n", key->name, off / REPOPAGE_BLOBSIZE); */ + dp = repopagestore_load_page_range(&data->store, off / REPOPAGE_BLOBSIZE, (off + len - 1) / REPOPAGE_BLOBSIZE); if (dp) - dp += off % BLOB_PAGESIZE; + dp += off % REPOPAGE_BLOBSIZE; return dp; } diff --git a/src/repopage.c b/src/repopage.c index 7f9e21e..0dbdfdb 100644 --- a/src/repopage.c +++ b/src/repopage.c @@ -1,5 +1,5 @@ /* - * 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 @@ -574,7 +574,7 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne { /* Make sure all pages from PSTART to PEND (inclusive) are loaded, and are consecutive. Return a pointer to the mapping of PSTART. */ - unsigned char buf[BLOB_PAGESIZE]; + unsigned char buf[REPOPAGE_BLOBSIZE]; unsigned int i; /* Quick check in case all pages are there already and consecutive. */ @@ -582,7 +582,7 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne if (store->pages[i].mapped_at == -1 || (i > pstart && store->pages[i].mapped_at - != store->pages[i-1].mapped_at + BLOB_PAGESIZE)) + != store->pages[i-1].mapped_at + REPOPAGE_BLOBSIZE)) break; if (i > pend) return store->blob_store + store->pages[pstart].mapped_at; @@ -599,7 +599,7 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne store->ncanmap = 4; store->mapped = sat_realloc2(store->mapped, store->ncanmap, sizeof(store->mapped[0])); memset(store->mapped + oldcan, 0, (store->ncanmap - oldcan) * sizeof (store->mapped[0])); - store->blob_store = sat_realloc2(store->blob_store, store->ncanmap, BLOB_PAGESIZE); + store->blob_store = sat_realloc2(store->blob_store, store->ncanmap, REPOPAGE_BLOBSIZE); #ifdef DEBUG_PAGING fprintf(stderr, "PAGE: can map %d pages\n", store->ncanmap); #endif @@ -678,17 +678,17 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne { Attrblobpage *p = store->pages + i; unsigned int pnum = i - pstart + best; - void *dest = store->blob_store + pnum * BLOB_PAGESIZE; + void *dest = store->blob_store + pnum * REPOPAGE_BLOBSIZE; if (p->mapped_at != -1) { - if (p->mapped_at != pnum * BLOB_PAGESIZE) + if (p->mapped_at != pnum * REPOPAGE_BLOBSIZE) { #ifdef DEBUG_PAGING fprintf(stderr, "PAGECOPY: %d to %d\n", i, pnum); #endif /* Still mapped somewhere else, so just copy it from there. */ - memcpy(dest, store->blob_store + p->mapped_at, BLOB_PAGESIZE); - store->mapped[p->mapped_at / BLOB_PAGESIZE] = 0; + memcpy(dest, store->blob_store + p->mapped_at, REPOPAGE_BLOBSIZE); + store->mapped[p->mapped_at / REPOPAGE_BLOBSIZE] = 0; } } else @@ -708,8 +708,8 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne { unsigned int out_len; out_len = unchecked_decompress_buf(buf, in_len, - dest, BLOB_PAGESIZE); - if (out_len != BLOB_PAGESIZE && i < store->num_pages - 1) + dest, REPOPAGE_BLOBSIZE); + if (out_len != REPOPAGE_BLOBSIZE && i < store->num_pages - 1) { #ifdef DEBUG_PAGING fprintf(stderr, "can't decompress\n"); @@ -724,10 +724,10 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne fprintf(stderr, "\n"); #endif } - p->mapped_at = pnum * BLOB_PAGESIZE; + p->mapped_at = pnum * REPOPAGE_BLOBSIZE; store->mapped[pnum] = i + 1; } - return store->blob_store + best * BLOB_PAGESIZE; + return store->blob_store + best * REPOPAGE_BLOBSIZE; } unsigned int @@ -765,9 +765,9 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p unsigned int i; unsigned int can_seek; long cur_file_ofs; - unsigned char buf[BLOB_PAGESIZE]; + unsigned char buf[REPOPAGE_BLOBSIZE]; - if (pagesz != BLOB_PAGESIZE) + if (pagesz != REPOPAGE_BLOBSIZE) { /* We could handle this by slurping in everything. */ return SOLV_ERROR_CORRUPT; @@ -786,14 +786,14 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p #ifdef DEBUG_PAGING fprintf(stderr, "can %sseek\n", can_seek ? "" : "NOT "); #endif - npages = (blobsz + BLOB_PAGESIZE - 1) / BLOB_PAGESIZE; + npages = (blobsz + REPOPAGE_BLOBSIZE - 1) / REPOPAGE_BLOBSIZE; store->num_pages = npages; store->pages = sat_malloc2(npages, sizeof(store->pages[0])); /* If we can't seek on our input we have to slurp in everything. */ if (!can_seek) - store->blob_store = sat_malloc2(npages, BLOB_PAGESIZE); + store->blob_store = sat_malloc2(npages, REPOPAGE_BLOBSIZE); for (i = 0; i < npages; i++) { unsigned int in_len = read_u32(fp); @@ -823,8 +823,8 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p else { unsigned int out_len; - void *dest = store->blob_store + i * BLOB_PAGESIZE; - p->mapped_at = i * BLOB_PAGESIZE; + void *dest = store->blob_store + i * REPOPAGE_BLOBSIZE; + p->mapped_at = i * REPOPAGE_BLOBSIZE; p->file_offset = 0; p->file_size = 0; /* We can't seek, so suck everything in. */ @@ -835,8 +835,8 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p } if (compressed) { - out_len = unchecked_decompress_buf(buf, in_len, dest, BLOB_PAGESIZE); - if (out_len != BLOB_PAGESIZE && i < npages - 1) + out_len = unchecked_decompress_buf(buf, in_len, dest, REPOPAGE_BLOBSIZE); + if (out_len != REPOPAGE_BLOBSIZE && i < npages - 1) { return SOLV_ERROR_CORRUPT; } diff --git a/src/repopage.h b/src/repopage.h index 2c1847f..94f6763 100644 --- a/src/repopage.h +++ b/src/repopage.h @@ -1,5 +1,5 @@ /* - * 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 @@ -8,13 +8,13 @@ #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 + store->blob_store. The size of the mapping is REPOPAGE_BLOBSIZE except for the last page. */ unsigned int mapped_at; long file_offset; |