CS318 - Pintos
Pintos source browser for JHU CS318 course
file.h
Go to the documentation of this file.
1 #ifndef FILESYS_FILE_H
2 #define FILESYS_FILE_H
3 
4 #include "filesys/off_t.h"
5 
6 struct inode;
7 
8 /** Opening and closing files. */
9 struct file *file_open (struct inode *);
10 struct file *file_reopen (struct file *);
11 void file_close (struct file *);
12 struct inode *file_get_inode (struct file *);
13 
14 /** Reading and writing. */
15 off_t file_read (struct file *, void *, off_t);
16 off_t file_read_at (struct file *, void *, off_t size, off_t start);
17 off_t file_write (struct file *, const void *, off_t);
18 off_t file_write_at (struct file *, const void *, off_t size, off_t start);
19 
20 /** Preventing writes. */
21 void file_deny_write (struct file *);
22 void file_allow_write (struct file *);
23 
24 /** File position. */
25 void file_seek (struct file *, off_t);
26 off_t file_tell (struct file *);
27 off_t file_length (struct file *);
28 
29 #endif /**< filesys/file.h */
start
char * start[]
Insult.c.
Definition: insult.c:13
off_t.h
file_write
off_t file_write(struct file *, const void *, off_t)
Writes SIZE bytes from BUFFER into FILE, starting at the file's current position.
Definition: file.c:95
file_deny_write
void file_deny_write(struct file *)
Preventing writes.
Definition: file.c:119
file_read_at
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.
Definition: file.c:82
file
An open file.
Definition: file.c:7
off_t
int32_t off_t
An offset within a file.
Definition: off_t.h:9
file_get_inode
struct inode * file_get_inode(struct file *)
Returns the inode encapsulated by FILE.
Definition: file.c:58
file_close
void file_close(struct file *)
Closes FILE.
Definition: file.c:46
file_length
off_t file_length(struct file *)
filesys/file.h
Definition: file.c:145
inode
In-memory inode.
Definition: inode.c:32
file_allow_write
void file_allow_write(struct file *)
Re-enables write operations on FILE's underlying inode.
Definition: file.c:133
file_read
off_t file_read(struct file *, void *, off_t)
Reading and writing.
Definition: file.c:69
file_write_at
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.
Definition: file.c:110
file_reopen
struct file * file_reopen(struct file *)
Opens and returns a new file for the same inode as FILE.
Definition: file.c:39
file_tell
off_t file_tell(struct file *)
Returns the current position in FILE as a byte offset from the start of the file.
Definition: file.c:164
file_open
struct file * file_open(struct inode *)
Opening and closing files.
Definition: file.c:18
file_seek
void file_seek(struct file *, off_t)
File position.
Definition: file.c:154