summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/drawmouse/drawmouse.c2
-rw-r--r--src/user/app/init/driver/ps2.c2
-rw-r--r--src/user/app/tests/shared/ringbuf.c16
3 files changed, 11 insertions, 9 deletions
diff --git a/src/user/app/drawmouse/drawmouse.c b/src/user/app/drawmouse/drawmouse.c
index 7e7c55b..47e8e8a 100644
--- a/src/user/app/drawmouse/drawmouse.c
+++ b/src/user/app/drawmouse/drawmouse.c
@@ -66,7 +66,7 @@ int main(void) {
int len = _syscall_read(fd, buf, sizeof buf, 0);
if (len == 0) break;
ring_put(&r, buf, len);
- while (ring_size(&r) >= 3) {
+ while (ring_used(&r) >= 3) {
struct packet p;
ring_get(&r, &p, sizeof p);
p.dy *= -1;
diff --git a/src/user/app/init/driver/ps2.c b/src/user/app/init/driver/ps2.c
index 961ea53..85b83b7 100644
--- a/src/user/app/init/driver/ps2.c
+++ b/src/user/app/init/driver/ps2.c
@@ -61,7 +61,7 @@ static void main_loop(void) {
break;
case VFSOP_READ:
- while (ring_size((void*)&backlog) == 0) {
+ while (ring_used((void*)&backlog) == 0) {
/* read raw input until we have something to output */
int len = _syscall_read(fd, buf, sizeof buf, 0);
if (len == 0) break;
diff --git a/src/user/app/tests/shared/ringbuf.c b/src/user/app/tests/shared/ringbuf.c
index 7330bbe..d4e8dc9 100644
--- a/src/user/app/tests/shared/ringbuf.c
+++ b/src/user/app/tests/shared/ringbuf.c
@@ -11,34 +11,36 @@ static void test_ringbuf(void) {
/* aliasing */
for (size_t i = 0; i < 16; i++) {
- test(ring_size(&r) == 0);
+ test(ring_used(&r) == 0);
+ test(ring_avail(&r) == 16);
ring_put(&r, "11 bytes...", 11);
- test(ring_size(&r) == 11);
+ test(ring_used(&r) == 11);
+ test(ring_avail(&r) == 5);
memset(cmpbuf, 0, sizeof cmpbuf);
test(ring_get(&r, cmpbuf, 16) == 11);
test(memcmp(cmpbuf, "11 bytes...", 11) == 0);
}
- test(ring_size(&r) == 0);
+ test(ring_used(&r) == 0);
for (size_t i = 0; i < 7; i++)
ring_put1b(&r, num_written++);
- test(ring_size(&r) == 7);
+ test(ring_used(&r) == 7);
for (size_t i = 0; i < 3; i++) {
ring_get(&r, &c, 1);
test(num_read++ == c);
}
- test(ring_size(&r) == 4);
+ test(ring_used(&r) == 4);
for (size_t j = 0; j < 40; j++) {
for (size_t i = 0; i < 7; i++)
ring_put1b(&r, num_written++ & 0xff);
- test(ring_size(&r) == 11);
+ test(ring_used(&r) == 11);
for (size_t i = 0; i < 7; i++) {
ring_get(&r, &c, 1);
test((num_read++ & 0xff) == c);
}
- test(ring_size(&r) == 4);
+ test(ring_used(&r) == 4);
}
}