| 1 | #define FUSE_USE_VERSION 31 |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <string.h> |
| 5 | #include <stdarg.h> |
| 6 | #include <stdint.h> |
| 7 | #include <assert.h> |
| 8 | #include <errno.h> |
| 9 | #include <fcntl.h> |
| 10 | #include <dirent.h> |
| 11 | #include <time.h> |
| 12 | #include <sys/sysmacros.h> |
| 13 | |
| 14 | |
| 15 | #define nil NULL |
| 16 | typedef int8_t int8; |
| 17 | typedef uint8_t uint8; |
| 18 | typedef uint16_t uint16; |
| 19 | typedef int16_t int16; |
| 20 | typedef uint32_t uint32; |
| 21 | typedef int32_t int32; |
| 22 | typedef unsigned int uint; |
| 23 | |
| 24 | #define USED(x) ((void)x) |
| 25 | |
| 26 | /* the data containing our file system */ |
| 27 | extern uint8 *fsdata; |
| 28 | extern int fslen; |
| 29 | |
| 30 | void panic(char *fmt, ...); |
| 31 | void *emalloc(int size); |
| 32 | FILE *mustopen(const char *name, const char *mode); |
| 33 | |
| 34 | typedef struct Dirbuf Dirbuf; |
| 35 | struct Dirbuf |
| 36 | { |
| 37 | char *p; |
| 38 | size_t size; |
| 39 | }; |
| 40 | |
| 41 | typedef struct DInode DInode; |
| 42 | struct DInode; |
| 43 | |
| 44 | typedef struct Inode Inode; |
| 45 | struct Inode |
| 46 | { |
| 47 | int count; |
| 48 | int ino; /* not really needed */ |
| 49 | DInode *i; |
| 50 | }; |
| 51 | |
| 52 | void fs_init(void); |
| 53 | Inode *fs_iget(uint ino); |
| 54 | void fs_iput(Inode *ip); |
| 55 | int fs_open(uint ino, int flags); |
| 56 | int fs_stat(uint ino, struct stat *stbuf); |
| 57 | int fs_read(uint ino, void *vdst, int offset, int len); |
| 58 | int fs_write(uint ino, void *vsrc, int offset, int len); |
| 59 | struct dirent *fs_readdir(uint ino); |
| 60 | int fs_mknod(uint ino, const char *name, mode_t mode, dev_t rdev, uint *newino); |
| 61 | int fs_mkdir(uint ino, const char *name, mode_t mode); |
| 62 | int fs_unlink(uint parent, const char *name); |
| 63 | int fs_link(uint ino, uint parent, const char *name); |
| 64 | int fs_atime(uint ino, int32 time); |
| 65 | int fs_mtime(uint ino, int32 time); |
| 66 | int fs_uid(uint ino, int32 uid); |
| 67 | int fs_gid(uint ino, int32 gid); |
| 68 | |
| 69 | void dcheck(void); |