embkernel
 All Classes Functions Variables Typedefs Groups Pages
FsEntry.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #ifndef FS_ENTRY_HPP_
7 #define FS_ENTRY_HPP_
8 
9 #include <stdint.h>
10 #include "FsDefs.hpp"
11 
12 class FsEntry {
13 public:
14  FsEntry();
15  ~FsEntry();
16 
17  class FsPartition* mPartition;
18  FsDefs::SECTOR* mSector;
19  uint32_t mClusterBegin;
20  uint32_t mLfnDirectoryEntryLba;
21  uint32_t mDirectoryEntryLba;
22  uint16_t mLfnDirectoryEntryIndex;
23  uint16_t mDirectoryEntryIndex;
24  uint32_t mPosition;
25  uint32_t mCurrentLba;
26  uint32_t mSize;
27 
28  union {
29  struct {
30  uint8_t readOnly :1;
31  uint8_t unflushedSector :1;
32  uint8_t unflushedDirectory :1;
33  uint8_t sectorCacheInvalid :1;
34  uint8_t directory :1;
35  uint8_t createAlways :1;
36  uint8_t spare :2;
37  } bits;
38  uint8_t value;
39  } mFlags;
40 
41 protected:
42  FsDefs::RESULT open(const char* path, bool write, bool createAlways, bool isDirectory);
43  FsDefs::RESULT del(const char* path, bool isDirectory);
44  virtual FsDefs::RESULT close()=0;
45 
46 private:
47  FsDefs::RESULT internalPrepare(const char* path, bool isDirectory);
48 };
49 
50 #endif /* FS_ENTRY_HPP_ */