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

Writing to a vnode: to its device, or through its filesystem. More...

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

Go to the source code of this file.

Functions

ssize_t vfs_write_io (struct vnode *vnode, off_t off, struct iobuf *io)
 Writes to a vnode from an iobuf (user or kernel memory).
ssize_t vfs_write (struct vnode *vnode, off_t off, size_t size, void *buf)
 Writes to a vnode from a kernel buffer.

Detailed Description

Writing to a vnode: to its device, or through its filesystem.

Definition in file write.c.

Function Documentation

◆ vfs_write()

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

Writes to a vnode from a kernel buffer.

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

Definition at line 60 of file write.c.

References iobuf_init(), vfs_write(), and vfs_write_io().

Referenced by ext2_io(), minix_block_alloc(), minix_block_free(), minix_block_write(), minix_inode_alloc(), minix_inode_free(), minix_inode_write(), minix_superblock_rewrite(), vfs_symlink(), and vfs_write().

◆ vfs_write_io()

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

Writes to a vnode from an iobuf (user or kernel memory).

The file's pages in the page cache, if it's mapped, are refreshed.

Parameters
vnodethe vnode
offwhere to write
iothe data, and how much of it
Returns
the number of bytes written, -EINVAL for an invalid vnode, -ENOSYS if its filesystem can't write, or another negative errno

Definition at line 22 of file write.c.

References vnode::fs, ISDEV, kdev_write(), LOG_DEBUG, iobuf::resid, vfs_write_io(), VNODE_DEV, vnode_pages_update(), fs::vops, and vops::write.

Referenced by posix_file_write(), vfs_write(), and vfs_write_io().