summaryrefslogtreecommitdiff
path: root/kern/cbuf.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-24 06:45:44 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-24 06:48:21 +0100
commit7dcf6715ffb3cc2f00f6327b896d16f173a1b082 (patch)
tree210570e98e074d7abade0d22c64e05b9c02435ba /kern/cbuf.c
parentbe5b9d6ab9f7e7a81c367e4bb0823ba11f85940f (diff)
New errno.h standard header
Use standard errno codes. This change also adds strerror to string.h.
Diffstat (limited to 'kern/cbuf.c')
-rw-r--r--kern/cbuf.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kern/cbuf.c b/kern/cbuf.c
index 2093f428..ad3bead6 100644
--- a/kern/cbuf.c
+++ b/kern/cbuf.c
@@ -16,12 +16,12 @@
*/
#include <assert.h>
+#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <kern/cbuf.h>
-#include <kern/error.h>
#include <kern/macros.h>
/* Negative close to 0 so that an overflow occurs early */
@@ -62,7 +62,7 @@ cbuf_push(struct cbuf *cbuf, const void *buf, size_t size, bool erase)
free_size = cbuf_capacity(cbuf) - cbuf_size(cbuf);
if (size > free_size) {
- return ERROR_AGAIN;
+ return EAGAIN;
}
}
@@ -75,7 +75,7 @@ cbuf_pop(struct cbuf *cbuf, void *buf, size_t *sizep)
int error;
if (cbuf_size(cbuf) == 0) {
- return ERROR_AGAIN;
+ return EAGAIN;
}
error = cbuf_read(cbuf, cbuf_start(cbuf), buf, sizep);
@@ -93,7 +93,7 @@ cbuf_pushb(struct cbuf *cbuf, uint8_t byte, bool erase)
free_size = cbuf_capacity(cbuf) - cbuf_size(cbuf);
if (free_size == 0) {
- return ERROR_AGAIN;
+ return EAGAIN;
}
}
@@ -109,7 +109,7 @@ cbuf_popb(struct cbuf *cbuf, void *bytep)
uint8_t *ptr;
if (cbuf_size(cbuf) == 0) {
- return ERROR_AGAIN;
+ return EAGAIN;
}
ptr = bytep;
@@ -125,7 +125,7 @@ cbuf_write(struct cbuf *cbuf, size_t index, const void *buf, size_t size)
size_t new_end, skip;
if (!cbuf_range_valid(cbuf, index, cbuf->end)) {
- return ERROR_INVAL;
+ return EINVAL;
}
new_end = index + size;
@@ -166,7 +166,7 @@ cbuf_read(const struct cbuf *cbuf, size_t index, void *buf, size_t *sizep)
/* At least one byte must be available */
if (!cbuf_range_valid(cbuf, index, index + 1)) {
- return ERROR_INVAL;
+ return EINVAL;
}
size = cbuf->end - index;