tVFS_Node Struct Reference

Represents a node (file or directory) in the VFS tree. More...

#include <vfs.h>

Data Fields

Identifiers

Fields used by the driver to identify what data this node corresponds to.

Uint64 Inode
 Inode ID (Essentially another ImplInt).
Uint ImplInt
 Implementation Usable Integer.
void * ImplPtr
 Implementation Usable Pointer.
Node State

Stores the misc information about the node

int ReferenceCount
 Number of times the node is used.
Uint64 Size
 File Size.
Uint32 Flags
 File Flags.
void * Data
 Pointer to cached data (FS Specific).
tMutex Lock
 Node mutex.
Times

Sint64 ATime
 Last Accessed Time.
Sint64 MTime
 Last Modified Time.
Sint64 CTime
 Creation Time.
Access controll

tUID UID
 ID of Owning User.
tGID GID
 ID of Owning Group.
int NumACLs
 Number of ACL entries.
tVFS_ACLACLs
 Access Controll List pointer.
Common Functions

Functions that are used no matter the value of .Flags

void(* Reference )(struct sVFS_Node *Node)
 Reference the node.
void(* Close )(struct sVFS_Node *Node)
 Close (dereference) the node.
int(* IOCtl )(struct sVFS_Node *Node, int Id, void *Data)
 Send an IO Control.
Buffer Functions

Functions for accessing a buffer-type file (normal file or symbolic link)

Uint64(* Read )(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
 Read from the file.
Uint64(* Write )(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
 Write to the file.
Directory Functions

struct sVFS_Node *(* FindDir )(struct sVFS_Node *Node, const char *Name)
 Find an directory entry by name.
char *(* ReadDir )(struct sVFS_Node *Node, int Pos)
 Read from a directory.
int(* MkNod )(struct sVFS_Node *Node, const char *Name, Uint Flags)
 Create a node in a directory.
int(* Relink )(struct sVFS_Node *Node, const char *OldName, const char *NewName)
 Relink (Rename/Remove) a file/directory.
int(* Link )(struct sVFS_Node *Node, struct sVFS_Node *Child, const char *NewName)
 Link a node to a name.

Detailed Description

Represents a node (file or directory) in the VFS tree.

This structure provides the VFS with the functions required to read/write the file (or directory) that it represents.


Field Documentation

void(* tVFS_Node::Close)(struct sVFS_Node *Node)

Close (dereference) the node.

Parameters:
Node Pointer to this node

Usually .Close is used to write any changes to the node back to the persistent storage.

Pointer to cached data (FS Specific).

Note:
The Inode_* functions will free when the node is uncached this if needed
struct sVFS_Node*(* tVFS_Node::FindDir)(struct sVFS_Node *Node, const char *Name) [read]

Find an directory entry by name.

Parameters:
Node Pointer to this node
Name Name of the file wanted
Returns:
Pointer to the requested node or NULL if it cannot be found
Note:
The node returned must be accessable until tVFS_Node.Close is called and ReferenceCount reaches zero.
int(* tVFS_Node::IOCtl)(struct sVFS_Node *Node, int Id, void *Data)

Send an IO Control.

Parameters:
Node Pointer to this node
Id IOCtl call number
Data Pointer to data to pass to the driver
Returns:
Implementation defined
int(* tVFS_Node::Link)(struct sVFS_Node *Node, struct sVFS_Node *Child, const char *NewName)

Link a node to a name.

Parameters:
Node Pointer to this node (directory)
Child Node to create a new link to
NewName Name for the new link
Returns:
Zeron on success, non-zero on error (see errno.h)

Node mutex.

Note:
Provided for the Filesystem driver's use
int(* tVFS_Node::MkNod)(struct sVFS_Node *Node, const char *Name, Uint Flags)

Create a node in a directory.

Parameters:
Node Pointer to this node
Name Name of the new child
Flags Flags to apply to the new child (directory or symlink)
Returns:
Zero on Success, non-zero on error (see errno.h)
Uint64(* tVFS_Node::Read)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)

Read from the file.

Parameters:
Node Pointer to this node
Offset Byte offset in the file
Length Number of bytes to read
Buffer Destination for read data
Returns:
Number of bytes read
char*(* tVFS_Node::ReadDir)(struct sVFS_Node *Node, int Pos)

Read from a directory.

Parameters:
Node Pointer to this node
Pos Offset in the directory
Returns:
Pointer to the name of the item on the heap (will be freed by the caller). If the directory end has been reached, NULL will be returned. If an item is required to be skipped either &NULLNode, VFS_SKIP or VFS_SKIPN(0...1023) will be returned.
void(* tVFS_Node::Reference)(struct sVFS_Node *Node)

Reference the node.

Parameters:
Node Pointer to this node
int(* tVFS_Node::Relink)(struct sVFS_Node *Node, const char *OldName, const char *NewName)

Relink (Rename/Remove) a file/directory.

Parameters:
Node Pointer to this node
OldName Name of the item to move/delete
NewName New name (or NULL if unlinking is wanted)
Returns:
Zero on Success, non-zero on error (see errno.h)
Uint64(* tVFS_Node::Write)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)

Write to the file.

Parameters:
Node Pointer to this node
Offset Byte offser in the file
Length Number of bytes to write
Buffer Source of written data
Returns:
Number of bytes read

The documentation for this struct was generated from the following file:
Generated on Mon Feb 14 15:21:31 2011 for Acess2 by  doxygen 1.6.3