|
AquilaOS documentation
How it works, and its code
|
iobufs: moving bytes into and out of the buffer of a read or a write, which may be in user memory (see fs/iobuf.h). More...
Go to the source code of this file.
Functions | |
| void | iobuf_init (struct iobuf *io, void *buf, size_t len, int user) |
| Sets up an iobuf for one buffer. | |
| static ssize_t | iobuf_copy (struct iobuf *io, char *kbuf, size_t n, int out) |
| Copies up to n bytes between the iobuf's buffer, from where it is, and kbuf: into the buffer if out is set, out of it otherwise, one segment at a time. | |
| size_t | iobuf_skip (struct iobuf *io, size_t n) |
| Moves an iobuf past bytes, without copying them. | |
| ssize_t | iobuf_out (struct iobuf *io, const void *src, size_t n) |
| Copies bytes from the kernel into the iobuf's buffer, and moves past them. | |
| ssize_t | iobuf_in (struct iobuf *io, void *dst, size_t n) |
| Copies bytes from the iobuf's buffer into the kernel, and moves past them. | |
| ssize_t | iobuf_peek (struct iobuf *io, void *dst, size_t n) |
| Copies bytes from the iobuf's buffer into the kernel, without moving past them. | |
| ssize_t | iobuf_zero (struct iobuf *io, size_t n) |
| Fills bytes of the iobuf's buffer with zeros, and moves past them. | |
iobufs: moving bytes into and out of the buffer of a read or a write, which may be in user memory (see fs/iobuf.h).
Definition in file iobuf.c.
Copies up to n bytes between the iobuf's buffer, from where it is, and kbuf: into the buffer if out is set, out of it otherwise, one segment at a time.
It doesn't move the iobuf past them. Returns how many bytes were copied (fewer if a fault stopped it), or -EFAULT if a fault came first.
Definition at line 36 of file iobuf.c.
References iobuf_seg::base, iobuf::fault, iobuf_copy(), iobuf_seg::len, memcpy(), MIN, iobuf::nseg, iobuf::resid, iobuf::seg, and iobuf::user.
Referenced by iobuf_copy(), iobuf_in(), iobuf_out(), and iobuf_peek().
Copies bytes from the iobuf's buffer into the kernel, and moves past them.
| io | the iobuf |
| dst | where they go |
| n | how many |
Definition at line 135 of file iobuf.c.
References iobuf_copy(), iobuf_in(), and iobuf_skip().
Referenced by ext2_write(), fbdev_vesa_write(), iobuf_in(), kdev_blk_io(), kmsgdev_write(), minix_write(), ps2mouse_write(), randomdev_write(), ringbuf_write_iobuf(), and tmpfs_write().
Sets up an iobuf for one buffer.
| io | the iobuf |
| buf | the buffer |
| len | its length, in bytes |
| user | whether the buffer is in user memory (copies are checked) |
Definition at line 19 of file iobuf.c.
References iobuf_seg::base, iobuf::fault, iobuf_init(), iobuf_seg::len, iobuf::nseg, iobuf::one, iobuf::resid, iobuf::seg, and iobuf::user.
Referenced by iobuf_init(), sys_read(), sys_recv(), sys_send(), sys_write(), vfs_read(), and vfs_write().
Copies bytes from the kernel into the iobuf's buffer, and moves past them.
| io | the iobuf |
| src | the bytes |
| n | how many |
Definition at line 115 of file iobuf.c.
References iobuf_copy(), iobuf_out(), and iobuf_skip().
Referenced by ext2_read(), iobuf_out(), iobuf_zero(), kdev_blk_io(), kmsgdev_read(), minix_read(), procfs_read(), randomdev_read(), ring_to_iobuf(), ringbuf_read_iobuf(), socket_inet_recv(), socket_tcp_recv(), tmpfs_read(), and vcs_read().
Copies bytes from the iobuf's buffer into the kernel, without moving past them.
| io | the iobuf |
| dst | where they go |
| n | how many |
Definition at line 154 of file iobuf.c.
References iobuf_copy(), and iobuf_peek().
Referenced by iobuf_peek(), iobuf_to_ring(), and tty_write_iobuf().
Moves an iobuf past bytes, without copying them.
| io | the iobuf |
| n | how many bytes (no more than are left) |
Definition at line 81 of file iobuf.c.
References iobuf_seg::base, iobuf_skip(), iobuf_seg::len, MIN, iobuf::nseg, iobuf::resid, and iobuf::seg.
Referenced by iobuf_in(), iobuf_out(), iobuf_skip(), iobuf_to_ring(), nulldev_write(), tty_write_iobuf(), and zerodev_write().
Fills bytes of the iobuf's buffer with zeros, and moves past them.
| io | the iobuf |
| n | how many |
Definition at line 167 of file iobuf.c.
References iobuf_out(), iobuf_zero(), MIN, and iobuf::resid.
Referenced by iobuf_zero(), and zerodev_read().