include/vfs_ext.h File Reference


Detailed Description

Exported VFS Definitions.

Author:
John Hodge (thePowersGang)

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 Documentation

#define VFS_PERM_DENY   0x80000000

Denies instead of granting permissions.

Note:
Denials take precedence

Enumeration Type Documentation

VFS_Seek directions.

Enumerator:
SEEK_SET 

Set the current file offset.

SEEK_CUR 

Seek relative to the current position.

SEEK_END 

Seek from the end of the file backwards.


Function Documentation

int VFS_ChDir ( char *  Dest  ) 

Changes the user's current working directory.

Parameters:
Dest New working directory (either absolute or relative to the current)
Returns:
Boolean Success
int VFS_ChRoot ( char *  New  ) 

Change the current virtual root for the user.

Parameters:
New New virtual root (same as VFS_ChDir but cannot go above the current virtual root)
Returns:
Boolean success
void VFS_Close ( int  FD  ) 

Close a currently open file.

Parameters:
FD Handle returned by VFS_Open
int VFS_FInfo ( int  FD,
tFInfo Dest,
int  MaxACLs 
)

Get file information from an open file.

Parameters:
FD File handle returned by VFS_Open
Dest Destination for the read information
MaxACLs Number of ACL slots allocated in the Dest structure
Returns:
Boolean Success

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.

Parameters:
FD File handle returned by VFS_Open
Dest ACL information structure to edit
Returns:
Boolean success

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.

Parameters:
Dest Destination for the created path
Base Base of the memory file
Length Length of the memory buffer
Note:
A maximum of VFS_MEMPATH_SIZE bytes will be required in Dest
char* VFS_GetTruePath ( const char *  Path  ) 

Gets the canoical (true) path of a file.

Parameters:
Path File path (may contain symlinks, relative elements etc.)
Returns:
Absolute path with no symlinks
int VFS_Init ( void   ) 

Initialise the VFS (called by system.c).

Returns:
Boolean Success
int VFS_IOCtl ( int  FD,
int  ID,
void *  Buffer 
)

Sends an IOCtl request to the driver.

Parameters:
FD File handle returned by VFS_Open
ID IOCtl call ID (driver specific)
Buffer Data pointer to send to the driver
Returns:
Driver specific response
int VFS_MkDir ( const char *  Path  ) 

Create a new directory.

Parameters:
Path Path to new directory (absolute or relative)
Returns:
Boolean success
Note:
The parent of the directory must exist
int VFS_Mount ( const char *  Device,
const char *  MountPoint,
const char *  Filesystem,
const char *  Options 
)

Mounts a filesystem.

Parameters:
Device Device to mount
MountPoint Location to mount
Filesystem Filesystem to use
Options Options string to pass the driver
Returns:
1 on succes, -1 on error
int VFS_Open ( const char *  Path,
Uint  Mode 
)

Open a file.

Parameters:
Path Absolute or relative path to the file
Mode Flags defining how to open the file
Returns:
VFS Handle (an integer) or -1 if an error occured
int VFS_OpenChild ( Uint Errno,
int  FD,
const char *  Name,
Uint  Mode 
)

Opens a file via an open directory.

Note:
The file to open must be a direct child of the parent
Parameters:
Errno Error number
FD Parent Directory
Name Child name
Mode Open mode
Returns:
File handle (same as returned from VFS_Open)
Uint64 VFS_Read ( int  FD,
Uint64  Length,
void *  Buffer 
)

Reads data from a file.

Parameters:
FD File handle returned by VFS_Open
Length Number of bytes to read from the file
Buffer Destination of read data
Returns:
Number of read bytes
Uint64 VFS_ReadAt ( int  FD,
Uint64  Offset,
Uint64  Length,
void *  Buffer 
)

Reads from a specific offset in the file.

Parameters:
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
Returns:
Number of bytes read
int VFS_ReadDir ( int  FD,
char *  Dest 
)

Read from a directory.

Parameters:
FD File handle returned by VFS_Open
Dest Destination array for the file name (max 255 bytes)
Returns:
Boolean Success
int VFS_Seek ( int  FD,
Sint64  Offset,
int  Whence 
)

Change the location of the current file pointer.

Parameters:
FD File handle returned by VFS_Open
Offset Offset within the file to go to
Whence A direction from eVFS_SeekDirs
Returns:
Boolean success
int VFS_Symlink ( const char *  Name,
const char *  Link 
)

Create a symbolic link.

Parameters:
Name Name of the symbolic link
Link File the symlink points to
Returns:
Boolean success (Link is not tested for existence)
Uint64 VFS_Tell ( int  FD  ) 

Returns the current file pointer.

Parameters:
FD File handle returned by VFS_Open
Returns:
Current file position
Uint64 VFS_Write ( int  FD,
Uint64  Length,
const void *  Buffer 
)

Writes data to a file.

Parameters:
FD File handle returned by VFS_Open
Length Number of bytes to write to the file
Buffer Source of written data
Returns:
Number of bytes written
Uint64 VFS_WriteAt ( int  FD,
Uint64  Offset,
Uint64  Length,
const void *  Buffer 
)

Writes to a specific offset in the file.

Parameters:
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
Returns:
Number of bytes written
Generated on Mon Feb 14 15:21:31 2011 for Acess2 by  doxygen 1.6.3