From: Jens Axboe Date: Fri, 23 Sep 2016 17:57:00 +0000 (-0600) Subject: bloom: add string version X-Git-Tag: fio-2.15~34 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=0a301e93062df3735f9bb87c445e18d98a4b6efb bloom: add string version Signed-off-by: Jens Axboe --- diff --git a/lib/bloom.c b/lib/bloom.c index 3369c5e9..c2e6c11f 100644 --- a/lib/bloom.c +++ b/lib/bloom.c @@ -88,7 +88,7 @@ void bloom_free(struct bloom *b) free(b); } -static bool __bloom_check(struct bloom *b, void *data, unsigned int len, +static bool __bloom_check(struct bloom *b, const void *data, unsigned int len, bool set) { uint32_t hash[N_HASHES]; @@ -117,3 +117,8 @@ bool bloom_set(struct bloom *b, uint32_t *data, unsigned int nwords) { return __bloom_check(b, data, nwords * sizeof(uint32_t), true); } + +bool bloom_set_string(struct bloom *b, const char *data, unsigned int len) +{ + return __bloom_check(b, data, len, true); +} diff --git a/lib/bloom.h b/lib/bloom.h index 329fd36a..d40d9f6b 100644 --- a/lib/bloom.h +++ b/lib/bloom.h @@ -9,5 +9,6 @@ struct bloom; struct bloom *bloom_new(uint64_t entries); void bloom_free(struct bloom *b); bool bloom_set(struct bloom *b, uint32_t *data, unsigned int nwords); +bool bloom_set_string(struct bloom *b, const char *data, unsigned int len); #endif