From fdfc7cfca1089bb86766d8c7276d96e32785ef5d Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 13 Nov 1995 20:04:34 +0000 Subject: Formerly derive.c.~2~ --- libstore/derive.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'libstore') diff --git a/libstore/derive.c b/libstore/derive.c index 9fba948e..c028f29b 100644 --- a/libstore/derive.c +++ b/libstore/derive.c @@ -31,6 +31,30 @@ _store_derive (struct store *store) unsigned runs_len = store->runs_len; size_t bsize = store->block_size; + /* BLOCK & SIZE */ store->blocks = 0; - store-> + store->size = 0; + + while (runs_len > 0) + { + store->size += bsize * runs[1]; + if (runs[0] >= 0) + store->blocks += runs[1]; + runs += 2; + runs_len--; + } + + /* LOG2_BLOCK_SIZE */ + store->log2_block_size = 0; + while ((1 << store->log2_block_size) < bsize) + store->log2_block_size++; + if ((1 << store->log2_block_size) != bsize) + store->log2_block_size = 0; + + /* LOG2_BLOCKS_PER_PAGE */ + store->log2_blocks_per_page = 0; + while ((bsize << store->log2_blocks_per_page) < vm_page_size) + store->log2_blocks_per_page++; + if ((bsize << store->log2_blocks_per_page) != vm_page_size) + store->log2_blocks_per_page = 0; } -- cgit v1.2.3