s/disk_sector_no/disk_sector_t/g
[pintos-anon] / src / filesys / filehdr.h
1 #ifndef HEADER_FILEHDR_H
2 #define HEADER_FILEHDR_H 1
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include "disk.h"
7 #include "off_t.h"
8
9 #define DIRECT_CNT ((DISK_SECTOR_SIZE - sizeof (off_t) * 2)     \
10                     / sizeof (disk_sector_t))
11
12 struct filehdr 
13   {
14     off_t length;
15     size_t sector_cnt;
16     disk_sector_t sectors[DIRECT_CNT];
17   };
18
19 struct bitmap;
20 struct filehdr *filehdr_allocate (struct bitmap *, off_t length);
21 void filehdr_deallocate (struct filehdr *, struct bitmap *);
22 struct filehdr *filehdr_read (disk_sector_t);
23 void filehdr_write (const struct filehdr *, disk_sector_t);
24 void filehdr_destroy (struct filehdr *);
25 disk_sector_t filehdr_byte_to_sector (const struct filehdr *, off_t);
26 off_t filehdr_length (const struct filehdr *);
27 void filehdr_print (const struct filehdr *);
28
29 #endif /* filehdr.h */