Skip to content

Commit 9bc4ea6

Browse files
committed
littlefs: Removed mbed namespace leaks
1 parent 314995f commit 9bc4ea6

File tree

7 files changed

+20
-27
lines changed

7 files changed

+20
-27
lines changed

features/filesystem/littlefs/LittleFileSystem.h

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ extern "C" {
2323
#include "lfs.h"
2424
}
2525

26-
using namespace mbed;
27-
2826

2927
/**
3028
* LittleFileSystem, a little filesystem
3129
*/
32-
class LittleFileSystem : public FileSystem {
30+
class LittleFileSystem : public mbed::FileSystem {
3331
public:
3432
/** Lifetime of the LittleFileSystem
3533
*
@@ -154,14 +152,14 @@ class LittleFileSystem : public FileSystem {
154152
* bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND
155153
* @return 0 on success, negative error code on failure
156154
*/
157-
virtual int file_open(fs_file_t *file, const char *path, int flags);
155+
virtual int file_open(mbed::fs_file_t *file, const char *path, int flags);
158156

159157
/** Close a file
160158
*
161159
* @param file File handle
162160
* return 0 on success, negative error code on failure
163161
*/
164-
virtual int file_close(fs_file_t file);
162+
virtual int file_close(mbed::fs_file_t file);
165163

166164
/** Read the contents of a file into a buffer
167165
*
@@ -170,7 +168,7 @@ class LittleFileSystem : public FileSystem {
170168
* @param size The number of bytes to read
171169
* @return The number of bytes read, 0 at end of file, negative error on failure
172170
*/
173-
virtual ssize_t file_read(fs_file_t file, void *buffer, size_t size);
171+
virtual ssize_t file_read(mbed::fs_file_t file, void *buffer, size_t size);
174172

175173
/** Write the contents of a buffer to a file
176174
*
@@ -179,14 +177,14 @@ class LittleFileSystem : public FileSystem {
179177
* @param size The number of bytes to write
180178
* @return The number of bytes written, negative error on failure
181179
*/
182-
virtual ssize_t file_write(fs_file_t file, const void *buffer, size_t size);
180+
virtual ssize_t file_write(mbed::fs_file_t file, const void *buffer, size_t size);
183181

184182
/** Flush any buffers associated with the file
185183
*
186184
* @param file File handle
187185
* @return 0 on success, negative error code on failure
188186
*/
189-
virtual int file_sync(fs_file_t file);
187+
virtual int file_sync(mbed::fs_file_t file);
190188

191189
/** Move the file position to a given offset from from a given location
192190
*
@@ -198,65 +196,65 @@ class LittleFileSystem : public FileSystem {
198196
* SEEK_END to start from end of file
199197
* @return The new offset of the file
200198
*/
201-
virtual off_t file_seek(fs_file_t file, off_t offset, int whence);
199+
virtual off_t file_seek(mbed::fs_file_t file, off_t offset, int whence);
202200

203201
/** Get the file position of the file
204202
*
205203
* @param file File handle
206204
* @return The current offset in the file
207205
*/
208-
virtual off_t file_tell(fs_file_t file);
206+
virtual off_t file_tell(mbed::fs_file_t file);
209207

210208
/** Get the size of the file
211209
*
212210
* @param file File handle
213211
* @return Size of the file in bytes
214212
*/
215-
virtual off_t file_size(fs_file_t file);
213+
virtual off_t file_size(mbed::fs_file_t file);
216214

217215
/** Open a directory on the filesystem
218216
*
219217
* @param dir Destination for the handle to the directory
220218
* @param path Name of the directory to open
221219
* @return 0 on success, negative error code on failure
222220
*/
223-
virtual int dir_open(fs_dir_t *dir, const char *path);
221+
virtual int dir_open(mbed::fs_dir_t *dir, const char *path);
224222

225223
/** Close a directory
226224
*
227225
* @param dir Dir handle
228226
* return 0 on success, negative error code on failure
229227
*/
230-
virtual int dir_close(fs_dir_t dir);
228+
virtual int dir_close(mbed::fs_dir_t dir);
231229

232230
/** Read the next directory entry
233231
*
234232
* @param dir Dir handle
235233
* @param ent The directory entry to fill out
236234
* @return 1 on reading a filename, 0 at end of directory, negative error on failure
237235
*/
238-
virtual ssize_t dir_read(fs_dir_t dir, struct dirent *ent);
236+
virtual ssize_t dir_read(mbed::fs_dir_t dir, struct dirent *ent);
239237

240238
/** Set the current position of the directory
241239
*
242240
* @param dir Dir handle
243241
* @param offset Offset of the location to seek to,
244242
* must be a value returned from dir_tell
245243
*/
246-
virtual void dir_seek(fs_dir_t dir, off_t offset);
244+
virtual void dir_seek(mbed::fs_dir_t dir, off_t offset);
247245

248246
/** Get the current position of the directory
249247
*
250248
* @param dir Dir handle
251249
* @return Position of the directory that can be passed to dir_rewind
252250
*/
253-
virtual off_t dir_tell(fs_dir_t dir);
251+
virtual off_t dir_tell(mbed::fs_dir_t dir);
254252

255253
/** Rewind the current position to the beginning of the directory
256254
*
257255
* @param dir Dir handle
258256
*/
259-
virtual void dir_rewind(fs_dir_t dir);
257+
virtual void dir_rewind(mbed::fs_dir_t dir);
260258

261259
private:
262260
lfs_t _lfs; // _the actual filesystem

features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include "ExhaustibleBlockDevice.h"
18+
#include "mbed.h"
1819

1920

2021
ExhaustibleBlockDevice::ExhaustibleBlockDevice(BlockDevice *bd, uint32_t erase_cycles)

features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#define MBED_EXHAUSTIBLE_BLOCK_DEVICE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
2726

2827

2928
/** Heap backed block device which simulates failures

features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "ObservingBlockDevice.h"
2424
#include "ReadOnlyBlockDevice.h"
25+
#include "mbed.h"
2526

2627

2728
ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd)

features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
#ifndef MBED_OBSERVING_BLOCK_DEVICE_H
2323
#define MBED_OBSERVING_BLOCK_DEVICE_H
2424

25-
#include "FileSystem.h"
2625
#include "BlockDevice.h"
2726
#include "PlatformMutex.h"
28-
29-
using namespace mbed;
27+
#include "Callback.h"
3028

3129

3230
class ObservingBlockDevice : public BlockDevice
@@ -44,7 +42,7 @@ class ObservingBlockDevice : public BlockDevice
4442
*
4543
* @param cb Function to call on filesystem change (erase or program)
4644
*/
47-
void attach(Callback<void(BlockDevice *)> cb);
45+
void attach(mbed::Callback<void(BlockDevice *)> cb);
4846

4947
/** Initialize a block device
5048
*
@@ -114,7 +112,7 @@ class ObservingBlockDevice : public BlockDevice
114112

115113
private:
116114
BlockDevice *_bd;
117-
Callback<void(BlockDevice *)> _change;
115+
mbed::Callback<void(BlockDevice *)> _change;
118116
};
119117

120118

features/filesystem/littlefs/TESTS_COMMON/ReadOnlyBlockDevice.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@
2222
#ifndef MBED_READ_ONLY_BLOCK_DEVICE_H
2323
#define MBED_READ_ONLY_BLOCK_DEVICE_H
2424

25-
#include "FileSystem.h"
2625
#include "BlockDevice.h"
2726
#include "PlatformMutex.h"
2827

29-
using namespace mbed;
30-
3128

3229
class ReadOnlyBlockDevice : public BlockDevice
3330
{

features/filesystem/littlefs/TESTS_COMMON/atomic_usage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#define MBED_ATOMIC_USAGE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
2726

2827
/**
2928
* Setup the given block device to test littlefs atomic operations

0 commit comments

Comments
 (0)