AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
read.c File Reference

Reading from a vnode: from its device, or through its filesystem. More...

#include <core/system.h>
#include <fs/vfs.h>
#include <fs/iobuf.h>
#include <dev/dev.h>

Go to the source code of this file.

Functions

ssize_t vfs_read_io (struct vnode *vnode, off_t off, struct iobuf *io)
 Reads from a vnode into an iobuf (user or kernel memory).
ssize_t vfs_read (struct vnode *vnode, off_t off, size_t size, void *buf)
 Reads from a vnode into a kernel buffer.

Detailed Description

Reading from a vnode: from its device, or through its filesystem.

Definition in file read.c.

Function Documentation

◆ vfs_read()

ssize_t vfs_read ( struct vnode * vnode,
off_t off,
size_t size,
void * buf )

Reads from a vnode into a kernel buffer.

Parameters
vnodethe vnode
offwhere to read from
sizehow many bytes to read
bufthe buffer
Returns
the number of bytes read, or a negative errno

Definition at line 52 of file read.c.

References iobuf_init(), vfs_read(), and vfs_read_io().

Referenced by binfmt_elf_check(), binfmt_elf_load_segments(), cpio_load(), exec_script(), ext2_io(), ext2_load(), link_path(), minix_block_read(), minix_inode_read(), minix_load(), vfs_read(), vfs_readlink(), vnode_page_in(), and vnode_pages_update().

◆ vfs_read_io()

ssize_t vfs_read_io ( struct vnode * vnode,
off_t off,
struct iobuf * io )

Reads from a vnode into an iobuf (user or kernel memory).

Parameters
vnodethe vnode
offwhere to read from
iowhere the data goes, and how much is wanted
Returns
the number of bytes read, -EINVAL for an invalid vnode, -ENOSYS if its filesystem can't read, or another negative errno

Definition at line 20 of file read.c.

References vnode::fs, ISDEV, kdev_read(), LOG_DEBUG, vops::read, iobuf::resid, vfs_read_io(), VNODE_DEV, and fs::vops.

Referenced by cpio_read(), posix_file_read(), vfs_read(), and vfs_read_io().