|
6 | 6 | #define KITTY_SYSCALL_H |
7 | 7 |
|
8 | 8 | #include <stdbool.h> |
9 | | -#include "../cpu/cpu_options.h" |
10 | 9 | #include "stdint.h" |
11 | 10 |
|
12 | | -typedef BITS_TYPE node_descriptor; |
| 11 | +/* |
| 12 | + * bits definitions are to ensure that the parameters are |
| 13 | + * consistent across all systems |
| 14 | + */ |
13 | 15 |
|
14 | | -void open(char* path); |
| 16 | +typedef uint64_t node_descriptor; |
| 17 | +typedef uint64_t pointer; |
| 18 | +typedef uint64_t number; |
| 19 | +typedef uint64_t boolean; |
| 20 | +typedef uint64_t node_type; |
| 21 | + |
| 22 | +/* |
| 23 | + * open(pointer path) |
| 24 | + * |
| 25 | + * opens a file and retrieves a node descriptor. |
| 26 | + * |
| 27 | + * path is a pointer to a null terminated string containing the path |
| 28 | + * to the child node. |
| 29 | + */ |
| 30 | +void open(pointer path, pointer nd); |
| 31 | + |
| 32 | +/* |
| 33 | + * close(node_descriptor nd) |
| 34 | + * |
| 35 | + * close a node, invalidating the node descriptor. |
| 36 | + * |
| 37 | + * nd is the node descriptor to be terminated. |
| 38 | + */ |
15 | 39 | void close(node_descriptor nd); |
16 | | -void read(node_descriptor nd, BITS_TYPE offset, BITS_TYPE buffer, BITS_TYPE length); |
17 | | -void write(node_descriptor nd); |
18 | | -void symlink(node_descriptor nd, char* path, bool writeable); |
19 | | -void create(node_descriptor nd, char* path); |
| 40 | + |
| 41 | +/* |
| 42 | + * read(node_descriptor nd, pointer offset, pointer buffer, number length) |
| 43 | + * |
| 44 | + * reads from a node, putting the data at the offset specified to the buffer |
| 45 | + */ |
| 46 | +void read(node_descriptor nd, number offset, pointer buffer, number length); |
| 47 | + |
| 48 | +/* |
| 49 | + * write(node_descriptor nd, number offset, pointer buffer, number length) |
| 50 | + * |
| 51 | + * write to a given node. |
| 52 | + * |
| 53 | + * nd is the node to be written to. |
| 54 | + * offset is the offset in node where the buffer will be written to. |
| 55 | + * length is the length to write from. |
| 56 | + */ |
| 57 | +void write(node_descriptor nd, number offset, pointer buffer, number length); |
| 58 | + |
| 59 | +/* |
| 60 | + * symlink(node_descriptor nd, pointer path, boolean writeable) |
| 61 | + * |
| 62 | + * nd is the node to symlink, pointer path is the |
| 63 | + */ |
| 64 | +void symlink(node_descriptor nd, pointer path, boolean writeable); |
| 65 | + |
| 66 | +/* |
| 67 | + * create(pointer nd, pointer path, node_type type) |
| 68 | + * |
| 69 | + * nd - the pointer to the new node descriptor |
| 70 | + * |
| 71 | + * path - the pointer to the string with the path the new node is to be created at |
| 72 | + * |
| 73 | + * type - the type of the new node to create |
| 74 | + */ |
| 75 | +void create(pointer nd, pointer path, node_type type); |
20 | 76 |
|
21 | 77 | #endif //KITTY_SYSCALL_H |
0 commit comments