still serv_close bug...
[mit-jos.git] / fs / fs.h
bloba7fa892cd5f9c43a9a1b3c4aa24ac4683639d504
1 #include <inc/fs.h>
2 #include <inc/lib.h>
4 #define SECTSIZE 512 // bytes per disk sector
5 #define BLKSECTS (BLKSIZE / SECTSIZE) // sectors per block
7 /* Disk block n, when in memory, is mapped into the file system
8 * server's address space at DISKMAP + (n*BLKSIZE). */
9 #define DISKMAP 0x10000000
11 /* Maximum disk size we can handle (3GB) */
12 #define DISKSIZE 0xC0000000
14 /* ide.c */
15 bool ide_probe_disk1(void);
16 void ide_set_disk(int diskno);
17 int ide_read(uint32_t secno, void *dst, size_t nsecs);
18 int ide_write(uint32_t secno, const void *src, size_t nsecs);
20 /* fs.c */
21 int file_create(const char *path, struct File **f);
22 int file_open(const char *path, struct File **f);
23 int file_get_block(struct File *f, uint32_t file_blockno, char **pblk);
24 int file_set_size(struct File *f, off_t newsize);
25 void file_flush(struct File *f);
26 void file_close(struct File *f);
27 int file_remove(const char *path);
28 void fs_init(void);
29 int file_dirty(struct File *f, off_t offset);
30 void fs_sync(void);
32 extern uint32_t *bitmap;
33 int map_block(uint32_t);
34 int alloc_block(void);
36 /* test.c */
37 void fs_test(void);