From: Martin Mares Date: Mon, 5 Mar 2001 12:35:58 +0000 (+0000) Subject: Introduced obuck_get_pos(), converted gatherd limits to use it. X-Git-Tag: holmes-import~1524 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=995458e48d482bd5fa349882fba5cb4d6350076d;p=libucw.git Introduced obuck_get_pos(), converted gatherd limits to use it. --- 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; +}