|
AquilaOS documentation
How it works, and its code
|
minix: the vnode operations: reading and writing files, directories, making nodes, and truncating. More...
Go to the source code of this file.
Functions | |
| ssize_t | minix_read (struct vnode *vnode, off_t offset, struct iobuf *io) |
| Reads from a file. | |
| ssize_t | minix_write (struct vnode *vnode, off_t offset, struct iobuf *io) |
| Writes to a file, which grows if the write goes past its end. | |
| ssize_t | minix_readdir (struct vnode *dir, off_t off, struct dirent *dirent) |
| Reads a directory's entry at an offset; unused entries don't count. | |
| int | minix_vmknod (struct vnode *dir, const char *fn, mode_t mode, dev_t dev, struct uio *uio, struct vnode **ref) |
| Makes a node in a directory: a new inode, and an entry for it. | |
| int | minix_finddir (struct vnode *dir, const char *fn, struct dirent *dirent) |
| Finds the entry of a directory that has a name. | |
| int | minix_vget (struct vnode *super, ino_t ino, struct vnode **ref) |
| Gets the vnode of an inode, by its number. | |
| int | minix_trunc (struct vnode *vnode, off_t len) |
| Changes a file's length. | |
minix: the vnode operations: reading and writing files, directories, making nodes, and truncating.
A file's data moves one block at a time through a kernel buffer: the block's piece of the iobuf is copied into or out of it.
Definition in file vops.c.
| int minix_finddir | ( | struct vnode * | dir, |
| const char * | fn, | ||
| struct dirent * | dirent ) |
Finds the entry of a directory that has a name.
Only the entry's inode number is filled in.
| dir | the directory |
| fn | the name |
| dirent | if not NULL, the entry |
Definition at line 324 of file vops.c.
References vnode::ino, minix_dentry_find(), minix_finddir(), minix_inode_read(), minix_inode::mode, and vnode::p.
Referenced by minix_finddir().
Reads from a file.
| vnode | the file |
| offset | where to read from |
| io | where the data goes, and how much is wanted |
Definition at line 21 of file vops.c.
References minix::bs, vnode::ino, iobuf_out(), kfree(), kmalloc(), MIN, minix_inode_block_read(), minix_inode_read(), minix_read(), vnode::p, iobuf::resid, and minix_inode::size.
Referenced by minix_read().
Reads a directory's entry at an offset; unused entries don't count.
| dir | the directory |
| off | which entry |
| dirent | the entry, filled in |
Definition at line 151 of file vops.c.
References minix::bs, minix::dentry_size, minix_dentry::ino, vnode::ino, memcpy(), minix_inode_block_read(), minix_inode_read(), minix_readdir(), minix_inode::mode, vnode::mode, minix_dentry::name, minix::name_len, vnode::p, and minix_inode::size.
Referenced by minix_readdir().
Changes a file's length.
A file that grows reads zeros past its old end; a file that shrinks frees its zones past the new end.
| vnode | the file |
| len | the new length, in bytes |
Definition at line 380 of file vops.c.
References minix::bs, vnode::ino, kfree(), kmalloc(), memset(), minix_inode_block_read(), minix_inode_block_write(), minix_inode_read(), minix_inode_sync(), minix_inode_write(), minix_trunc(), minix_zones_free(), vnode::p, minix_inode::size, and vnode::size.
Referenced by minix_trunc(), and minix_write().
Gets the vnode of an inode, by its number.
| super | any vnode of the filesystem |
| ino | the inode number |
| ref | if not NULL, set to the vnode |
Definition at line 363 of file vops.c.
References minix_inode_build(), minix_vget(), and vnode::p.
Referenced by minix_vget().
| int minix_vmknod | ( | struct vnode * | dir, |
| const char * | fn, | ||
| mode_t | mode, | ||
| dev_t | dev, | ||
| struct uio * | uio, | ||
| struct vnode ** | ref ) |
Makes a node in a directory: a new inode, and an entry for it.
A new directory gets its . and .. entries.
| dir | the directory |
| fn | the new node's name |
| mode | its type (S_IF*) and permissions |
| dev | its device number, for a device node |
| uio | who is asking (the owner) |
| ref | if not NULL, set to the new vnode |
Definition at line 216 of file vops.c.
References minix::bs, minix::dentry_size, DEV, DEV_MAJOR, DEV_MINOR, minix_inode::gid, uio::gid, minix_dentry::ino, vnode::ino, memcpy(), memset(), minix_dentry_create(), minix_dentry_find(), minix_inode_alloc(), minix_inode_block_write(), minix_inode_build(), minix_inode_free(), minix_inode_read(), minix_inode_write(), minix_vmknod(), minix_zones_free(), minix_inode::mode, minix_dentry::name, vnode::nlink, minix_inode::nlinks, vnode::p, minix_inode::size, minix_inode::uid, uio::uid, and minix_inode::zones.
Referenced by minix_vmknod().
Writes to a file, which grows if the write goes past its end.
| vnode | the file |
| offset | where to write |
| io | the data, and how much of it |
Definition at line 75 of file vops.c.
References minix::bs, vnode::ino, iobuf_in(), kfree(), kmalloc(), MAX, MIN, minix_inode_block_read(), minix_inode_block_write(), minix_inode_read(), minix_inode_write(), minix_trunc(), minix_write(), vnode::p, iobuf::resid, minix_inode::size, and vnode::size.
Referenced by minix_write().