summaryrefslogtreecommitdiff
path: root/kern/log.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-17 18:45:31 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-17 18:48:58 +0200
commit0a5af0a62ba2ed1c17404b1dd8ed15b0ff41abf7 (patch)
treee6e97bfdb129cd9a4a8e4db90b10460d71a17b1e /kern/log.c
parentbf32d26490a6fd688194f67856563f0a5a843668 (diff)
kern/cbuf: implement buffered reads and writes
This change brings an interface for fast buffered accesses to the content of a circular buffer, and also an interface to write into a circular buffer at custom locations, in exchange for a small interface break of cbuf_read.
Diffstat (limited to 'kern/log.c')
-rw-r--r--kern/log.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kern/log.c b/kern/log.c
index a3b34f37..9f95ca83 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -144,8 +144,8 @@ log_record_consume(struct log_record *record, char c, size_t *sizep)
static int
log_record_init_consume(struct log_record *record, unsigned long *indexp)
{
+ size_t size, c_size;
bool marker_found;
- size_t size;
int error;
char c;
@@ -161,7 +161,8 @@ log_record_init_consume(struct log_record *record, unsigned long *indexp)
break;
}
- error = cbuf_read(&log_cbuf, *indexp, &c);
+ c_size = 1;
+ error = cbuf_read(&log_cbuf, *indexp, &c, &c_size);
if (error) {
*indexp = cbuf_start(&log_cbuf);