(although the seek will be inside the buffer [and thence optimized out
by bseek()] under all reasonable circumstances [it was triggered by
a bug in buck2obj]).
return datasize;
}
+static void
+obuck_fb_seek(struct fastbuf *f, sh_off_t pos, int whence)
+{
+ ASSERT(whence == SEEK_SET || whence == SEEK_END);
+ if (whence == SEEK_END)
+ pos += FB_BUCKET(f)->bucket_size;
+ ASSERT(pos >= 0 && pos <= FB_BUCKET(f)->bucket_size);
+ f->pos = pos;
+}
+
static void
obuck_fb_spout(struct fastbuf *f)
{
b->pos = 0;
b->refill = obuck_fb_refill;
b->spout = NULL;
- b->seek = NULL;
+ b->seek = obuck_fb_seek;
b->close = obuck_fb_close;
b->config = NULL;
b->can_overwrite_buffer = 2;