From: Martin Mares Date: Fri, 16 Jan 2004 16:37:53 +0000 (+0000) Subject: Add obuck_bucket_size(). X-Git-Tag: holmes-import~1135 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a1f1a168afb76c857d5bd66f894c90d03b90b7ed;p=libucw.git Add obuck_bucket_size(). --- diff --git a/lib/bucket.h b/lib/bucket.h index b493305d..b6f584a8 100644 --- a/lib/bucket.h +++ b/lib/bucket.h @@ -1,7 +1,7 @@ /* * Sherlock Library -- Object Buckets * - * (c) 2001--2003 Martin Mares + * (c) 2001--2004 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -84,6 +84,13 @@ static inline sh_off_t obuck_get_pos(oid_t oid) return ((sh_off_t) oid) << OBUCK_SHIFT; } +/* Calculate size of bucket which contains given amount of data */ + +static inline uns obuck_bucket_size(uns len) +{ + return ALIGN(sizeof(struct obuck_header) + len + 4, OBUCK_ALIGN); +} + /* Shaking down bucket file */ void obuck_shakedown(int (*kibitz)(struct obuck_header *old, oid_t new, byte *buck));