AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
posix.h
Go to the documentation of this file.
1#ifndef __FS_POSIX_H
2#define __FS_POSIX_H
3
4#include <fs/vfs.h>
5
6/* The usual file operations (fs/posix/), which most filesystems and
7 * devices use: they call the vnode's operations. */
8
9int posix_file_open(struct file *file);
10int posix_file_close(struct file *file);
11ssize_t posix_file_read(struct file *file, struct iobuf *io);
12ssize_t posix_file_write(struct file *file, struct iobuf *io);
13ssize_t posix_file_readdir(struct file *file, struct dirent *dirent);
14int posix_file_ioctl(struct file *file, int request, void *argp);
15off_t posix_file_lseek(struct file *file, off_t offset, int whence);
16int posix_file_trunc(struct file *file, off_t len);
17
18int posix_file_eof(struct file *file);
19
20#endif /* ! __FS_POSIX_H */
int posix_file_eof(struct file *file)
Says whether a file's offset is at or past its end, so that a read returns nothing.
Definition helpers.c:17
off_t posix_file_lseek(struct file *file, off_t offset, int whence)
Moves an open file's offset: to offset (SEEK_SET), by offset from where it is (SEEK_CUR),...
Definition lseek.c:22
int posix_file_open(struct file *file)
Finishes opening a file: with O_TRUNC, a regular file is truncated to 0 bytes.
Definition open.c:17
int posix_file_close(struct file *file)
Closes an open file by dropping its reference to its vnode.
Definition close.c:15
int posix_file_ioctl(struct file *file, int request, void *argp)
Passes an ioctl() request on to the file's vnode (a device's, or its filesystem's).
Definition ioctl.c:19
ssize_t posix_file_read(struct file *file, struct iobuf *io)
Reads from an open file at its offset, and moves the offset past what was read.
Definition read.c:29
ssize_t posix_file_readdir(struct file *file, struct dirent *dirent)
Reads the directory entry at an open directory's offset, and moves the offset past it.
Definition readdir.c:22
int posix_file_trunc(struct file *file, off_t len)
Truncates (or extends) an open file to a new length.
Definition trunc.c:16
ssize_t posix_file_write(struct file *file, struct iobuf *io)
Writes to an open file at its offset, and moves the offset past what was written.
Definition write.c:25
An open file (POSIX's "open file description", fs/file.c).
Definition vfs.h:157
An iobuf.
Definition iobuf.h:35
long int ssize_t
Definition types.h:12
long int off_t
Definition types.h:10