diff options
author | Miles Bader <miles@gnu.org> | 1995-11-13 20:04:34 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-11-13 20:04:34 +0000 |
commit | fdfc7cfca1089bb86766d8c7276d96e32785ef5d (patch) | |
tree | 4945bb87a50b37b1fdc672b7a49f09a43bd2a6ba | |
parent | 909120da5bd769b80a75f8d276c381e1b968e38e (diff) |
Formerly derive.c.~2~
-rw-r--r-- | libstore/derive.c | 26 |
1 files changed, 25 insertions, 1 deletions
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; } |