Components/IFS/src/include/IFS/Gdb/FileSystem.h
Go to the documentation of this file.
1 
23 #pragma once
24 
25 #include "../IFileSystem.h"
26 
27 namespace IFS
28 {
29 namespace Gdb
30 {
34 class FileSystem : public IFileSystem
35 {
36 public:
38  {
39  }
40 
41  ~FileSystem() override
42  {
43  }
44 
45  int mount() override
46  {
47  return FS_OK;
48  }
49 
50  // IFileSystem methods
51  int getinfo(Info& info) override;
52  String getErrorString(int err) override;
53  int opendir(const char* path, DirHandle& dir) override
54  {
55  return Error::NotSupported;
56  }
57  int rewinddir(DirHandle dir) override
58  {
59  return Error::NotSupported;
60  }
61  int readdir(DirHandle dir, Stat& stat) override
62  {
63  return Error::NotSupported;
64  }
65  int closedir(DirHandle dir) override
66  {
67  return Error::NotSupported;
68  }
69  int mkdir(const char* path) override
70  {
71  return Error::NotSupported;
72  }
73  int stat(const char* path, Stat* stat) override;
74  int fstat(FileHandle file, Stat* stat) override;
75  int fsetxattr(FileHandle file, AttributeTag tag, const void* data, size_t size) override
76  {
77  return Error::NotSupported;
78  }
79  int fgetxattr(FileHandle file, AttributeTag tag, void* buffer, size_t size) override
80  {
81  return Error::NotSupported;
82  }
83  int fenumxattr(FileHandle file, AttributeEnumCallback callback, void* buffer, size_t bufsize) override
84  {
85  return Error::NotSupported;
86  }
87  int setxattr(const char* path, AttributeTag tag, const void* data, size_t size) override
88  {
89  return Error::NotSupported;
90  }
91  int getxattr(const char* path, AttributeTag tag, void* buffer, size_t size) override
92  {
93  return Error::NotSupported;
94  }
95  FileHandle open(const char* path, OpenFlags flags) override;
96  int close(FileHandle file) override;
97  int read(FileHandle file, void* data, size_t size) override;
98  int write(FileHandle file, const void* data, size_t size) override;
99  int lseek(FileHandle file, int offset, SeekOrigin origin) override;
100  int eof(FileHandle file) override;
101  int32_t tell(FileHandle file) override;
102  int ftruncate(FileHandle file, size_t new_size) override
103  {
104  return Error::NotSupported;
105  }
106  int flush(FileHandle file) override
107  {
108  return Error::NotSupported;
109  }
110  int rename(const char* oldpath, const char* newpath) override;
111  int remove(const char* path) override;
112  int fremove(FileHandle file) override
113  {
114  return Error::NotImplemented;
115  }
116  int format() override
117  {
118  return Error::NotSupported;
119  }
120  int check() override
121  {
122  return FS_OK;
123  }
124 };
125 
126 } // namespace Gdb
127 } // namespace IFS
FileSystem()
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:37
int fsetxattr(FileHandle file, AttributeTag tag, const void *data, size_t size) override
Set an extended attribute on an open file.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:75
Basic information about filing system.
Definition: IFileSystem.h:118
String getErrorString(int err) override
get the text for a returned error code
int stat(const char *path, Stat *stat) override
get file information
int readdir(DirHandle dir, Stat &stat) override
read a directory entry
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:61
int read(FileHandle file, void *data, size_t size) override
read content from a file and advance cursor
Installable File System base class.
Definition: IFileSystem.h:95
int32_t tell(FileHandle file) override
get current file position
int format() override
format the filing system
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:116
int ftruncate(FileHandle file, size_t new_size) override
Truncate (reduce) the size of an open file.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:102
int lseek(FileHandle file, int offset, SeekOrigin origin) override
change file read/write position
int setxattr(const char *path, AttributeTag tag, const void *data, size_t size) override
Set an extended attribute for a file given its path.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:87
struct ImplFileDir * DirHandle
Definition: IFileSystem.h:68
The String class.
Definition: WString.h:136
Definition: Delegate.h:20
int fremove(FileHandle file) override
remove (delete) a file by handle
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:112
SeekOrigin
Stream/file seek origins.
Definition: SeekOrigin.h:18
int write(FileHandle file, const void *data, size_t size) override
write content to a file at current position and advance cursor
int16_t FileHandle
File handle.
Definition: Stat.h:39
Definition: DirectoryTemplate.h:36
int mount() override
Mount file system, performing any required initialisation.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:45
int getxattr(const char *path, AttributeTag tag, void *buffer, size_t size) override
Get an attribute from a file given its path.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:91
int closedir(DirHandle dir) override
close a directory object
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:65
int fenumxattr(FileHandle file, AttributeEnumCallback callback, void *buffer, size_t bufsize) override
Enumerate attributes.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:83
int rewinddir(DirHandle dir) override
Reset directory read position to start.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:57
File Status structure.
Definition: Stat.h:51
int mkdir(const char *path) override
Create a directory.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:69
Manage a set of bit values using enumeration.
Definition: BitSet.h:43
int close(FileHandle file) override
close an open file
AttributeTag
Identifies a specific attribute.
Definition: Attribute.h:45
int getinfo(Info &info) override
get filing system information
int rename(const char *oldpath, const char *newpath) override
rename a file
int check() override
Perform a file system consistency check.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:120
FileHandle open(const char *path, OpenFlags flags) override
open a file by path
int fgetxattr(FileHandle file, AttributeTag tag, void *buffer, size_t size) override
Get an extended attribute from an open file.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:79
int eof(FileHandle file) override
determine if current file position is at end of file
~FileSystem() override
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:41
int opendir(const char *path, DirHandle &dir) override
open a directory for reading
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:53
int flush(FileHandle file) override
flush any buffered data to physical media
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:106
constexpr ErrorCode FS_OK
Definition: Error.h:128
IFS implementation of Host filing system.
Definition: Components/IFS/src/include/IFS/Gdb/FileSystem.h:34
int fstat(FileHandle file, Stat *stat) override
get file information