46 |
46 |
47 #define VFS_DIR VFSDir* |
47 #define VFS_DIR VFSDir* |
48 #define VFS_ENTRY VFSEntry |
48 #define VFS_ENTRY VFSEntry |
49 |
49 |
50 struct VFS { |
50 struct VFS { |
51 SYS_FILE (*open)(VFSContext *ctx, char *path, int oflags); |
51 SYS_FILE (*open)(VFSContext *ctx, const char *path, int oflags); |
52 int (*stat)(VFSContext *ctx, char *path, struct stat *buf); |
52 int (*stat)(VFSContext *ctx, const char *path, struct stat *buf); |
53 int (*fstat)(VFSContext *ctx, SYS_FILE fd, struct stat *buf); |
53 int (*fstat)(VFSContext *ctx, SYS_FILE fd, struct stat *buf); |
54 VFS_DIR (*opendir)(VFSContext *ctx, char *path); |
54 VFS_DIR (*opendir)(VFSContext *ctx, const char *path); |
55 VFS_DIR (*fdopendir)(VFSContext *ctx, SYS_FILE fd); |
55 VFS_DIR (*fdopendir)(VFSContext *ctx, SYS_FILE fd); |
56 int (*mkdir)(VFSContext *ctx, char *path); |
56 int (*mkdir)(VFSContext *ctx, const char *path); |
57 int (*unlink)(VFSContext *ctx, char *path); |
57 int (*unlink)(VFSContext *ctx, const char *path); |
58 uint32_t flags; |
58 uint32_t flags; |
59 void *instance; |
59 void *instance; |
60 }; |
60 }; |
61 |
61 |
62 struct VFSContext { |
62 struct VFSContext { |
116 * creates a VFSContext for a Request |
116 * creates a VFSContext for a Request |
117 * vfs calls will do ACL checks |
117 * vfs calls will do ACL checks |
118 */ |
118 */ |
119 VFSContext* vfs_request_context(Session *sn, Request *rq); |
119 VFSContext* vfs_request_context(Session *sn, Request *rq); |
120 |
120 |
121 SYS_FILE vfs_open(VFSContext *ctx, char *path, int oflags); |
121 SYS_FILE vfs_open(VFSContext *ctx, const char *path, int oflags); |
122 SYS_FILE vfs_openRO(VFSContext *ctx, char *path); |
122 SYS_FILE vfs_openRO(VFSContext *ctx, const char *path); |
123 SYS_FILE vfs_openWO(VFSContext *ctx, char *path); |
123 SYS_FILE vfs_openWO(VFSContext *ctx, const char *path); |
124 SYS_FILE vfs_openRW(VFSContext *ctx, char *path); |
124 SYS_FILE vfs_openRW(VFSContext *ctx, const char *path); |
125 int vfs_stat(VFSContext *ctx, char *path, struct stat *buf); |
125 int vfs_stat(VFSContext *ctx, const char *path, struct stat *buf); |
126 int vfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf); |
126 int vfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf); |
127 void vfs_close(SYS_FILE fd); |
127 void vfs_close(SYS_FILE fd); |
128 VFS_DIR vfs_opendir(VFSContext *ctx, char *path); |
128 VFS_DIR vfs_opendir(VFSContext *ctx, const char *path); |
129 VFS_DIR vfs_fdopendir(VFSContext *ctx, SYS_FILE fd); |
129 VFS_DIR vfs_fdopendir(VFSContext *ctx, SYS_FILE fd); |
130 int vfs_readdir(VFS_DIR dir, VFS_ENTRY *entry); |
130 int vfs_readdir(VFS_DIR dir, VFS_ENTRY *entry); |
131 int vfs_readdir_stat(VFS_DIR dir, VFS_ENTRY *entry); |
131 int vfs_readdir_stat(VFS_DIR dir, VFS_ENTRY *entry); |
132 void vfs_closedir(VFS_DIR dir); |
132 void vfs_closedir(VFS_DIR dir); |
133 int vfs_mkdir(VFSContext *ctx, char *path); |
133 int vfs_mkdir(VFSContext *ctx, const char *path); |
134 int vfs_unlink(VFSContext *ctx, char *path); |
134 int vfs_unlink(VFSContext *ctx, const char *path); |
135 |
135 |
136 #ifdef __cplusplus |
136 #ifdef __cplusplus |
137 } |
137 } |
138 #endif |
138 #endif |
139 |
139 |