+static int
+fbbuf_seek(struct fastbuf *f, sh_off_t pos, int whence)
+{
+ /* Somebody might want to seek to the end of buffer, try to be nice to him. */
+ sh_off_t len = f->bufend - f->buffer;
+ if (whence == SEEK_END)
+ pos += len;
+ ASSERT(pos >= 0 && pos <= len);
+ f->bptr = f->buffer + pos;
+ f->bstop = f->bufend;
+ f->pos = len;
+ return 1;
+}
+