2 * Acess Micro - VFS Server Ver 1
9 #define VFS_PERM_READ 0x00000001
10 #define VFS_PERM_WRITE 0x00000002
11 #define VFS_PERM_APPEND 0x00000004
12 #define VFS_PERM_EXECUTE 0x00000008
13 #define VFS_PERM_ALL 0x7FFFFFFF // Mask for permissions
14 #define VFS_PERM_DENY 0x80000000 // Inverts permissions
16 typedef struct sVFS_ACL {
18 unsigned Group: 1; // Group (as opposed to user) flag
19 unsigned ID: 31; // ID of Group/User (-1 for nobody/world)
22 unsigned Inv: 1; // Invert Permissions
23 unsigned Perms: 31; // Permission Flags
27 #define VFS_FFLAG_READONLY 0x01
28 #define VFS_FFLAG_DIRECTORY 0x02
29 #define VFS_FFLAG_SYMLINK 0x04
31 typedef struct sVFS_Node {
32 //char *Name; //!< Node's Name (UTF-8)
34 Uint64 Inode; //!< Inode ID
35 Uint ImplInt; //!< Implementation Usable Integer
36 void *ImplPtr; //!< Implementation Usable Pointer
38 int ReferenceCount; //!< Number of times the node is used
40 Uint64 Size; //!< File Size
42 Uint32 Flags; //!< File Flags
44 Sint64 ATime; //!< Last Accessed Time
45 Sint64 MTime; //!< Last Modified Time
46 Sint64 CTime; //!< Creation Time
48 Uint UID; //!< Owning User
49 Uint GID; //!< Owning Group
51 int NumACLs; //!< Number of ACL entries
52 tVFS_ACL *ACLs; //!< ACL Entries
54 //! Reference the node
55 void (*Reference)(struct sVFS_Node *Node);
56 //! Close (dereference) the node
57 void (*Close)(struct sVFS_Node *Node);
58 //! Send an IO Control
59 int (*IOCtl)(struct sVFS_Node *Node, int Id, void *Data);
61 Uint64 (*Read)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
62 Uint64 (*Write)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
64 //! Find an directory entry by name
65 struct sVFS_Node *(*FindDir)(struct sVFS_Node *Node, char *Name);
66 //! Read from a directory - MUST return a heap address
67 char *(*ReadDir)(struct sVFS_Node *Node, int Pos);
68 //! Create a node in a directory
69 int (*MkNod)(struct sVFS_Node *Node, char *Name, Uint Flags);
70 //! Relink (Rename/Remove) a file/directory
71 int (*Relink)(struct sVFS_Node *Node, char *OldName, char *NewName);
77 * \brief VFS Driver (Filesystem) Definition
79 typedef struct sVFS_Driver {
82 tVFS_Node *(*InitDevice)(char *Device, char **Options);
83 void (*Unmount)(tVFS_Node *Node);
84 struct sVFS_Driver *Next;
88 #define VFS_MAXSKIP ((void*)1024)
89 #define VFS_SKIP ((void*)1)
90 #define VFS_SKIPN(n) ((void*)(n))
91 extern tVFS_Node NULLNode;
92 extern tVFS_ACL gVFS_ACL_EveryoneRWX;
93 extern tVFS_ACL gVFS_ACL_EveryoneRW;
94 extern tVFS_ACL gVFS_ACL_EveryoneRX;
95 extern tVFS_ACL gVFS_ACL_EveryoneRO;
98 extern int VFS_AddDriver(tVFS_Driver *Info);
99 extern tVFS_Driver *VFS_GetFSByName(char *Name);
100 extern tVFS_ACL *VFS_UnixToAcessACL(Uint Mode, Uint Owner, Uint Group);
103 extern int Inode_GetHandle();
104 extern tVFS_Node *Inode_GetCache(int Handle, Uint64 Inode);
105 extern tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node);
106 extern void Inode_UncacheNode(int Handle, Uint64 Inode);
107 extern void Inode_ClearCache(int Handle);