Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

os::SymLink Class Reference

Symbolic link handling class. More...

#include <symlink.h>

Inheritance diagram for os::SymLink::

os::FSNode List of all members.

Public Methods

 SymLink ()
 SymLink (const std::string &cPath, int nOpenMode=O_RDONLY)
 SymLink (const Directory &cDir, const std::string &cName, int nOpenMode=O_RDONLY)
 SymLink (const FileReference &cRef, int nOpenMode=O_RDONLY)
 SymLink (const FSNode &cNode)
 SymLink (const SymLink &cNode)
virtual ~SymLink ()
virtual status_t SetTo (const std::string &cPath, int nOpenMode=O_RDONLY)
 Open a node using a path. More...

virtual status_t SetTo (const Directory &cDir, const std::string &cPath, int nOpenMode=O_RDONLY)
 Open a node using a dir/path pair. More...

virtual status_t SetTo (const FileReference &cRef, int nOpenMode=O_RDONLY)
 Open the node referred to by the given os::FileReference. More...

virtual status_t SetTo (const FSNode &cNode)
 Copy another FSNode. More...

virtual status_t SetTo (const SymLink &cLink)
status_t ReadLink (std::string *pcBuffer)
status_t ConstructPath (const Directory &cParent, Path *pcBuffer)
status_t ConstructPath (const std::string &cParent, Path *pcBuffer)

Detailed Description

Description:
See also:
FSNode, FileReference
Author:
Kurt Skauen (kurt@atheos.cx)


Constructor & Destructor Documentation

SymLink::SymLink
 

SymLink::SymLink const std::string & cPath,
int nOpenMode = O_RDONLY
 

SymLink::SymLink const Directory & cDir,
const std::string & cName,
int nOpenMode = O_RDONLY
 

SymLink::SymLink const FileReference & cRef,
int nOpenMode = O_RDONLY
 

SymLink::SymLink const FSNode & cNode
 

SymLink::SymLink const SymLink & cLink
 

SymLink::~SymLink [virtual]
 


Member Function Documentation

status_t SymLink::ConstructPath const std::string & cParent,
Path * pcPath
 

status_t SymLink::ConstructPath const Directory & cParent,
Path * pcPath
 

status_t SymLink::ReadLink std::string * pcBuffer
 

status_t SymLink::SetTo const SymLink & cLink [virtual]
 

status_t SymLink::SetTo const FSNode & cNode [virtual]
 

Description:
Make this node a clone of cNode.
Note:
If this call fail the old state of the FSNode will remain unchanged
Parameters:
cNode   The FSNode to copy.

Returns:
On success 0 is returned. On error -1 is returned and a error code is assigned to the global variable "errno". The error code can be any of the errors returned by the open() POSIX function.
See also:
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::FSNode.

status_t SymLink::SetTo const FileReference & cRef,
int nOpenMode = O_RDONLY
[virtual]
 

Description:
Same semantics SetTo( const std::string& cPath, int nOpenMode ) except that the node to open is targeted by a file reference rather than a regular path.
Note:
If this call fail the old state of the FSNode will remain unchanged
Returns:
On success 0 is returned. On error -1 is returned and a error code is assigned to the global variable "errno". The error code can be any of the errors returned by the open() POSIX function.
See also:
SetTo( const std::string& cPath, int nOpenMode )
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::FSNode.

status_t SymLink::SetTo const Directory & cDir,
const std::string & cPath,
int nOpenMode = O_RDONLY
[virtual]
 

Description:
Open a node by using a directory and a path relative to that directory.

The path can eighter be absolute (cDir will then be ignored) or it can be relative to cDir. This have much the same semantics as setting the current working directory to cDir and then open the node by calling SetTo( const std::string& cPath, int nOpenMode ) with the path. The main advantage with this function is that it is thread-safe. You don't get any races while temporarily changing the current working directory.

For a more detailed description look at: SetTo( const std::string& cPath, int nOpenMode )

Note:
If this call fail the old state of the FSNode will remain unchanged
Parameters:
cDir   A valid directory from which the cPath is relative to.
cPath   The file path relative to cDir. The path can eighter be absoulute (in which case cDir is ignored) or it can be relative to cDir.
nOpenMode   Flags controlling how to open the node. See SetTo( const std::string& cPath, int nOpenMode ) for a full description of the various flags.

Returns:
On success 0 is returned. On error -1 is returned and a error code is assigned to the global variable "errno". The error code can be any of the errors returned by the open() POSIX function.

See also:
FSNode( const std::string& cPath, int nOpenMode )
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::FSNode.

status_t SymLink::SetTo const std::string & cPath,
int nOpenMode = O_RDONLY
[virtual]
 

Description:
Open a node by path. The path must be valid and the process must have access to it but it can point to any kind of FS-node (file, directory, symlink).

The nOpenMode should be a compination of any of the O_* flags defined in <fcntl.h>. Their meaning is the same as when opening a file with the open() POSIX function except you can not create a file by setting the O_CREAT flag.

The following flags are accepted:

  • O_RDONLY open the node read-only
  • O_WRONLY open the node write-only
  • O_RDWR open the node for both reading and writing
  • O_TRUNC trunate the size to 0 (only valid for files)
  • O_APPEND automatically move the file-pointer to the end of the file before each write (only valid for files)
  • O_NONBLOCK open the file in non-blocking mode
  • O_DIRECTORY fail if cPath don't point at a directory
  • O_NOTRAVERSE open the symlink it self rather than it's target if cPath points at a symlink
Note:
If this call fail the old state of the FSNode will remain unchanged
Parameters:
cPath   Path pointing at the node to open.
nOpenMode   Flags controlling how to open the node.
Returns:
On success 0 is returned. On error -1 is returned and a error code is assigned to the global variable "errno". The error code can be any of the errors returned by the open() POSIX function.
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::FSNode.


Generated at Tue Sep 11 15:27:54 2001 for AtheOS higlevel API by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001