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
|
#ifndef DEF_VFS_NODE_H
#define DEF_VFS_NODE_H
#include <tce/vfs.h>
#include <tce/syscalls.h>
#include <task/task.h>
class node {
public:
node* parent;
int type, dev_type;
int mode, uid, gid;
node(node* p, int t) : parent(p), type(t) {}
virtual int open(process *proc, int mode);
virtual void close(process *proc) {}
virtual int read(size_t offset, size_t len, char *buffer) { return E_NOT_IMPLEMENTED; }
virtual int write(size_t offset, size_t len, char* buffer) { return E_NOT_IMPLEMENTED; }
int stat(file_info *info);
virtual node* get_child(char* name) { return 0; }
virtual int add_child(char* name, node *child) { return E_NOT_IMPLEMENTED; }
virtual size_t get_size() { return 0; }
};
void vfs_setup();
node* vfs_find(node* root, char* filename);
// syscall interface
FILE open(char* filename, int mode);
FILE open_relative(FILE root, char* filename, int mode);
int stat(char* filename, file_info *info);
int stat_relative(FILE root, char* filename, file_info *info);
int statf(FILE file, file_info *info);
void close(FILE file);
int read(FILE file, size_t offset, size_t len, char *buffer);
int write(FILE file, size_t offset, size_t len, char *buffer);
int link(char* from, char* to, int mode);
#endif
|