-
Notifications
You must be signed in to change notification settings - Fork 0
/
vfs.h
67 lines (60 loc) · 1.53 KB
/
vfs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef VFS_H
#define VFS_H
#include <stdint.h>
#include <stddef.h>
#include "driver.h"
#include "filesystem.h"
#define PATHMAXTOK 24
#define PATHMAX 128
#define MOUNTMAX 32
#define FDMAX 32
#define ERRORMAX 0xff
#define DIRRECORDSIZE 32
#define DIRMAX (4096 - 64)
#define O_CREAT 0x1
enum ERROR {
ESUCCESS = 0x00,
ENODATABLOCKS = -0x01,
EWRONGADDR = -0x02,
EBADDATABLOCK = -0x03,
EWRONGSIZE = -0x04,
EPATHTOOLONG = -0x05,
EINODENOTFOUND = -0x06,
ENAMENOTFOUND = -0x07,
ENOTADIR = -0x08,
ENOTAFILE = -0x09,
EDIRNOTEMPTY = -0x0a,
EALREADYEXISTS = -0x0b,
ESECTORTOOBIG = -0x0c,
EWRITETOOBIG = -0x0d,
EOUTOFMEMORY = -0x0e,
ENOTIMPLEMENTED = -0x0f,
EMOUNTNOTFOUND = -0x10,
EPATHTOOBIG = -0x11,
EMOUNTSISFULL = -0x12,
ENOROOT = -0x13,
ERUNOUTOFFD = -0x14,
EFDNOTSET = -0x15,
EISMOUNTPOINT = -0x16,
EWRONGPATH = -0x17,
EISADIR = -0x18
};
int vfsinit();
int format(const char *target);
int mount(struct bdevice *dev, const char *target,
const struct filesystem *fs);
int umount(const char *target);
int mountlist(const char **list, char *buf, size_t bufsz);
int cd(const char *path);
int open(const char *path, int flags);
int close(int fd);
int write(int fd, const void *buf, size_t count);
int read(int fd, void *buf, size_t count);
int ioctl(int fd, int req, ...);
int lseek(int fd, size_t offset);
int unlink(const char *path);
int mkdir(const char *path);
int mkdev(const char *path, size_t driver, size_t bdevice);
int lsdir(const char *path, const char **list, char *buf, size_t bufsz);
const char *vfs_strerror(enum ERROR e);
#endif