23 #include "pedigree/kernel/compiler.h" 24 #include "pedigree/kernel/process/Mutex.h" 25 #include "pedigree/kernel/processor/types.h" 26 #include "pedigree/kernel/time/Time.h" 27 #include "pedigree/kernel/utilities/Cache.h" 28 #include "pedigree/kernel/utilities/CacheConstants.h" 29 #include "pedigree/kernel/utilities/HashTable.h" 30 #include "pedigree/kernel/utilities/List.h" 31 #include "pedigree/kernel/utilities/StaticString.h" 32 #include "pedigree/kernel/utilities/String.h" 33 #include "pedigree/kernel/utilities/new" 43 #define FILE_UMASK 0007 49 #define FILE_GMASK 0070 55 #define FILE_OMASK 0700 58 #define FILE_STICKY 01000 59 #define FILE_AMASK 07000 62 #define FILE_BAD_BLOCK static_cast<uintptr_t>(-1) 82 const String &name, Time::Timestamp accessedTime,
83 Time::Timestamp modifiedTime, Time::Timestamp creationTime,
84 uintptr_t inode,
class Filesystem *pFs,
size_t size,
File *pParent);
93 virtual uint64_t read(
94 uint64_t location, uint64_t size, uintptr_t buffer,
95 bool bCanBlock =
true)
final;
99 virtual uint64_t write(
100 uint64_t location, uint64_t size, uintptr_t buffer,
101 bool bCanBlock =
true)
final;
106 virtual physical_uintptr_t getPhysicalPage(
size_t offset);
113 virtual void returnPhysicalPage(
size_t offset);
127 virtual void sync(
size_t offset,
bool async);
130 Time::Timestamp getCreationTime();
132 void setCreationTime(Time::Timestamp t);
135 Time::Timestamp getAccessedTime();
137 void setAccessedTime(Time::Timestamp t);
140 Time::Timestamp getModifiedTime();
142 void setModifiedTime(Time::Timestamp t);
146 void getName(
String &s)
const;
150 virtual String getFullPath(
bool bWithLabel =
true);
153 virtual void truncate();
156 void setSize(
size_t sz);
159 virtual bool isSymlink();
162 virtual bool isDirectory();
165 virtual bool isPipe()
const;
168 virtual bool isFifo()
const;
171 virtual bool isSocket()
const;
173 uintptr_t getInode()
const;
174 virtual void setInode(uintptr_t inode);
179 virtual void fileAttributeChanged();
181 virtual void increaseRefCount(
bool bIsWriter);
182 virtual void decreaseRefCount(
bool bIsWriter);
184 void setPermissions(uint32_t perms);
185 uint32_t getPermissions()
const;
187 void setUid(
size_t uid);
188 size_t getUid()
const;
190 void setGid(
size_t gid);
191 size_t getGid()
const;
193 File *getParent()
const;
200 virtual int select(
bool bWriting =
false,
int timeout = 0);
209 void cullMonitorTargets(
Thread *pThread);
212 virtual bool supports(
const size_t command)
const;
215 virtual int command(
const size_t command,
void *buffer);
219 virtual size_t getBlockSize()
const;
225 void disableDirect();
228 virtual void preallocate(
size_t expectedSize,
bool zero=
true);
236 virtual File *open();
244 virtual bool isBytewise()
const;
247 virtual uint64_t readBytewise(
248 uint64_t location, uint64_t size, uintptr_t buffer,
249 bool bCanBlock =
true);
251 virtual uint64_t writeBytewise(
252 uint64_t location, uint64_t size, uintptr_t buffer,
253 bool bCanBlock =
true);
256 virtual uintptr_t readBlock(uint64_t location);
261 virtual void writeBlock(uint64_t location, uintptr_t addr);
264 virtual void extend(
size_t newSize);
272 virtual void extend(
size_t newSize, uint64_t location, uint64_t size);
287 static void writeCallback(
288 CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page,
300 virtual void pinBlock(uint64_t location);
305 virtual void unpinBlock(uint64_t location);
315 void evict(uint64_t location);
318 void setPermissionsOnly(uint32_t perms);
321 void setUidOnly(
size_t uid);
324 void setGidOnly(
size_t gid);
327 Time::Timestamp m_AccessedTime;
328 Time::Timestamp m_ModifiedTime;
329 Time::Timestamp m_CreationTime;
337 size_t m_nWriters, m_nReaders;
341 uint32_t m_Permissions;
359 return m_Block == other.m_Block;
363 size_t m_Block = ~static_cast<
size_t>(0);
399 uintptr_t getCachedPage(
size_t block,
bool locked =
true);
402 void setCachedPage(
size_t block, uintptr_t value,
bool locked =
true);
406 bool useFillCache()
const;
409 uintptr_t readIntoCache(uintptr_t block);
void operator=(const Filesystem &)
bool operator==(const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T1 > &x1, const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T2 > &x2)