X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fbucket.h;h=759ef0e4761e4b035d8242a7bc57339bdb4f1280;hb=34289767d57bb8845699c819362d286bd51c8952;hp=7cc5d76c4932847217e364456f536a17d0a52ba3;hpb=4390bf90103265fe6e11f4c446b78f38bdc132b3;p=libucw.git diff --git a/lib/bucket.h b/lib/bucket.h index 7cc5d76c..759ef0e4 100644 --- a/lib/bucket.h +++ b/lib/bucket.h @@ -24,6 +24,7 @@ extern byte *obuck_name; /* Internal, for use by buckettool only! */ #define OBUCK_INCOMPLETE_MAGIC 0xdeadfeel #define OBUCK_TRAILER 0xfeedcafe #define OBUCK_OID_DELETED (~(oid_t)0) +#define OBUCK_OID_FIRST_SPECIAL (~(oid_t)0xffff) struct obuck_header { u32 magic; /* OBUCK_MAGIC should dwell here */ @@ -54,3 +55,13 @@ 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; +} + +/* Shaking down bucket file */ +void obuck_shakedown(int (*kibitz)(struct obuck_header *old, oid_t new, byte *buck));