* (c) 1997--2000 Martin Mares <mj@ucw.cz>
*/
+#ifndef _SHERLOCK_FASTBUF_H
+#define _SHERLOCK_FASTBUF_H
+
#ifndef EOF
#include <stdio.h>
#endif
bput5_slow(f, l);
}
-void bread_slow(struct fastbuf *f, void *b, uns l);
-static inline void bread(struct fastbuf *f, void *b, uns l)
+uns bread_slow(struct fastbuf *f, void *b, uns l);
+static inline uns bread(struct fastbuf *f, void *b, uns l)
{
if (f->bptr + l <= f->bstop)
{
memcpy(b, f->bptr, l);
f->bptr += l;
+ return l;
}
else
- bread_slow(f, b, l);
+ return bread_slow(f, b, l);
}
void bwrite_slow(struct fastbuf *f, void *b, uns l);
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
#define bgetp(f) bgetl(f)
#define bputp(f,l) bputl(f,l)
#endif
+
+#endif