The Pedigree Project  0.1
FatFile.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef FAT_FILE_H
21 #define FAT_FILE_H
22 
23 #include "modules/system/vfs/File.h"
24 #include "pedigree/kernel/processor/types.h"
25 #include "pedigree/kernel/time/Time.h"
26 #include "pedigree/kernel/utilities/Cache.h"
27 #include "pedigree/kernel/utilities/String.h"
28 
30 class FatFile : public File
31 {
32  private:
34  FatFile(const File &file);
35  File &operator=(const File &);
36 
37  public:
39  FatFile(
40  String name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime,
41  Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs,
42  size_t size, uint32_t dirClus = 0, uint32_t dirOffset = 0,
43  File *pParent = 0);
45  virtual ~FatFile();
46 
47  uint32_t getDirCluster()
48  {
49  return m_DirClus;
50  }
51  void setDirCluster(uint32_t custom)
52  {
53  m_DirClus = custom;
54  }
55  uint32_t getDirOffset()
56  {
57  return m_DirOffset;
58  }
59  void setDirOffset(uint32_t custom)
60  {
61  m_DirOffset = custom;
62  }
63 
64  uintptr_t readBlock(uint64_t location);
65  void writeBlock(uint64_t location, uintptr_t addr);
66 
67  virtual void extend(size_t newSize);
68  virtual void extend(size_t newSize, uint64_t location, uint64_t size);
69 
70  using File::sync;
71  virtual void sync(size_t offset, bool async);
72 
73  virtual void pinBlock(uint64_t location);
74  virtual void unpinBlock(uint64_t location);
75 
76  private:
77  uint32_t m_DirClus;
78  uint32_t m_DirOffset;
79 
80  Cache m_FileBlockCache;
81 };
82 
83 #endif
virtual void extend(size_t newSize)
Definition: FatFile.cc:82
Definition: String.h:49
Definition: Cache.h:118
virtual void pinBlock(uint64_t location)
Definition: FatFile.cc:72
FatFile(const File &file)
uintptr_t readBlock(uint64_t location)
Definition: FatFile.cc:44
virtual void sync()
Definition: File.cc:351
virtual void unpinBlock(uint64_t location)
Definition: FatFile.cc:77
Definition: File.h:66
virtual ~FatFile()
Definition: FatFile.cc:40
void writeBlock(uint64_t location, uintptr_t addr)
Definition: FatFile.cc:55