PKUOS - Pintos
Pintos source browser for PKU Operating System 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
6struct inode;
7
8/** Opening and closing files. */
9struct file *file_open (struct inode *);
10struct file *file_reopen (struct file *);
11void file_close (struct file *);
12struct inode *file_get_inode (struct file *);
13
14/** Reading and writing. */
15off_t file_read (struct file *, void *, off_t);
16off_t file_read_at (struct file *, void *, off_t size, off_t start);
17off_t file_write (struct file *, const void *, off_t);
18off_t file_write_at (struct file *, const void *, off_t size, off_t start);
19
20/** Preventing writes. */
21void file_deny_write (struct file *);
22void file_allow_write (struct file *);
23
24/** File position. */
25void file_seek (struct file *, off_t);
26off_t file_tell (struct file *);
27off_t file_length (struct file *);
28
29#endif /**< filesys/file.h */
struct inode * file_get_inode(struct file *)
Returns the inode encapsulated by FILE.
Definition: file.c:58
void file_close(struct file *)
Closes FILE.
Definition: file.c:46
struct file * file_open(struct inode *)
Opening and closing files.
Definition: file.c:18
off_t file_read(struct file *, void *, off_t)
Reading and writing.
Definition: file.c:69
off_t file_length(struct file *)
filesys/file.h
Definition: file.c:145
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
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
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
struct file * file_reopen(struct file *)
Opens and returns a new file for the same inode as FILE.
Definition: file.c:39
void file_seek(struct file *, off_t)
File position.
Definition: file.c:154
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
void file_deny_write(struct file *)
Preventing writes.
Definition: file.c:119
void file_allow_write(struct file *)
Re-enables write operations on FILE's underlying inode.
Definition: file.c:133
char * start[]
Insult.c.
Definition: insult.c:13
int32_t off_t
An offset within a file.
Definition: off_t.h:9
An open file.
Definition: file.c:8
In-memory inode.
Definition: inode.c:33