From 995458e48d482bd5fa349882fba5cb4d6350076d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 5 Mar 2001 12:35:58 +0000 Subject: [PATCH] Introduced obuck_get_pos(), converted gatherd limits to use it. --- lib/bucket.c | 2 +- lib/bucket.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/bucket.c b/lib/bucket.c index 5799d6e5..cac9419f 100644 --- a/lib/bucket.c +++ b/lib/bucket.c @@ -157,7 +157,7 @@ obuck_get(oid_t oid) { struct fastbuf *b = obuck_fb; - bucket_start = ((sh_off_t) oid) << OBUCK_SHIFT; + bucket_start = obuck_get_pos(oid); bflush(b); if (sh_pread(obuck_fd, &obuck_hdr, sizeof(obuck_hdr), bucket_start) != sizeof(obuck_hdr)) obuck_broken("Short header read"); diff --git a/lib/bucket.h b/lib/bucket.h index f99baae9..bdf35e81 100644 --- a/lib/bucket.h +++ b/lib/bucket.h @@ -55,3 +55,10 @@ void obuck_create_end(struct fastbuf *b, struct obuck_header *hdrp); /* Deleting buckets */ void obuck_delete(oid_t oid); + +/* Convert bucket ID to file position (for size limitations etc.) */ + +static inline sh_off_t obuck_get_pos(oid_t oid) +{ + return ((sh_off_t) oid) << OBUCK_SHIFT; +} -- 2.39.2