d165e80bf427123fcd41f1634e5de9cbf117a9b6
[pintos-anon] / src / filesys / file.h
1 #ifndef HEADER_FILE_H
2 #define HEADER_FILE_H 1
3
4 #include <stdint.h>
5 #include <stddef.h>
6
7 #ifndef OFF_T
8 #define OFF_T
9 typedef int32_t off_t;
10 #endif
11
12 struct file 
13   {
14     struct filehdr *hdr;
15     off_t pos;
16   };
17
18 bool file_open (struct file *, const char *name);
19 bool file_open_sector (struct file *, disk_sector_no);
20 void file_close (struct file *);
21 off_t file_read (struct file *, void *, off_t);
22 off_t file_read_at (struct file *, void *, off_t size, off_t start);
23 off_t file_write (struct file *, const void *, off_t);
24 off_t file_write_at (struct file *, const void *, off_t size, off_t start);
25 off_t file_length (struct file *);
26 void file_seek (struct file *, off_t);
27 off_t file_tell (struct file *);
28
29 #endif /* file.h */