29
29
#include < stdint.h>
30
30
#include " PlatformMutex.h"
31
31
32
- using namespace mbed ;
33
32
34
33
/* *
35
34
* FATFileSystem based on ChaN's Fat Filesystem library v0.8
36
35
*/
37
- class FATFileSystem : public FileSystem {
36
+ class FATFileSystem : public mbed :: FileSystem {
38
37
public:
39
38
/* * Lifetime of the FATFileSystem
40
39
*
@@ -156,14 +155,14 @@ class FATFileSystem : public FileSystem {
156
155
* bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND
157
156
* @return 0 on success, negative error code on failure
158
157
*/
159
- virtual int file_open (fs_file_t *file, const char *path, int flags);
158
+ virtual int file_open (mbed:: fs_file_t *file, const char *path, int flags);
160
159
161
160
/* * Close a file
162
161
*
163
162
* @param file File handle
164
163
* @return 0 on success, negative error code on failure
165
164
*/
166
- virtual int file_close (fs_file_t file);
165
+ virtual int file_close (mbed:: fs_file_t file);
167
166
168
167
/* * Read the contents of a file into a buffer
169
168
*
@@ -172,7 +171,7 @@ class FATFileSystem : public FileSystem {
172
171
* @param len The number of bytes to read
173
172
* @return The number of bytes read, 0 at end of file, negative error on failure
174
173
*/
175
- virtual ssize_t file_read (fs_file_t file, void *buffer, size_t len);
174
+ virtual ssize_t file_read (mbed:: fs_file_t file, void *buffer, size_t len);
176
175
177
176
/* * Write the contents of a buffer to a file
178
177
*
@@ -181,14 +180,14 @@ class FATFileSystem : public FileSystem {
181
180
* @param len The number of bytes to write
182
181
* @return The number of bytes written, negative error on failure
183
182
*/
184
- virtual ssize_t file_write (fs_file_t file, const void *buffer, size_t len);
183
+ virtual ssize_t file_write (mbed:: fs_file_t file, const void *buffer, size_t len);
185
184
186
185
/* * Flush any buffers associated with the file
187
186
*
188
187
* @param file File handle
189
188
* @return 0 on success, negative error code on failure
190
189
*/
191
- virtual int file_sync (fs_file_t file);
190
+ virtual int file_sync (mbed:: fs_file_t file);
192
191
193
192
/* * Move the file position to a given offset from from a given location
194
193
*
@@ -200,65 +199,65 @@ class FATFileSystem : public FileSystem {
200
199
* SEEK_END to start from end of file
201
200
* @return The new offset of the file
202
201
*/
203
- virtual off_t file_seek (fs_file_t file, off_t offset, int whence);
202
+ virtual off_t file_seek (mbed:: fs_file_t file, off_t offset, int whence);
204
203
205
204
/* * Get the file position of the file
206
205
*
207
206
* @param file File handle
208
207
* @return The current offset in the file
209
208
*/
210
- virtual off_t file_tell (fs_file_t file);
209
+ virtual off_t file_tell (mbed:: fs_file_t file);
211
210
212
211
/* * Get the size of the file
213
212
*
214
213
* @param file File handle
215
214
* @return Size of the file in bytes
216
215
*/
217
- virtual off_t file_size (fs_file_t file);
216
+ virtual off_t file_size (mbed:: fs_file_t file);
218
217
219
218
/* * Open a directory on the filesystem
220
219
*
221
220
* @param dir Destination for the handle to the directory
222
221
* @param path Name of the directory to open
223
222
* @return 0 on success, negative error code on failure
224
223
*/
225
- virtual int dir_open (fs_dir_t *dir, const char *path);
224
+ virtual int dir_open (mbed:: fs_dir_t *dir, const char *path);
226
225
227
226
/* * Close a directory
228
227
*
229
228
* @param dir Dir handle
230
229
* @return 0 on success, negative error code on failure
231
230
*/
232
- virtual int dir_close (fs_dir_t dir);
231
+ virtual int dir_close (mbed:: fs_dir_t dir);
233
232
234
233
/* * Read the next directory entry
235
234
*
236
235
* @param dir Dir handle
237
236
* @param ent The directory entry to fill out
238
237
* @return 1 on reading a filename, 0 at end of directory, negative error on failure
239
238
*/
240
- virtual ssize_t dir_read (fs_dir_t dir, struct dirent *ent);
239
+ virtual ssize_t dir_read (mbed:: fs_dir_t dir, struct dirent *ent);
241
240
242
241
/* * Set the current position of the directory
243
242
*
244
243
* @param dir Dir handle
245
244
* @param offset Offset of the location to seek to,
246
245
* must be a value returned from dir_tell
247
246
*/
248
- virtual void dir_seek (fs_dir_t dir, off_t offset);
247
+ virtual void dir_seek (mbed:: fs_dir_t dir, off_t offset);
249
248
250
249
/* * Get the current position of the directory
251
250
*
252
251
* @param dir Dir handle
253
252
* @return Position of the directory that can be passed to dir_rewind
254
253
*/
255
- virtual off_t dir_tell (fs_dir_t dir);
254
+ virtual off_t dir_tell (mbed:: fs_dir_t dir);
256
255
257
256
/* * Rewind the current position to the beginning of the directory
258
257
*
259
258
* @param dir Dir handle
260
259
*/
261
- virtual void dir_rewind (fs_dir_t dir);
260
+ virtual void dir_rewind (mbed:: fs_dir_t dir);
262
261
263
262
private:
264
263
FATFS _fs; // Work area (file system object) for logical drive
0 commit comments