PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
#include "filesys/off_t.h"
Go to the source code of this file.
Functions | |
struct file * | file_open (struct inode *) |
Opening and closing files. More... | |
struct file * | file_reopen (struct file *) |
Opens and returns a new file for the same inode as FILE. More... | |
void | file_close (struct file *) |
Closes FILE. More... | |
struct inode * | file_get_inode (struct file *) |
Returns the inode encapsulated by FILE. More... | |
off_t | file_read (struct file *, void *, off_t) |
Reading and writing. More... | |
off_t | file_read_at (struct file *, void *, off_t size, off_t start) |
Reads SIZE bytes from FILE into BUFFER, starting at offset FILE_OFS in the file. More... | |
off_t | file_write (struct file *, const void *, off_t) |
Writes SIZE bytes from BUFFER into FILE, starting at the file's current position. More... | |
off_t | file_write_at (struct file *, const void *, off_t size, off_t start) |
Writes SIZE bytes from BUFFER into FILE, starting at offset FILE_OFS in the file. More... | |
void | file_deny_write (struct file *) |
Preventing writes. More... | |
void | file_allow_write (struct file *) |
Re-enables write operations on FILE's underlying inode. More... | |
void | file_seek (struct file *, off_t) |
File position. More... | |
off_t | file_tell (struct file *) |
Returns the current position in FILE as a byte offset from the start of the file. More... | |
off_t | file_length (struct file *) |
filesys/file.h More... | |
void file_allow_write | ( | struct file * | file | ) |
Re-enables write operations on FILE's underlying inode.
(Writes might still be denied by some other file that has the same inode open.)
Definition at line 133 of file file.c.
References ASSERT, file::deny_write, file::inode, inode_allow_write(), and NULL.
Referenced by file_close().
void file_close | ( | struct file * | file | ) |
Closes FILE.
Definition at line 46 of file file.c.
References file_allow_write(), free(), file::inode, inode_close(), and NULL.
Referenced by free_map_close(), fsutil_append(), fsutil_cat(), fsutil_extract(), and load().
void file_deny_write | ( | struct file * | file | ) |
Preventing writes.
Preventing writes.
Definition at line 119 of file file.c.
References ASSERT, file::deny_write, file::inode, inode_deny_write(), and NULL.
Returns the inode encapsulated by FILE.
Definition at line 58 of file file.c.
References file::inode.
Definition at line 145 of file file.c.
References ASSERT, file::inode, inode_length(), and NULL.
Referenced by fsutil_append(), load(), and validate_segment().
Opening and closing files.
Opening and closing files.
Returns a null pointer if an allocation fails or if INODE is null.
Definition at line 18 of file file.c.
References calloc(), file::deny_write, free(), file::inode, inode_close(), NULL, and file::pos.
Referenced by file_reopen(), filesys_open(), free_map_create(), and free_map_open().
Reading and writing.
Reading and writing.
Returns the number of bytes actually read, which may be less than SIZE if end of file is reached. Advances FILE's position by the number of bytes read.
Definition at line 69 of file file.c.
References buffer, file::inode, inode_read_at(), and file::pos.
Referenced by fsutil_append(), fsutil_cat(), load(), and load_segment().
Reads SIZE bytes from FILE into BUFFER, starting at offset FILE_OFS in the file.
Returns the number of bytes actually read, which may be less than SIZE if end of file is reached. The file's current position is unaffected.
Definition at line 82 of file file.c.
References buffer, file::inode, and inode_read_at().
Opens and returns a new file for the same inode as FILE.
Returns a null pointer if unsuccessful.
Definition at line 39 of file file.c.
References file_open(), file::inode, and inode_reopen().
Writes SIZE bytes from BUFFER into FILE, starting at the file's current position.
Returns the number of bytes actually written, which may be less than SIZE if end of file is reached. (Normally we'd grow the file in that case, but file growth is not yet implemented.) Advances FILE's position by the number of bytes read.
Definition at line 95 of file file.c.
References buffer, file::inode, inode_write_at(), and file::pos.
Referenced by fsutil_extract().
Writes SIZE bytes from BUFFER into FILE, starting at offset FILE_OFS in the file.
Returns the number of bytes actually written, which may be less than SIZE if end of file is reached. (Normally we'd grow the file in that case, but file growth is not yet implemented.) The file's current position is unaffected.
Definition at line 110 of file file.c.
References buffer, file::inode, and inode_write_at().