21 #include "modules/Module.h" 22 #include "pedigree/kernel/process/Process.h" 23 #include "pedigree/kernel/process/Thread.h" 24 #include "pedigree/kernel/processor/Processor.h" 25 #include "pedigree/kernel/processor/ProcessorInformation.h" 26 #include "pedigree/kernel/utilities/new" 28 String RamFs::m_VolumeLabel(
"ramfs");
32 :
File(name, 0, 0, 0, inode, pParentFS, 0, pParent), m_FileBlocks(),
61 bool RamFile::canWrite()
63 RamFs *pParent =
static_cast<RamFs *
>(getFilesystem());
64 if (!pParent->getProcessOwnership())
72 return pid == m_nOwnerPid;
80 uintptr_t buffer = m_FileBlocks.lookup(location);
84 buffer = m_FileBlocks.insert(location);
87 m_FileBlocks.markNoLongerEditing(location);
94 m_FileBlocks.pin(location);
99 m_FileBlocks.release(location);
104 :
Directory(name, 0, 0, 0, inode, pFs, 0, pParent)
107 setPermissions(0777);
112 bool RamDir::addEntry(
String filename,
File *pFile)
114 addDirectoryEntry(filename, pFile);
118 bool RamDir::removeEntry(
File *pFile)
121 if (!pRamFile->canWrite())
129 RamFs::RamFs() :
m_pRoot(0), m_bProcessOwners(
false)
154 return p->addEntry(filename, f);
165 return pParent->addEntry(filename, pDir);
180 return p->removeEntry(file);
188 static void destroy()
192 MODULE_INFO(
"ramfs", &entry, &destroy,
"vfs");
virtual bool createSymlink(File *parent, const String &filename, const String &value)
virtual bool initialise(Disk *pDisk)
static ProcessorInformation & information()
virtual bool createFile(File *parent, const String &filename, uint32_t mask)
virtual bool remove(File *parent, File *file)
virtual uintptr_t readBlock(uint64_t location)
virtual void pinBlock(uint64_t location)
virtual void unpinBlock(uint64_t location)
virtual bool isDirectory()
virtual bool createDirectory(File *parent, const String &filename, uint32_t mask)