Exported VFS Definitions.
Go to the source code of this file.
Data Structures | |
struct | tVFS_ACL |
ACL Defintion Structure. More... | |
struct | tFInfo |
SYS_FINFO structure. More... | |
Defines | |
#define | VFS_MEMPATH_SIZE (3 + (BITS/4)*2) |
Maximum size of a Memory Path generated by VFS_GetMemPath. | |
#define | VFS_KERNEL_FLAG 0x40000000 |
Marks a VFS handle as belonging to the kernel. | |
Flags for VFS_Open | |
#define | VFS_OPENFLAG_EXEC 0x01 |
Open for execution. | |
#define | VFS_OPENFLAG_READ 0x02 |
Open for reading. | |
#define | VFS_OPENFLAG_WRITE 0x04 |
Open for writing. | |
#define | VFS_OPENFLAG_NOLINK 0x40 |
Do not resolve the final symbolic link. | |
#define | VFS_OPENFLAG_USER 0x80 |
Open as a user. | |
ACL Permissions | |
#define | VFS_PERM_READ 0x00000001 |
Readable. | |
#define | VFS_PERM_WRITE 0x00000002 |
Writeable. | |
#define | VFS_PERM_APPEND 0x00000004 |
Append allowed. | |
#define | VFS_PERM_EXECUTE 0x00000008 |
Executable. | |
#define | VFS_PERM_ALL 0x7FFFFFFF |
All permissions granted. | |
#define | VFS_PERM_DENY 0x80000000 |
Denies instead of granting permissions. | |
Enumerations | |
enum | eVFS_SeekDirs { SEEK_SET = 1, SEEK_CUR = 0, SEEK_END = -1 } |
VFS_Seek directions. More... | |
Functions | |
int | VFS_Init (void) |
Initialise the VFS (called by system.c). | |
int | VFS_Open (const char *Path, Uint Mode) |
Open a file. | |
void | VFS_Close (int FD) |
Close a currently open file. | |
int | VFS_FInfo (int FD, tFInfo *Dest, int MaxACLs) |
Get file information from an open file. | |
int | VFS_GetACL (int FD, tVFS_ACL *Dest) |
Gets the permissions appling to a user/group. | |
int | VFS_ChDir (char *Dest) |
Changes the user's current working directory. | |
int | VFS_ChRoot (char *New) |
Change the current virtual root for the user. | |
int | VFS_Seek (int FD, Sint64 Offset, int Whence) |
Change the location of the current file pointer. | |
Uint64 | VFS_Tell (int FD) |
Returns the current file pointer. | |
Uint64 | VFS_Read (int FD, Uint64 Length, void *Buffer) |
Reads data from a file. | |
Uint64 | VFS_Write (int FD, Uint64 Length, const void *Buffer) |
Writes data to a file. | |
Uint64 | VFS_ReadAt (int FD, Uint64 Offset, Uint64 Length, void *Buffer) |
Reads from a specific offset in the file. | |
Uint64 | VFS_WriteAt (int FD, Uint64 Offset, Uint64 Length, const void *Buffer) |
Writes to a specific offset in the file. | |
int | VFS_IOCtl (int FD, int ID, void *Buffer) |
Sends an IOCtl request to the driver. | |
void | VFS_GetMemPath (char *Dest, void *Base, Uint Length) |
Creates a VFS Memory path from a pointer and size. | |
char * | VFS_GetTruePath (const char *Path) |
Gets the canoical (true) path of a file. | |
int | VFS_Mount (const char *Device, const char *MountPoint, const char *Filesystem, const char *Options) |
Mounts a filesystem. | |
int | VFS_MkDir (const char *Path) |
Create a new directory. | |
int | VFS_Symlink (const char *Name, const char *Link) |
Create a symbolic link. | |
int | VFS_ReadDir (int FD, char *Dest) |
Read from a directory. | |
int | VFS_OpenChild (Uint *Errno, int FD, const char *Name, Uint Mode) |
Opens a file via an open directory. |
#define VFS_PERM_DENY 0x80000000 |
Denies instead of granting permissions.
enum eVFS_SeekDirs |
int VFS_ChDir | ( | char * | Dest | ) |
Changes the user's current working directory.
Dest | New working directory (either absolute or relative to the current) |
int VFS_ChRoot | ( | char * | New | ) |
Change the current virtual root for the user.
New | New virtual root (same as VFS_ChDir but cannot go above the current virtual root) |
void VFS_Close | ( | int | FD | ) |
Close a currently open file.
FD | Handle returned by VFS_Open |
int VFS_FInfo | ( | int | FD, | |
tFInfo * | Dest, | |||
int | MaxACLs | |||
) |
Get file information from an open file.
FD | File handle returned by VFS_Open | |
Dest | Destination for the read information | |
MaxACLs | Number of ACL slots allocated in the Dest structure |
If the NumACLs is smaller than the number of ACLs the node has, only NumACLs will be copied into Dest, but the tFInfo.numacls field will be set to the true ammount of ACLs. It is up to the user to do with this information how they like.
int VFS_GetACL | ( | int | FD, | |
tVFS_ACL * | Dest | |||
) |
Gets the permissions appling to a user/group.
FD | File handle returned by VFS_Open | |
Dest | ACL information structure to edit |
This function sets the tVFS_ACL.Inv and tVFS_ACL.Perms fields to what permissions the user/group specied in tVFS_ACL.ID has on the file.
void VFS_GetMemPath | ( | char * | Dest, | |
void * | Base, | |||
Uint | Length | |||
) |
Creates a VFS Memory path from a pointer and size.
Dest | Destination for the created path | |
Base | Base of the memory file | |
Length | Length of the memory buffer |
char* VFS_GetTruePath | ( | const char * | Path | ) |
Gets the canoical (true) path of a file.
Path | File path (may contain symlinks, relative elements etc.) |
int VFS_Init | ( | void | ) |
Initialise the VFS (called by system.c).
int VFS_IOCtl | ( | int | FD, | |
int | ID, | |||
void * | Buffer | |||
) |
Sends an IOCtl request to the driver.
FD | File handle returned by VFS_Open | |
ID | IOCtl call ID (driver specific) | |
Buffer | Data pointer to send to the driver |
int VFS_MkDir | ( | const char * | Path | ) |
Create a new directory.
Path | Path to new directory (absolute or relative) |
int VFS_Mount | ( | const char * | Device, | |
const char * | MountPoint, | |||
const char * | Filesystem, | |||
const char * | Options | |||
) |
Mounts a filesystem.
Device | Device to mount | |
MountPoint | Location to mount | |
Filesystem | Filesystem to use | |
Options | Options string to pass the driver |
int VFS_Open | ( | const char * | Path, | |
Uint | Mode | |||
) |
Open a file.
Path | Absolute or relative path to the file | |
Mode | Flags defining how to open the file |
Opens a file via an open directory.
Errno | Error number | |
FD | Parent Directory | |
Name | Child name | |
Mode | Open mode |
Reads data from a file.
FD | File handle returned by VFS_Open | |
Length | Number of bytes to read from the file | |
Buffer | Destination of read data |
Reads from a specific offset in the file.
FD | File handle returned by VFS_Open | |
Offset | Byte offset in the file | |
Length | Number of bytes to read from the file | |
Buffer | Source of read data |
int VFS_ReadDir | ( | int | FD, | |
char * | Dest | |||
) |
Read from a directory.
FD | File handle returned by VFS_Open | |
Dest | Destination array for the file name (max 255 bytes) |
int VFS_Seek | ( | int | FD, | |
Sint64 | Offset, | |||
int | Whence | |||
) |
Change the location of the current file pointer.
FD | File handle returned by VFS_Open | |
Offset | Offset within the file to go to | |
Whence | A direction from eVFS_SeekDirs |
int VFS_Symlink | ( | const char * | Name, | |
const char * | Link | |||
) |
Create a symbolic link.
Name | Name of the symbolic link | |
Link | File the symlink points to |
Uint64 VFS_Tell | ( | int | FD | ) |
Returns the current file pointer.
FD | File handle returned by VFS_Open |
Writes data to a file.
FD | File handle returned by VFS_Open | |
Length | Number of bytes to write to the file | |
Buffer | Source of written data |
Writes to a specific offset in the file.
FD | File handle returned by VFS_Open | |
Offset | Byte offset in the file | |
Length | Number of bytes to write to the file | |
Buffer | Source of written data |