The Pedigree Project  0.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Symlink Class Reference

#include <Symlink.h>

+ Inheritance diagram for Symlink:
+ Collaboration diagram for Symlink:

Public Member Functions

 Symlink ()
 
 Symlink (const Symlink &file)
 
 Symlink (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent)
 
virtual ~Symlink ()
 
virtual bool isSymlink ()
 
int followLink (char *pBuffer, size_t bufLen)
 
FilefollowLink ()
 
- Public Member Functions inherited from File
 File ()
 
 File (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent)
 
virtual ~File ()
 
virtual uint64_t read (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
virtual uint64_t write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
virtual physical_uintptr_t getPhysicalPage (size_t offset)
 
virtual void returnPhysicalPage (size_t offset)
 
virtual void sync ()
 
virtual void sync (size_t offset, bool async)
 
Time::Timestamp getCreationTime ()
 
void setCreationTime (Time::Timestamp t)
 
Time::Timestamp getAccessedTime ()
 
void setAccessedTime (Time::Timestamp t)
 
Time::Timestamp getModifiedTime ()
 
void setModifiedTime (Time::Timestamp t)
 
String getName () const
 
void getName (String &s) const
 
virtual String getFullPath (bool bWithLabel=true)
 
virtual void truncate ()
 
size_t getSize ()
 
void setSize (size_t sz)
 
virtual bool isDirectory ()
 
virtual bool isPipe () const
 
virtual bool isFifo () const
 
virtual bool isSocket () const
 
uintptr_t getInode () const
 
virtual void setInode (uintptr_t inode)
 
FilesystemgetFilesystem () const
 
void setFilesystem (Filesystem *pFs)
 
virtual void fileAttributeChanged ()
 
virtual void increaseRefCount (bool bIsWriter)
 
virtual void decreaseRefCount (bool bIsWriter)
 
void setPermissions (uint32_t perms)
 
uint32_t getPermissions () const
 
void setUid (size_t uid)
 
size_t getUid () const
 
void setGid (size_t gid)
 
size_t getGid () const
 
FilegetParent () const
 
virtual int select (bool bWriting=false, int timeout=0)
 
void monitor (Thread *pThread, Event *pEvent)
 
void cullMonitorTargets (Thread *pThread)
 
virtual bool supports (const size_t command) const
 
virtual int command (const size_t command, void *buffer)
 
virtual size_t getBlockSize () const
 
void enableDirect ()
 
void disableDirect ()
 
virtual void preallocate (size_t expectedSize, bool zero=true)
 
virtual Fileopen ()
 

Static Public Member Functions

static SymlinkfromFile (File *pF)
 

Protected Member Functions

void initialise (bool bForce=false)
 
virtual bool isBytewise () const
 
- Protected Member Functions inherited from File
virtual uint64_t readBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
 
virtual uint64_t writeBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
 
virtual uintptr_t readBlock (uint64_t location)
 
virtual void writeBlock (uint64_t location, uintptr_t addr)
 
virtual void extend (size_t newSize)
 
virtual void extend (size_t newSize, uint64_t location, uint64_t size)
 
void dataChanged ()
 
void getFilesystemLabel (HugeStaticString &s)
 
virtual void pinBlock (uint64_t location)
 
virtual void unpinBlock (uint64_t location)
 
void evict (uint64_t location)
 
void setPermissionsOnly (uint32_t perms)
 
void setUidOnly (size_t uid)
 
void setGidOnly (size_t gid)
 

Protected Attributes

Filem_pCachedSymlink
 
String m_sTarget
 
- Protected Attributes inherited from File
String m_Name
 
Time::Timestamp m_AccessedTime
 
Time::Timestamp m_ModifiedTime
 
Time::Timestamp m_CreationTime
 
uintptr_t m_Inode
 
class Filesystemm_pFilesystem
 
size_t m_Size
 
Filem_pParent
 
size_t m_nWriters
 
size_t m_nReaders
 
size_t m_Uid
 
size_t m_Gid
 
uint32_t m_Permissions
 
HashTable< DataCacheKey, uintptr_t > m_DataCache
 
bool m_bDirect
 
Cache m_FillCache
 
Mutex m_Lock
 
List< MonitorTarget * > m_MonitorTargets
 

Private Member Functions

Symlinkoperator= (const Symlink &)
 

Friends

class Filesystem
 

Additional Inherited Members

- Static Protected Member Functions inherited from File
static void writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta)
 

Detailed Description

A symbolic link node.

Definition at line 31 of file Symlink.h.

Constructor & Destructor Documentation

Symlink::Symlink ( )

Constructor, creates an invalid file.

Definition at line 24 of file Symlink.cc.

Symlink::Symlink ( const Symlink file)

Copy constructors are hidden - unused!

Symlink::Symlink ( const String name,
Time::Timestamp  accessedTime,
Time::Timestamp  modifiedTime,
Time::Timestamp  creationTime,
uintptr_t  inode,
class Filesystem pFs,
size_t  size,
File pParent 
)

Constructor, should be called only by a Filesystem.

Definition at line 28 of file Symlink.cc.

Symlink::~Symlink ( )
virtual

Destructor - doesn't do anything.

Definition at line 39 of file Symlink.cc.

Member Function Documentation

int Symlink::followLink ( char *  pBuffer,
size_t  bufLen 
)

Reads the contents of the file as a symbolic link and returns the contents in the given buffer.

Returns
Number of bytes copied.

Definition at line 77 of file Symlink.cc.

References initialise().

Referenced by Filesystem::findNode(), DynamicLinker::loadObject(), DynamicLinker::loadProgram(), and PosixSubsystem::parseShebang().

+ Here is the caller graph for this function:

File * Symlink::followLink ( )

Reads the contents of the file as a symbolic link and follows.

Definition at line 66 of file Symlink.cc.

References Filesystem::find(), and initialise().

static Symlink* Symlink::fromFile ( File pF)
inlinestatic

Eases the pain of casting, and performs a sanity check.

Definition at line 37 of file Symlink.h.

References FATAL, File::isSymlink(), and Filesystem::operator=().

Referenced by Filesystem::findNode(), DynamicLinker::loadObject(), DynamicLinker::loadProgram(), and PosixSubsystem::parseShebang().

+ Here is the caller graph for this function:

void Symlink::initialise ( bool  bForce = false)
protected

Read the symlink target. Allows this to be done lazily.

Definition at line 43 of file Symlink.cc.

References File::read(), and String::rstrip().

Referenced by followLink().

+ Here is the caller graph for this function:

bool Symlink::isBytewise ( ) const
protectedvirtual

Most Symlink objects will be bytewise, but for those that aren't they can override this

Reimplemented from File.

Definition at line 92 of file Symlink.cc.

virtual bool Symlink::isSymlink ( )
inlinevirtual

Returns true if the File is actually a symlink.

Reimplemented from File.

Definition at line 63 of file Symlink.h.

References Filesystem::initialise(), and File::isBytewise().


The documentation for this class was generated from the following files: