|
AquilaOS documentation
How it works, and its code
|
#include <core/system.h>Go to the source code of this file.
Data Structures | |
| struct | iobuf_seg |
| A piece of an iobuf's memory. More... | |
| struct | iobuf |
| An iobuf. More... | |
Functions | |
| void | iobuf_init (struct iobuf *io, void *buf, size_t len, int user) |
| Sets up an iobuf for one buffer. | |
| 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. | |
| size_t | iobuf_skip (struct iobuf *io, size_t n) |
| Moves an iobuf past bytes, without copying them. | |
| static size_t | iobuf_limit (struct iobuf *io, size_t n) |
| Cuts the buffer to n bytes for a while, so that what it's passed to moves no more. | |
| static void | iobuf_unlimit (struct iobuf *io, size_t cut) |
| Gives back what iobuf_limit() cut. | |
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().
Cuts the buffer to n bytes for a while, so that what it's passed to moves no more.
Returns how much was cut, which iobuf_unlimit() gives back.
Definition at line 72 of file iobuf.h.
References iobuf::resid.
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().