The Pedigree Project
0.1
|
#include <FatFilesystem.h>
Classes | |
union | RootDirInfo |
Public Member Functions | |
virtual bool | initialise (Disk *pDisk) |
virtual File * | getRoot () const |
virtual String | getVolumeLabel () const |
virtual uint64_t | read (File *pFile, uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) |
virtual uint64_t | write (File *pFile, uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) |
virtual void | truncate (File *pFile) |
virtual void | fileAttributeChanged (File *pFile) |
virtual void | cacheDirectoryContents (File *pFile) |
virtual void | extend (File *pFile, size_t size) |
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) |
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) |
Disk * | getDisk () |
bool | isReadOnly () |
virtual bool | isCaseSensitive () |
Static Public Member Functions | |
static Filesystem * | probe (Disk *pDisk) |
Protected Member Functions | |
virtual bool | createFile (File *parent, const String &filename, uint32_t mask) |
virtual bool | createDirectory (File *parent, const String &filename, uint32_t mask) |
virtual bool | createSymlink (File *parent, const String &filename, const String &value) |
virtual bool | remove (File *parent, File *file) |
FatFilesystem (const FatFilesystem &) | |
void | operator= (const FatFilesystem &) |
void | loadRootDir () |
void | cacheVolumeLabel () |
bool | readCluster (uint32_t block, uintptr_t buffer) const |
bool | writeCluster (uint32_t block, uintptr_t buffer) |
bool | writeSectorBlock (uint32_t sec, size_t size, uintptr_t buffer) |
bool | readSectorBlock (uint32_t sec, size_t size, uintptr_t buffer) const |
uint32_t | getSectorNumber (uint32_t cluster) const |
uint32_t | getClusterEntry (uint32_t cluster, bool bLock=true) |
uint32_t | setClusterEntry (uint32_t cluster, uint32_t value, bool bLock=true) |
String | convertFilenameTo (String filename) const |
String | convertFilenameFrom (String filename) const |
uint32_t | findFreeCluster (bool bLock=false) |
void | updateFileSize (File *pFile, int64_t sizeChange) |
void | setCluster (File *pFile, uint32_t clus) |
void * | readDirectoryPortion (uint32_t clus) const |
void | writeDirectoryPortion (uint32_t clus, void *p) |
File * | createFile (File *parentDir, const String &filename, uint32_t mask, bool bDirectory=false, uint32_t dirClus=0) |
Dir * | getDirectoryEntry (uint32_t clus, uint32_t offset) const |
void | writeDirectoryEntry (Dir *dir, uint32_t clus, uint32_t offset) |
bool | isEof (uint32_t cluster) const |
uint32_t | eofValue () const |
Time::Timestamp | getUnixTimestamp (uint16_t time, uint16_t date) const |
uint16_t | getFatDate (Time::Timestamp timestamp) const |
Protected Member Functions inherited from Filesystem | |
virtual bool | createLink (File *parent, const String &filename, File *target) |
Protected Attributes | |
Superblock | m_Superblock |
Superblock16 | m_Superblock16 |
Superblock32 | m_Superblock32 |
FSInfo32 | m_FsInfo |
FatType | m_Type |
uint64_t | m_DataAreaStart |
uint32_t | m_RootDirCount |
uint16_t | m_FatSector |
union FatFilesystem::RootDirInfo | m_RootDir |
uint32_t | m_BlockSize |
uint8_t * | m_pFatCache |
UnlikelyLock | m_FatLock |
File * | m_pRoot |
Tree< uintptr_t, uintptr_t > | m_FatCache |
uint32_t | m_FreeClusterHint |
String | m_VolumeLabel |
Protected Attributes inherited from Filesystem | |
bool | m_bReadOnly |
Disk * | m_pDisk |
Friends | |
class | FatFile |
class | FatDirectory |
Additional Inherited Members | |
Public Types inherited from Filesystem | |
typedef Filesystem *(* | ProbeCallback) (Disk *) |
This class provides an implementation of the FAT filesystem.
Definition at line 38 of file FatFilesystem.h.
Converts a string from 8.3 format
Definition at line 1242 of file FatFilesystem.cc.
References NOTICE.
Referenced by FatDirectory::cacheDirectoryContents().
Converts a string to 8.3 format
todo Increment on duplicate
Definition at line 1146 of file FatFilesystem.cc.
References String::rstrip().
Referenced by FatDirectory::addEntry().
|
protectedvirtual |
createDirectory calls this after it has parsed the string path.
Implements Filesystem.
Definition at line 1473 of file FatFilesystem.cc.
References Filesystem::createFile(), and FatDirectory::setInode().
|
protectedvirtual |
createFile calls this after it has parsed the string path.
Implements Filesystem.
Definition at line 1466 of file FatFilesystem.cc.
References Filesystem::createFile().
|
protected |
Creates a file - actual doer for the public createFile
Definition at line 1403 of file FatFilesystem.cc.
References FatDirectory::addEntry(), FatFile::FatFile(), Directory::fromFile(), and File::isDirectory().
|
protectedvirtual |
createSymlink calls this after it has parsed the string path.
Implements Filesystem.
Definition at line 1515 of file FatFilesystem.cc.
References FatDirectory::addEntry(), Directory::fromFile(), File::isDirectory(), and File::write().
|
inlineprotected |
EOF values
Definition at line 149 of file FatFilesystem.h.
References m_Type.
Referenced by FatDirectory::addEntry(), and isEof().
|
protected |
Finds a free cluster - bLock determines if we should enforce locking, defaults to false because findFreeCluster is generally called within a function that has already locked the FAT
Definition at line 459 of file FatFilesystem.cc.
References Dec, FATAL, File::getName(), Hex, Filesystem::m_bReadOnly, and NOTICE.
Referenced by FatDirectory::addEntry().
|
protected |
Grabs a cluster entry - bLock determines if this should enforce locking internally or allow the caller to ensure the FAT is locked.
Definition at line 904 of file FatFilesystem.cc.
References ERROR, FATAL, Scheduler::instance(), NOTICE, and Scheduler::yield().
Referenced by FatDirectory::addEntry(), and FatDirectory::cacheDirectoryContents().
|
protected |
Reads a directory entry from disk
Definition at line 783 of file FatFilesystem.cc.
Referenced by FatDirectory::removeEntry().
|
inlineprotected |
|
virtual |
Returns the root filesystem node.
Implements Filesystem.
Definition at line 260 of file FatFilesystem.cc.
|
protected |
Obtains the first sector given a cluster number
Definition at line 899 of file FatFilesystem.cc.
|
inlineprotected |
Gets a UNIX timestamp from a FAT date/time
This should actually work for practically any year.
Definition at line 161 of file FatFilesystem.h.
Referenced by FatDirectory::cacheDirectoryContents().
|
virtual |
Returns a string identifying the volume label.
Implements Filesystem.
Definition at line 335 of file FatFilesystem.cc.
References File::getFullPath(), File::isDirectory(), and WARNING.
|
virtual |
Populates this filesystem with data from the given Disk device.
Validate the BPB and check for FAT FS
Check the FAT FS itself, ensuring it's valid
Start loading actual FS info
Implements Filesystem.
Definition at line 76 of file FatFilesystem.cc.
References ERROR, Disk::getName(), Filesystem::getRoot(), initialise(), Filesystem::m_pDisk, NOTICE, and Disk::read().
Referenced by initialise(), and FatSymlink::writeBytewise().
|
inlineprotected |
Is a given cluster VALUE EOF?
Definition at line 143 of file FatFilesystem.h.
References eofValue().
Referenced by FatDirectory::addEntry(), and FatDirectory::cacheDirectoryContents().
|
protected |
Reads a cluster from the disk.
Definition at line 828 of file FatFilesystem.cc.
Referenced by FatDirectory::addEntry(), and FatDirectory::cacheDirectoryContents().
|
protected |
Reads part of a directory into a buffer, returns the allocated buffer (which needs to be freed
Definition at line 732 of file FatFilesystem.cc.
Referenced by FatDirectory::addEntry(), and FatDirectory::cacheDirectoryContents().
|
protected |
Writes a block starting from a specific sector to the disk.
Definition at line 835 of file FatFilesystem.cc.
References Filesystem::m_pDisk, and Disk::read().
Remove a file given a parent and file, assuming path parsing already completed.
Implements Filesystem.
Definition at line 1559 of file FatFilesystem.cc.
References VFS::addProbeCallback(), ERROR, Directory::fromFile(), VFS::instance(), and FatDirectory::removeEntry().
|
protected |
Sets the cluster for a file on disk
Definition at line 713 of file FatFilesystem.cc.
|
protected |
Sets a cluster entry - bLock determines if this should enforce locking internally or allow the caller to ensure the FAT is locked.
Definition at line 1011 of file FatFilesystem.cc.
Referenced by FatDirectory::addEntry().
|
protected |
Updates the size of a file on disk
Definition at line 695 of file FatFilesystem.cc.
|
protected |
Writes a cluster to the disk.
Definition at line 862 of file FatFilesystem.cc.
|
protected |
Writes a directry entry to disk
Definition at line 799 of file FatFilesystem.cc.
Referenced by FatDirectory::removeEntry().
|
protected |
Writes part of a directory from a buffer
Definition at line 759 of file FatFilesystem.cc.
Referenced by FatDirectory::addEntry().
|
protected |
Reads a block starting from a specific sector from the disk.
Definition at line 869 of file FatFilesystem.cc.
References Filesystem::m_pDisk, Disk::read(), and Disk::write().
|
protected |
Size of a block (in this case, a cluster)
Definition at line 243 of file FatFilesystem.h.
Referenced by FatDirectory::FatDirectory().
|
protected |
Required information
Definition at line 229 of file FatFilesystem.h.
|
protected |
FAT lock
Definition at line 250 of file FatFilesystem.h.
|
protected |
FAT sector
Definition at line 233 of file FatFilesystem.h.
|
protected |
Hint for the free cluster code, to avoid searching the ENTIRE FAT each time someone wants a free cluster (on non-FAT32 volumes).
Definition at line 263 of file FatFilesystem.h.
|
protected |
FAT cache
Definition at line 246 of file FatFilesystem.h.
|
protected |
Root filesystem node.
Definition at line 253 of file FatFilesystem.h.
|
protected |
Our superblocks
Definition at line 220 of file FatFilesystem.h.
Referenced by FatDirectory::setInode().
|
protected |
Type of the FAT
Definition at line 226 of file FatFilesystem.h.
Referenced by eofValue(), FatDirectory::FatDirectory(), and FatDirectory::setInode().
|
protected |
Cached volume label for the filesystem.
Definition at line 266 of file FatFilesystem.h.