src/server/daemon/vfs.h

changeset 59
ab25c0a231d0
parent 58
66c22e54aa90
child 63
66442f81f823
--- a/src/server/daemon/vfs.h	Tue Mar 19 17:38:32 2013 +0100
+++ b/src/server/daemon/vfs.h	Mon May 06 13:44:27 2013 +0200
@@ -29,95 +29,15 @@
 #ifndef VFS_H
 #define	VFS_H
 
-#include "../public/nsapi.h"
-#include "acl.h"
+#include "../public/vfs.h"
 
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
-typedef struct VFS_IO     VFS_IO;
-typedef struct VFS_DIRIO  VFS_DIRIO;
-typedef struct VFSFile    VFSFile;
-typedef struct VFSDir     VFSDir;
-typedef struct VFSEntry   VFSEntry;
-
-#define VFS_DIR           VFSDir*
-#define VFS_ENTRY         VFSEntry
-
-struct VFS {
-    SYS_FILE (*open)(VFSContext *ctx, char *path, int oflags);
-    int (*stat)(VFSContext *ctx, char *path, struct stat *buf);
-    int (*fstat)(VFSContext *ctx, SYS_FILE fd, struct stat *buf);
-    VFS_DIR (*opendir)(VFSContext *ctx, char *path);
-    int (*mkdir)(VFSContext *ctx, char *path);
-    int (*unlink)(VFSContext *ctx, char *path);
-};
-
-struct VFSContext {
-    Session *sn;
-    Request *rq;
-    VFS *vfs;
-    pool_handle_t *pool;
-    User *user;
-    ACLListHandle *acllist;
-    uint32_t aclreqaccess;
-    int vfs_errno;
-};
-
-struct VFSFile {
-    VFSContext *ctx;
-    VFS_IO *io; // IO functions
-    void *data; // private data used by the VFSFile implementation
-    int fd; // native file descriptor if available, or -1
-};
+// private
+int vfs_init();
 
-struct VFSDir {
-    VFSContext *ctx;
-    VFS_DIRIO *io;
-    void *data; // private data used by the VFSDir implementation
-    int fd; // native file descriptor if available, or -1
-};
-
-struct VFSEntry {
-    char *name;
-    struct stat stat;
-    void *stat_extra;
-    int stat_errno;
-};
-
-struct VFS_IO {
-    ssize_t (*read)(SYS_FILE fd, void *buf, size_t nbyte);
-    ssize_t (*write)(SYS_FILE fd, const void *buf, size_t nbyte);
-    void (*close)(SYS_FILE fd);
-};
-
-struct VFS_DIRIO {
-    int (*readdir)(VFS_DIR dir, VFS_ENTRY *entry, int getstat);
-    void (*close)(VFS_DIR dir);
-};
-
-/*
- * creates a VFSContext for a Request
- * vfs calls will do ACL checks
- */
-VFSContext* vfs_request_context(Session *sn, Request *rq);
-
-SYS_FILE vfs_open(VFSContext *ctx, char *path, int oflags);
-SYS_FILE vfs_openRO(VFSContext *ctx, char *path);
-SYS_FILE vfs_openWO(VFSContext *ctx, char *path);
-SYS_FILE vfs_openRW(VFSContext *ctx, char *path);
-int vfs_stat(VFSContext *ctx, char *path, struct stat *buf);
-int vfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf);
-void vfs_close(SYS_FILE fd);
-VFS_DIR vfs_opendir(VFSContext *ctx, char *path);
-int vfs_readdir(VFS_DIR dir, VFS_ENTRY *entry);
-int vfs_readdir_stat(VFS_DIR dir, VFS_ENTRY *entry);
-void vfs_closedir(VFS_DIR dir);
-int vfs_mkdir(VFSContext *ctx, char *path);
-int vfs_unlink(VFSContext *ctx, char *path);
-
-// private
 typedef int(*vfs_op_f)(VFSContext *, char *);
 int vfs_path_op(VFSContext *ctx, char *path, vfs_op_f op, uint32_t access);
 

mercurial