From 9bc4ea6504bb17e717bfee48df7ab2cf11450f58 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 22 Nov 2017 10:59:13 -0600 Subject: [PATCH] littlefs: Removed mbed namespace leaks --- .../filesystem/littlefs/LittleFileSystem.h | 32 +++++++++---------- .../TESTS_COMMON/ExhaustibleBlockDevice.cpp | 1 + .../TESTS_COMMON/ExhaustibleBlockDevice.h | 1 - .../TESTS_COMMON/ObservingBlockDevice.cpp | 1 + .../TESTS_COMMON/ObservingBlockDevice.h | 8 ++--- .../TESTS_COMMON/ReadOnlyBlockDevice.h | 3 -- .../littlefs/TESTS_COMMON/atomic_usage.h | 1 - 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/features/filesystem/littlefs/LittleFileSystem.h b/features/filesystem/littlefs/LittleFileSystem.h index cbaa989849..0829eb2faa 100644 --- a/features/filesystem/littlefs/LittleFileSystem.h +++ b/features/filesystem/littlefs/LittleFileSystem.h @@ -23,13 +23,11 @@ extern "C" { #include "lfs.h" } -using namespace mbed; - /** * LittleFileSystem, a little filesystem */ -class LittleFileSystem : public FileSystem { +class LittleFileSystem : public mbed::FileSystem { public: /** Lifetime of the LittleFileSystem * @@ -154,14 +152,14 @@ protected: * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND * @return 0 on success, negative error code on failure */ - virtual int file_open(fs_file_t *file, const char *path, int flags); + virtual int file_open(mbed::fs_file_t *file, const char *path, int flags); /** Close a file * * @param file File handle * return 0 on success, negative error code on failure */ - virtual int file_close(fs_file_t file); + virtual int file_close(mbed::fs_file_t file); /** Read the contents of a file into a buffer * @@ -170,7 +168,7 @@ protected: * @param size The number of bytes to read * @return The number of bytes read, 0 at end of file, negative error on failure */ - virtual ssize_t file_read(fs_file_t file, void *buffer, size_t size); + virtual ssize_t file_read(mbed::fs_file_t file, void *buffer, size_t size); /** Write the contents of a buffer to a file * @@ -179,14 +177,14 @@ protected: * @param size The number of bytes to write * @return The number of bytes written, negative error on failure */ - virtual ssize_t file_write(fs_file_t file, const void *buffer, size_t size); + virtual ssize_t file_write(mbed::fs_file_t file, const void *buffer, size_t size); /** Flush any buffers associated with the file * * @param file File handle * @return 0 on success, negative error code on failure */ - virtual int file_sync(fs_file_t file); + virtual int file_sync(mbed::fs_file_t file); /** Move the file position to a given offset from from a given location * @@ -198,21 +196,21 @@ protected: * SEEK_END to start from end of file * @return The new offset of the file */ - virtual off_t file_seek(fs_file_t file, off_t offset, int whence); + virtual off_t file_seek(mbed::fs_file_t file, off_t offset, int whence); /** Get the file position of the file * * @param file File handle * @return The current offset in the file */ - virtual off_t file_tell(fs_file_t file); + virtual off_t file_tell(mbed::fs_file_t file); /** Get the size of the file * * @param file File handle * @return Size of the file in bytes */ - virtual off_t file_size(fs_file_t file); + virtual off_t file_size(mbed::fs_file_t file); /** Open a directory on the filesystem * @@ -220,14 +218,14 @@ protected: * @param path Name of the directory to open * @return 0 on success, negative error code on failure */ - virtual int dir_open(fs_dir_t *dir, const char *path); + virtual int dir_open(mbed::fs_dir_t *dir, const char *path); /** Close a directory * * @param dir Dir handle * return 0 on success, negative error code on failure */ - virtual int dir_close(fs_dir_t dir); + virtual int dir_close(mbed::fs_dir_t dir); /** Read the next directory entry * @@ -235,7 +233,7 @@ protected: * @param ent The directory entry to fill out * @return 1 on reading a filename, 0 at end of directory, negative error on failure */ - virtual ssize_t dir_read(fs_dir_t dir, struct dirent *ent); + virtual ssize_t dir_read(mbed::fs_dir_t dir, struct dirent *ent); /** Set the current position of the directory * @@ -243,20 +241,20 @@ protected: * @param offset Offset of the location to seek to, * must be a value returned from dir_tell */ - virtual void dir_seek(fs_dir_t dir, off_t offset); + virtual void dir_seek(mbed::fs_dir_t dir, off_t offset); /** Get the current position of the directory * * @param dir Dir handle * @return Position of the directory that can be passed to dir_rewind */ - virtual off_t dir_tell(fs_dir_t dir); + virtual off_t dir_tell(mbed::fs_dir_t dir); /** Rewind the current position to the beginning of the directory * * @param dir Dir handle */ - virtual void dir_rewind(fs_dir_t dir); + virtual void dir_rewind(mbed::fs_dir_t dir); private: lfs_t _lfs; // _the actual filesystem diff --git a/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.cpp b/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.cpp index bc4f349c3e..0b16a9217f 100644 --- a/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.cpp +++ b/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.cpp @@ -15,6 +15,7 @@ */ #include "ExhaustibleBlockDevice.h" +#include "mbed.h" ExhaustibleBlockDevice::ExhaustibleBlockDevice(BlockDevice *bd, uint32_t erase_cycles) diff --git a/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.h b/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.h index fd6100f5d5..3c1e83d0c6 100644 --- a/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.h +++ b/features/filesystem/littlefs/TESTS_COMMON/ExhaustibleBlockDevice.h @@ -23,7 +23,6 @@ #define MBED_EXHAUSTIBLE_BLOCK_DEVICE_H #include "BlockDevice.h" -#include "mbed.h" /** Heap backed block device which simulates failures diff --git a/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.cpp b/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.cpp index bdc87ea70b..ea6dc5da15 100644 --- a/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.cpp +++ b/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.cpp @@ -22,6 +22,7 @@ #include "ObservingBlockDevice.h" #include "ReadOnlyBlockDevice.h" +#include "mbed.h" ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd) diff --git a/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.h b/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.h index 60f8c97314..a8b4a4a426 100644 --- a/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.h +++ b/features/filesystem/littlefs/TESTS_COMMON/ObservingBlockDevice.h @@ -22,11 +22,9 @@ #ifndef MBED_OBSERVING_BLOCK_DEVICE_H #define MBED_OBSERVING_BLOCK_DEVICE_H -#include "FileSystem.h" #include "BlockDevice.h" #include "PlatformMutex.h" - -using namespace mbed; +#include "Callback.h" class ObservingBlockDevice : public BlockDevice @@ -44,7 +42,7 @@ public: * * @param cb Function to call on filesystem change (erase or program) */ - void attach(Callback cb); + void attach(mbed::Callback cb); /** Initialize a block device * @@ -114,7 +112,7 @@ public: private: BlockDevice *_bd; - Callback _change; + mbed::Callback _change; }; diff --git a/features/filesystem/littlefs/TESTS_COMMON/ReadOnlyBlockDevice.h b/features/filesystem/littlefs/TESTS_COMMON/ReadOnlyBlockDevice.h index e4fbec8f26..2120716d95 100644 --- a/features/filesystem/littlefs/TESTS_COMMON/ReadOnlyBlockDevice.h +++ b/features/filesystem/littlefs/TESTS_COMMON/ReadOnlyBlockDevice.h @@ -22,12 +22,9 @@ #ifndef MBED_READ_ONLY_BLOCK_DEVICE_H #define MBED_READ_ONLY_BLOCK_DEVICE_H -#include "FileSystem.h" #include "BlockDevice.h" #include "PlatformMutex.h" -using namespace mbed; - class ReadOnlyBlockDevice : public BlockDevice { diff --git a/features/filesystem/littlefs/TESTS_COMMON/atomic_usage.h b/features/filesystem/littlefs/TESTS_COMMON/atomic_usage.h index d173457a8d..43bf5be94a 100644 --- a/features/filesystem/littlefs/TESTS_COMMON/atomic_usage.h +++ b/features/filesystem/littlefs/TESTS_COMMON/atomic_usage.h @@ -23,7 +23,6 @@ #define MBED_ATOMIC_USAGE_H #include "BlockDevice.h" -#include "mbed.h" /** * Setup the given block device to test littlefs atomic operations