00001
00002
00003
00004
00019 #ifndef _VFS_H
00020 #define _VFS_H
00021
00022 #include <acess.h>
00023
00029
00030 #define VFS_FFLAG_READONLY 0x01 //!< Readonly File
00031
00040 #define VFS_FFLAG_DIRECTORY 0x02
00041
00046 #define VFS_FFLAG_SYMLINK 0x04
00047
00055 #define VFS_FFLAG_SETUID 0x08
00056
00064 #define VFS_FFLAG_SETGID 0x10
00065
00075 typedef struct sVFS_Node
00076 {
00083 Uint64 Inode;
00084 Uint ImplInt;
00085 void *ImplPtr;
00086
00095 int ReferenceCount;
00096
00097 Uint64 Size;
00098
00099 Uint32 Flags;
00100
00106 void *Data;
00107
00112 tMutex Lock;
00113
00122 Sint64 ATime;
00123 Sint64 MTime;
00124 Sint64 CTime;
00125
00133 tUID UID;
00134 tGID GID;
00135
00136 int NumACLs;
00137 tVFS_ACL *ACLs;
00138
00151 void (*Reference)(struct sVFS_Node *Node);
00159 void (*Close)(struct sVFS_Node *Node);
00160
00168 int (*IOCtl)(struct sVFS_Node *Node, int Id, void *Data);
00169
00189 Uint64 (*Read)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
00198 Uint64 (*Write)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
00199
00216 struct sVFS_Node *(*FindDir)(struct sVFS_Node *Node, const char *Name);
00217
00228 char *(*ReadDir)(struct sVFS_Node *Node, int Pos);
00229
00237 int (*MkNod)(struct sVFS_Node *Node, const char *Name, Uint Flags);
00238
00246 int (*Relink)(struct sVFS_Node *Node, const char *OldName, const char *NewName);
00247
00255 int (*Link)(struct sVFS_Node *Node, struct sVFS_Node *Child, const char *NewName);
00256
00260 } tVFS_Node;
00261
00265 typedef struct sVFS_Driver
00266 {
00268 char *Name;
00270 Uint Flags;
00271
00273 tVFS_Node *(*InitDevice)(const char *Device, const char **Options);
00275 void (*Unmount)(tVFS_Node *Node);
00277 struct sVFS_Driver *Next;
00278 } tVFS_Driver;
00279
00280
00282 #define VFS_MAXSKIP ((void*)1024)
00283
00284 #define VFS_SKIP ((void*)1)
00285
00286 #define VFS_SKIPN(n) ((void*)(n))
00287
00288 extern tVFS_Node NULLNode;
00289
00294 extern tVFS_ACL gVFS_ACL_EveryoneRWX;
00295 extern tVFS_ACL gVFS_ACL_EveryoneRW;
00296 extern tVFS_ACL gVFS_ACL_EveryoneRX;
00297 extern tVFS_ACL gVFS_ACL_EveryoneRO;
00298
00302
00308 extern int VFS_AddDriver(tVFS_Driver *Info);
00314 extern tVFS_Driver *VFS_GetFSByName(const char *Name);
00323 extern tVFS_ACL *VFS_UnixToAcessACL(Uint Mode, Uint Owner, Uint Group);
00324
00325
00340 extern int Inode_GetHandle(void);
00348 extern tVFS_Node *Inode_GetCache(int Handle, Uint64 Inode);
00356 extern tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node);
00363 extern void Inode_UncacheNode(int Handle, Uint64 Inode);
00369 extern void Inode_ClearCache(int Handle);
00370
00375 #endif