#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
off_t file_write_at(struct file *file, const void *buffer, off_t size, off_t file_ofs)
Writes SIZE bytes from BUFFER into FILE, starting at offset FILE_OFS in the file.
void file_seek(struct file *file, off_t new_pos)
Sets the current position in FILE to NEW_POS bytes from the start of the file.
void file_close(struct file *file)
Closes FILE.
struct file * file_open(struct inode *inode)
Opens a file for the given INODE, of which it takes ownership, and returns the new file.
off_t file_write(struct file *file, const void *buffer, off_t size)
Writes SIZE bytes from BUFFER into FILE, starting at the file's current position.
struct file * file_reopen(struct file *file)
Opens and returns a new file for the same inode as FILE.
off_t file_length(struct file *file)
Returns the size of FILE in bytes.
off_t file_read_at(struct file *file, void *buffer, off_t size, off_t file_ofs)
Reads SIZE bytes from FILE into BUFFER, starting at offset FILE_OFS in the file.
void file_deny_write(struct file *file)
Prevents write operations on FILE's underlying inode until file_allow_write() is called or FILE is cl...
off_t file_read(struct file *file, void *buffer, off_t size)
Reads SIZE bytes from FILE into BUFFER, starting at the file's current position.
off_t file_tell(struct file *file)
Returns the current position in FILE as a byte offset from the start of the file.
struct inode * file_get_inode(struct file *file)
Returns the inode encapsulated by FILE.
void file_allow_write(struct file *file)
Re-enables write operations on FILE's underlying inode.
off_t inode_write_at(struct inode *inode, const void *buffer_, off_t size, off_t offset)
Writes SIZE bytes from BUFFER into INODE, starting at OFFSET.
off_t inode_read_at(struct inode *inode, void *buffer_, off_t size, off_t offset)
Reads SIZE bytes from INODE into BUFFER, starting at position OFFSET.
struct inode * inode_reopen(struct inode *inode)
Reopens and returns INODE.
off_t inode_length(const struct inode *inode)
Returns the length, in bytes, of INODE's data.
void inode_close(struct inode *inode)
Closes INODE and writes it to disk.
void inode_deny_write(struct inode *inode)
Disables writes to INODE.
void inode_allow_write(struct inode *inode)
Re-enables writes to INODE.
void * calloc(size_t a, size_t b)
Allocates and return A times B bytes initialized to zeroes.
void free(void *p)
Frees block P, which must have been previously allocated with malloc(), calloc(), or realloc().
int32_t off_t
An offset within a file.
struct inode * inode
File's inode.
bool deny_write
Has file_deny_write() been called?
off_t pos
Current position.