copy of data during read/write at expense of having to be prepared for
any data size the buffering layer tells them to read/write.
}
die("%s: Line too long", f->name);
}
+
+int
+bdirect_read(struct fastbuf *f, byte **buf)
+{
+ int len;
+
+ if (f->bptr == f->bstop && !f->refill(f))
+ return EOF;
+ *buf = f->bptr;
+ len = f->bstop - f->bptr;
+ f->bptr += len;
+ return len;
+}
+
+int
+bdirect_write_prepare(struct fastbuf *f, byte **buf)
+{
+ if (f->bptr == f->bufend)
+ f->spout(f);
+ *buf = f->bptr;
+ return f->bufend - f->bptr;
+}
+
+void
+bdirect_write_commit(struct fastbuf *f, byte *pos)
+{
+ f->bptr = pos;
+}
bputc(f, '\n');
}
+/* Direct I/O on buffers */
+
+int bdirect_read(struct fastbuf *f, byte **buf);
+int bdirect_write_prepare(struct fastbuf *f, byte **buf);
+void bdirect_write_commit(struct fastbuf *f, byte *pos);
+
/* Depending on compile-time configuration, we select the right function for reading/writing of file offsets */
#ifdef SHERLOCK_CONFIG_LARGE_DB