diff options
| author | Jake Mannens <jakem_5@hotmail.com> | 2020-03-18 14:01:12 +1100 |
|---|---|---|
| committer | Jake Mannens <jakem_5@hotmail.com> | 2020-03-18 14:01:12 +1100 |
| commit | 4d6fe1c317f0a541922f4cf945365fd31e608e10 (patch) | |
| tree | b78f721d50924094d4926ee90131a98ba12eb95e /kernel/tty.c | |
| parent | eda36531e8daedd045fb02c9c590cdf4dddd957f (diff) | |
Added decimal and octal conversion specifiers ('%d' and '%o') to
vsprintf().
Coverted all printk()/printf() functions to capatalised hex for
readability.
Tidied up some code.
Diffstat (limited to 'kernel/tty.c')
| -rw-r--r-- | kernel/tty.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/kernel/tty.c b/kernel/tty.c index a17429f..e7e55f4 100644 --- a/kernel/tty.c +++ b/kernel/tty.c @@ -79,12 +79,8 @@ ssize_t tty_read(unsigned tty, void *buf, size_t len) { for(i = 0; i < len; i++) { /* check if the buffer's empty and if so, go to sleep */ - if(sleep_while_empty(q) < 0) { - if(i == 0) - return -EINTR; - - return i; - } + if(sleep_while_empty(q) < 0) + return i == 0 ? -EINTR : i; *b++ = q->buf[q->pread]; q->pread = (q->pread + 1) % TTY_BUF_SIZE; @@ -109,12 +105,8 @@ ssize_t tty_write(unsigned tty, void *buf, size_t len) { for(i = 0; i < len; i++) { /* check if the buffer's full and if so, go to sleep */ - if(sleep_while_full(q, ttys[tty]) < 0) { - if(i == 0) - return -EINTR; - - return i; - } + if(sleep_while_full(q, ttys[tty]) < 0) + return i == 0 ? -EINTR : i; q->buf[q->pwrite] = *b++; q->pwrite = (q->pwrite + 1) % TTY_BUF_SIZE; |
