X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fqache.c;h=050f1c9a304d3eb6409afc0d83a75981b541214e;hb=d1a5b69d490ce61a0f41db08263580487720bf2f;hp=4fb00e7fe55c92776e5f64863fcfe6adf74d1ced;hpb=561a11755d11c05dcb855abc08365b9437198551;p=libucw.git diff --git a/lib/qache.c b/lib/qache.c index 4fb00e7f..050f1c9a 100644 --- a/lib/qache.c +++ b/lib/qache.c @@ -7,10 +7,10 @@ #undef LOCAL_DEBUG #include "lib/lib.h" +#include "lib/bitops.h" #include "lib/fastbuf.h" #include "lib/qache.h" -#include #include #include #include @@ -313,7 +313,7 @@ qache_create(struct qache *q, struct qache_params *par) bzero(&h, sizeof(h)); h.magic = QACHE_MAGIC; h.block_size = par->block_size; - h.block_shift = fls(h.block_size); + h.block_shift = bit_fls(h.block_size); h.num_blocks = par->cache_size >> h.block_shift; h.format_id = par->format_id; h.entry_table_start = sizeof(h); @@ -371,7 +371,7 @@ qache_create(struct qache *q, struct qache_params *par) log(L_INFO, "Cache %s: created (%d bytes, %d slots, %d buckets)", q->file_name, par->cache_size, h.max_entries, h.hash_size); if ((q->mmap_data = mmap(NULL, par->cache_size, PROT_READ | PROT_WRITE, MAP_SHARED, q->fd, 0)) == MAP_FAILED) - die("Cache %s: mmap failed (%m)", par->cache_size); + die("Cache %s: mmap failed (%m)", par->file_name); q->file_size = par->cache_size; qache_setup_pointers(q); } @@ -388,7 +388,7 @@ qache_open(struct qache_params *par) if (par->force_reset <= 0 && qache_open_existing(q, par)) ; else if (par->force_reset < 0) - die("Cache %s: read-only access requested, but no data available"); + die("Cache %s: read-only access requested, but no data available", q->file_name); else qache_create(q, par); return q;