src/server/daemon/vfs.h

changeset 385
a1f4cb076d2f
parent 366
47bc686fafe4
child 415
d938228c382e
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
30 #define VFS_H 30 #define VFS_H
31 31
32 #include "../public/vfs.h" 32 #include "../public/vfs.h"
33 #include "acl.h" 33 #include "acl.h"
34 34
35 #include <ucx/string.h>
36
35 #ifdef __cplusplus 37 #ifdef __cplusplus
36 extern "C" { 38 extern "C" {
37 #endif 39 #endif
38 40
41 typedef struct VfsType {
42 vfs_init_func init;
43 vfs_create_func create;
44 } VfsType;
45
39 typedef struct SysVFSDir { 46 typedef struct SysVFSDir {
40 DIR *dir; 47 DIR *dir;
41 struct dirent *cur; 48 struct dirent *cur;
42 } SysVFSDir; 49 } SysVFSDir;
43 50
45 VFS_AIO_READ = 0, 52 VFS_AIO_READ = 0,
46 VFS_AIO_WRITE 53 VFS_AIO_WRITE
47 }; 54 };
48 typedef enum VFSAioOp VFSAioOp; 55 typedef enum VFSAioOp VFSAioOp;
49 56
50 int vfs_init(); 57 int vfs_init(void);
58 VfsType* vfs_get_type(scstr_t vfs_class);
51 59
52 typedef int(*vfs_op_f)(VFSContext *, char *); 60 void* vfs_init_backend(ServerConfiguration *cfg, pool_handle_t *pool, VfsType *vfs_class, WSConfigNode *config, int *error);
53 typedef int(*sys_op_f)(VFSContext *, char *, SysACL *);
54 int vfs_path_op(VFSContext *ctx, char *path, vfs_op_f op, uint32_t access);
55 61
56 SYS_FILE sys_vfs_open(VFSContext *ctx, char *path, int oflags); 62 typedef int(*vfs_op_f)(VFSContext *, const char *);
57 int sys_vfs_stat(VFSContext *ctx, char *path, struct stat *buf); 63 typedef int(*sys_op_f)(VFSContext *, const char *, SysACL *);
64 int vfs_path_op(VFSContext *ctx, const char *path, vfs_op_f op, uint32_t access);
65
66 SYS_FILE sys_vfs_open(VFSContext *ctx, const char *path, int oflags);
67 int sys_vfs_stat(VFSContext *ctx, const char *path, struct stat *buf);
58 int sys_vfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf); 68 int sys_vfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf);
59 VFS_DIR sys_vfs_opendir(VFSContext *ctx, char *path); 69 VFS_DIR sys_vfs_opendir(VFSContext *ctx, const char *path);
60 int sys_vfs_mkdir(VFSContext *ctx, char *path); 70 VFS_DIR sys_vfs_fdopendir(VFSContext *ctx, SYS_FILE fd);
61 int sys_vfs_unlink(VFSContext *ctx, char *path); 71 int sys_vfs_mkdir(VFSContext *ctx, const char *path);
72 int sys_vfs_unlink(VFSContext *ctx, const char *path);
73 int sys_vfs_rmdir(VFSContext *ctx, const char *path);
62 74
63 int sys_path_op(VFSContext *ctx, char *path, sys_op_f op); 75 int sys_path_op(VFSContext *ctx, const char *path, sys_op_f op);
64 int sys_acl_check(VFSContext *ctx, uint32_t access_mask, SysACL *externacl); 76 int sys_acl_check(VFSContext *ctx, uint32_t access_mask, SysACL *externacl);
65 void sys_set_error_status(VFSContext *ctx); 77 void sys_set_error_status(VFSContext *ctx);
66 78
67 ssize_t sys_file_read(SYS_FILE fd, void *buf, size_t nbyte); 79 ssize_t sys_file_read(SYS_FILE fd, void *buf, size_t nbyte);
68 ssize_t sys_file_write(SYS_FILE fd, const void *buf, size_t nbyte); 80 ssize_t sys_file_write(SYS_FILE fd, const void *buf, size_t nbyte);
74 int sys_file_aiowrite(aiocb_s *aiocb); 86 int sys_file_aiowrite(aiocb_s *aiocb);
75 87
76 int sys_dir_read(VFS_DIR dir, VFS_ENTRY *entry, int getstat); 88 int sys_dir_read(VFS_DIR dir, VFS_ENTRY *entry, int getstat);
77 void sys_dir_close(VFS_DIR dir); 89 void sys_dir_close(VFS_DIR dir);
78 90
79 int sys_mkdir(VFSContext *ctx, char *path, SysACL *sysacl); 91 int sys_mkdir(VFSContext *ctx, const char *path, SysACL *sysacl);
80 int sys_unlink(VFSContext *ctx, char *path, SysACL *sysacl); 92 int sys_unlink(VFSContext *ctx, const char *path, SysACL *sysacl);
93 int sys_rmdir(VFSContext *ctx, const char *path, SysACL *sysacl);
81 94
82 void vfs_queue_aio(aiocb_s *aiocb, VFSAioOp op); 95 void vfs_queue_aio(aiocb_s *aiocb, VFSAioOp op);
83 96
84 #ifdef __cplusplus 97 #ifdef __cplusplus
85 } 98 }

mercurial