The Pedigree Project  0.1
FatDirectory.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_DIRECTORY_H
21 #define FAT_DIRECTORY_H
22 
23 #include "fat.h"
24 #include "modules/system/vfs/Directory.h"
25 #include "pedigree/kernel/process/Mutex.h"
26 #include "pedigree/kernel/processor/types.h"
27 #include "pedigree/kernel/utilities/String.h"
28 
29 class File;
30 
32 class FatDirectory : public Directory
33 {
34  private:
36  FatDirectory(const FatDirectory &file);
37  FatDirectory &operator=(const FatDirectory &);
38 
39  public:
42  String name, uintptr_t cluster, class FatFilesystem *pFs, File *pParent,
43  FatFileInfo &info, uint32_t dirClus = 0, uint32_t dirOffset = 0);
45  virtual ~FatDirectory();
46 
47  void truncate()
48  {
49  }
50 
52  virtual void cacheDirectoryContents();
53 
55  virtual bool addEntry(String filename, File *pFile, size_t type);
57  virtual bool removeEntry(File *pFile);
58 
60  void fileAttributeChanged();
61 
63  virtual void setInode(uintptr_t inode);
64 
65  uint32_t getDirCluster()
66  {
67  return m_DirClus;
68  }
69  void setDirCluster(uint32_t custom)
70  {
71  m_DirClus = custom;
72  }
73  uint32_t getDirOffset()
74  {
75  return m_DirOffset;
76  }
77  void setDirOffset(uint32_t custom)
78  {
79  m_DirOffset = custom;
80  }
81 
82  static const String &symlinkSuffix()
83  {
84  static String s(".__sym");
85  return s;
86  }
87 
88  private:
89  uint32_t m_DirClus;
90  uint32_t m_DirOffset;
91 
92  FatType m_Type;
93  uintptr_t m_BlockSize;
94  bool m_bRootDir;
95 
98 
100  uint32_t m_DirBlockSize;
101 };
102 
103 #endif
void fileAttributeChanged()
void truncate()
Definition: FatDirectory.h:47
virtual bool removeEntry(File *pFile)
Definition: Mutex.h:58
virtual void setInode(uintptr_t inode)
Definition: FatDirectory.cc:62
Definition: String.h:49
FatDirectory(const FatDirectory &file)
virtual void cacheDirectoryContents()
uint32_t m_DirBlockSize
Definition: FatDirectory.h:100
virtual bool addEntry(String filename, File *pFile, size_t type)
Definition: FatDirectory.cc:81
Definition: File.h:66
virtual ~FatDirectory()
Definition: FatDirectory.cc:58