Skip to content
Snippets Groups Projects
Commit 9afc4558 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

implement vectored writes in the console driver

parent a3bf30f9
No related branches found
No related tags found
No related merge requests found
...@@ -24,14 +24,20 @@ void write(const char *msg, size_t len, bool lf) ...@@ -24,14 +24,20 @@ void write(const char *msg, size_t len, bool lf)
static int static int
console_write(struct device *dev, struct uio *uio, int ioflag) console_write(struct device *dev, struct uio *uio, int ioflag)
{ {
if (uio->uio_iovcnt != 1) while (uio->uio_resid > 0) {
return EINVAL; struct iovec *iov = uio->uio_iov;
const void *buf = uio->uio_iov->iov_base;
size_t count = uio->uio_iov->iov_len; if (iov->iov_len) {
console::write(reinterpret_cast<const char *>(buf), count, false); console::write(reinterpret_cast<const char *>(iov->iov_base),
iov->iov_len, false);
uio->uio_resid -= count; }
uio->uio_offset += count;
uio->uio_iov++;
uio->uio_iovcnt--;
uio->uio_resid -= iov->iov_len;
uio->uio_offset += iov->iov_len;
}
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment