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

#include <RamFs.h>

+ Inheritance diagram for RamFs:
+ Collaboration diagram for RamFs:

Public Member Functions

virtual bool initialise (Disk *pDisk) override
 
SyncStatus sync () override
 
void setProcessOwnership (bool bEnable)
 
bool getProcessOwnership () const
 
virtual File * getRoot () const override
 
virtual const String & getVolumeLabel () const override
 
- Public Member Functions inherited from Filesystem
 Filesystem ()
 
virtual ~Filesystem ()
 
virtual File * find (const StringView &path)
 
virtual File * find (const String &path)
 
virtual File * find (const StringView &path, File *pStartNode)
 
virtual File * find (const String &path, File *pStartNode)
 
File * findRetained (const StringView &path, Directory::ChildLease &result, File *pStartNode=nullptr)
 
virtual bool getUuid (String &uuid) const
 
virtual FileHandleStatus encodeFileHandle (File &file, FileHandle &handle)
 
virtual FileHandleStatus decodeFileHandle (const FileHandle &handle, RetainedFile &file)
 
virtual FileHandleStatus fileHandleFsid (FileSystemId &id)
 
virtual SyncStatus shutdown ()
 
virtual bool deviceRemoved (bool deviceAvailable=false)
 
bool tryAcquireOperation (OperationBarrier::Lease &operation) const
 
bool isDeviceRemoved () const
 
virtual QuotaStatus quotaControl (const QuotaRequest &, QuotaResponse &, File *quotaFile=nullptr)
 
bool createFile (const StringView &path, uint32_t mask, File *pStartNode=0)
 
bool createDirectory (const StringView &path, uint32_t mask, File *pStartNode=0)
 
bool createSymlink (const StringView &path, const String &value, File *pStartNode=0)
 
bool createLink (const StringView &path, File *target, File *pStartNode=0)
 
bool remove (const StringView &path, File *pStartNode=0)
 
bool remove (const StringView &path, File *pStartNode, File *expected)
 
bool rename (const StringView &oldPath, File *oldStart, const StringView &newPath, File *newStart, bool noReplace=false)
 
Disk * getDisk ()
 
bool isReadOnly ()
 
virtual bool isCaseSensitive ()
 
bool remove (File *parent, File *file)
 

Protected Member Functions

virtual bool createFile (File *parent, const String &filename, uint32_t mask) override
 
virtual bool createDirectory (File *parent, const String &filename, uint32_t mask) override
 
virtual bool createSymlink (File *parent, const String &filename, const String &value) override
 
virtual bool createLink (File *parent, const String &filename, File *target) override
 
virtual bool removeNode (File *parent, const String &filename, File *file) override
 
virtual bool renameNode (Directory *oldParent, const String &oldName, File *source, Directory *newParent, const String &newName, File *replaced) override
 
 RamFs (const RamFs &)
 
void operator= (const RamFs &)
 
uintptr_t allocateInode ()
 
- Protected Member Functions inherited from Filesystem
bool beginDeviceRemoval (bool deviceAvailable)
 

Protected Attributes

File * m_pRoot
 
bool m_bProcessOwners
 
Atomic< uintptr_t > m_NextInode
 
- Protected Attributes inherited from Filesystem
bool m_bReadOnly
 
Disk * m_pDisk
 
DiskUse m_DiskUse
 
OperationBarrier m_Operations
 

Static Protected Attributes

static String m_VolumeLabel
 

Additional Inherited Members

- Public Types inherited from Filesystem
enum class  SyncStatus { Success , Unsupported , NoMemory , IoError }
 
typedef Filesystem *(* ProbeCallback) (Disk *)
 

Detailed Description

Defines a filesystem that is completely in RAM.

Definition at line 118 of file RamFs.h.

Constructor & Destructor Documentation

◆ RamFs()

RamFs::RamFs ( )

Definition at line 417 of file RamFs.cc.

◆ ~RamFs()

RamFs::~RamFs ( )
virtual

Definition at line 419 of file RamFs.cc.

Member Function Documentation

◆ allocateInode()

uintptr_t RamFs::allocateInode ( )
protected

Definition at line 429 of file RamFs.cc.

◆ createDirectory()

bool RamFs::createDirectory ( File *  parent,
const String &  filename,
uint32_t  mask 
)
overrideprotectedvirtual

createDirectory calls this after it has parsed the string path.

Implements Filesystem.

Definition at line 474 of file RamFs.cc.

References File::isDirectory().

◆ createFile()

bool RamFs::createFile ( File *  parent,
const String &  filename,
uint32_t  mask 
)
overrideprotectedvirtual

createFile calls this after it has parsed the string path.

Implements Filesystem.

Definition at line 450 of file RamFs.cc.

References File::isDirectory().

◆ createLink()

bool RamFs::createLink ( File *  parent,
const String &  filename,
File *  target 
)
overrideprotectedvirtual

createLink calls this after it has parsed the string path.

Reimplemented from Filesystem.

Definition at line 523 of file RamFs.cc.

References File::isDirectory(), File::isSymlink(), and File::setCreationTime().

◆ createSymlink()

bool RamFs::createSymlink ( File *  parent,
const String &  filename,
const String &  value 
)
overrideprotectedvirtual

createSymlink calls this after it has parsed the string path.

Implements Filesystem.

Definition at line 498 of file RamFs.cc.

References File::isDirectory().

◆ getProcessOwnership()

bool RamFs::getProcessOwnership ( ) const
inline

Definition at line 131 of file RamFs.h.

◆ getRoot()

virtual File * RamFs::getRoot ( ) const
inlineoverridevirtual

Returns the root filesystem node.

Implements Filesystem.

Definition at line 135 of file RamFs.h.

◆ getVolumeLabel()

virtual const String & RamFs::getVolumeLabel ( ) const
inlineoverridevirtual

Returns a string identifying the volume label.

Implements Filesystem.

Definition at line 138 of file RamFs.h.

◆ initialise()

bool RamFs::initialise ( Disk *  pDisk)
overridevirtual

Populates this filesystem with data from the given Disk device.

Returns
true on success, false on failure.

Implements Filesystem.

Definition at line 441 of file RamFs.cc.

References m_pRoot.

◆ removeNode()

bool RamFs::removeNode ( File *  parent,
const String &  filename,
File *  file 
)
overrideprotectedvirtual

Remove a backing node while the VFS holds the parent's namespace lock. A successful implementation must retire the parent's cached entry before returning and must recheck directory emptiness while holding the child's namespace lock.

Implements Filesystem.

Definition at line 549 of file RamFs.cc.

References File::isDirectory(), File::isSymlink(), and File::setCreationTime().

◆ renameNode()

bool RamFs::renameNode ( Directory *  oldParent,
const String &  oldName,
File *  source,
Directory *  newParent,
const String &  newName,
File *  replaced 
)
overrideprotectedvirtual

Change backing entries while the VFS reserves both names and owns their namespace locks. Do not call ordinary lookup/add/remove APIs here. Failure must leave both names unchanged; the VFS publishes cache changes on success.

Reimplemented from Filesystem.

Definition at line 564 of file RamFs.cc.

◆ setProcessOwnership()

void RamFs::setProcessOwnership ( bool  bEnable)
inline

Definition at line 127 of file RamFs.h.

◆ sync()

Filesystem::SyncStatus RamFs::sync ( )
overridevirtual

Completes data, metadata and device writeback for changes made before entry.

Reimplemented from Filesystem.

Definition at line 424 of file RamFs.cc.

Member Data Documentation

◆ m_bProcessOwners

bool RamFs::m_bProcessOwners
protected

Definition at line 161 of file RamFs.h.

◆ m_NextInode

Atomic<uintptr_t> RamFs::m_NextInode
protected

Definition at line 164 of file RamFs.h.

◆ m_pRoot

File* RamFs::m_pRoot
protected

Root filesystem node.

Definition at line 159 of file RamFs.h.

Referenced by initialise().

◆ m_VolumeLabel

String RamFs::m_VolumeLabel
staticprotected

Definition at line 156 of file RamFs.h.


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