20 #ifndef FATFILESYSTEM_H 21 #define FATFILESYSTEM_H 24 #include "modules/system/vfs/Filesystem.h" 25 #include "pedigree/kernel/LockGuard.h" 26 #include "pedigree/kernel/process/Mutex.h" 27 #include "pedigree/kernel/utilities/Cache.h" 28 #include "pedigree/kernel/utilities/List.h" 29 #include "pedigree/kernel/utilities/Tree.h" 31 #include "pedigree/kernel/utilities/Vector.h" 33 #include "FatDirectory.h" 56 virtual uint64_t
read(
57 File *pFile, uint64_t location, uint64_t size, uintptr_t buffer,
58 bool bCanBlock =
true);
59 virtual uint64_t
write(
60 File *pFile, uint64_t location, uint64_t size, uintptr_t buffer,
61 bool bCanBlock =
true);
74 virtual bool remove(
File *parent,
File *file);
77 void operator=(
const FatFilesystem &);
81 void cacheVolumeLabel();
84 bool readCluster(uint32_t block, uintptr_t buffer)
const;
93 bool readSectorBlock(uint32_t sec,
size_t size, uintptr_t buffer)
const;
133 File *parentDir,
const String &filename, uint32_t mask,
134 bool bDirectory =
false, uint32_t dirClus = 0);
165 Date *sDate =
reinterpret_cast<Date *
>(&date);
168 if (!(sTime->secCount + sTime->minutes + sTime->hours))
169 if (!(sDate->day + sDate->month + sDate->years))
173 uint32_t seconds = sTime->secCount * 2;
174 uint32_t minutes = sTime->minutes;
175 uint32_t hours = sTime->hours;
178 uint32_t day = sDate->day ? sDate->day - 1 : 0;
179 uint32_t month = sDate->month;
180 uint32_t years = sDate->years + 10;
183 uint32_t realYear = years + 1970;
185 ((realYear / 4) - (realYear / 100) + (realYear / 400));
186 leapDays -= ((1980 / 4) - (1980 / 100) + (1980 / 400));
191 static uint16_t cumulativeDays[] = {0, 31, 59, 90, 120, 151, 181,
192 212, 243, 273, 304, 334, 365};
193 uint32_t cumulDays = cumulativeDays[month ? month - 1 : 0];
195 Time::Timestamp ret = 0;
200 ret += hours * 60 * 60;
203 ret += day * 24 * 60 * 60;
204 ret += cumulDays * 24 * 60 * 60;
205 ret += leapDays * 24 * 60 * 60;
206 ret += years * 365 * 24 * 60 * 60;
230 uint32_t m_RootDirCount;
void writeDirectoryEntry(Dir *dir, uint32_t clus, uint32_t offset)
void updateFileSize(File *pFile, int64_t sizeChange)
virtual bool initialise(Disk *pDisk)
virtual bool createDirectory(File *parent, const String &filename, uint32_t mask)
void setCluster(File *pFile, uint32_t clus)
virtual bool createSymlink(File *parent, const String &filename, const String &value)
virtual File * getRoot() const
uint32_t setClusterEntry(uint32_t cluster, uint32_t value, bool bLock=true)
void fileAttributeChanged()
bool readSectorBlock(uint32_t sec, size_t size, uintptr_t buffer) const
void writeDirectoryPortion(uint32_t clus, void *p)
Dir * getDirectoryEntry(uint32_t clus, uint32_t offset) const
uint32_t findFreeCluster(bool bLock=false)
uint32_t getClusterEntry(uint32_t cluster, bool bLock=true)
virtual bool createFile(File *parent, const String &filename, uint32_t mask)
void * readDirectoryPortion(uint32_t clus) const
uint32_t m_FreeClusterHint
bool writeCluster(uint32_t block, uintptr_t buffer)
String convertFilenameFrom(String filename) const
bool readCluster(uint32_t block, uintptr_t buffer) const
virtual String getVolumeLabel() const
virtual uint64_t read(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
virtual void cacheDirectoryContents()
String convertFilenameTo(String filename) const
Time::Timestamp getUnixTimestamp(uint16_t time, uint16_t date) const
bool isEof(uint32_t cluster) const
uint32_t getSectorNumber(uint32_t cluster) const
uint32_t eofValue() const
virtual void extend(size_t newSize)
bool writeSectorBlock(uint32_t sec, size_t size, uintptr_t buffer)
virtual uint64_t write(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
uint16_t getFatDate(Time::Timestamp timestamp) const