littlefs: Removed mbed namespace leaks

pull/5538/head
Christopher Haster 2017-11-22 10:59:13 -06:00
parent 314995f841
commit 9bc4ea6504
7 changed files with 20 additions and 27 deletions

View File

@ -23,13 +23,11 @@ extern "C" {
#include "lfs.h" #include "lfs.h"
} }
using namespace mbed;
/** /**
* LittleFileSystem, a little filesystem * LittleFileSystem, a little filesystem
*/ */
class LittleFileSystem : public FileSystem { class LittleFileSystem : public mbed::FileSystem {
public: public:
/** Lifetime of the LittleFileSystem /** Lifetime of the LittleFileSystem
* *
@ -154,14 +152,14 @@ protected:
* bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND
* @return 0 on success, negative error code on failure * @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 /** Close a file
* *
* @param file File handle * @param file File handle
* return 0 on success, negative error code on failure * 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 /** Read the contents of a file into a buffer
* *
@ -170,7 +168,7 @@ protected:
* @param size The number of bytes to read * @param size The number of bytes to read
* @return The number of bytes read, 0 at end of file, negative error on failure * @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 /** Write the contents of a buffer to a file
* *
@ -179,14 +177,14 @@ protected:
* @param size The number of bytes to write * @param size The number of bytes to write
* @return The number of bytes written, negative error on failure * @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 /** Flush any buffers associated with the file
* *
* @param file File handle * @param file File handle
* @return 0 on success, negative error code on failure * @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 /** 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 * SEEK_END to start from end of file
* @return The new offset of the 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 /** Get the file position of the file
* *
* @param file File handle * @param file File handle
* @return The current offset in the file * @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 /** Get the size of the file
* *
* @param file File handle * @param file File handle
* @return Size of the file in bytes * @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 /** Open a directory on the filesystem
* *
@ -220,14 +218,14 @@ protected:
* @param path Name of the directory to open * @param path Name of the directory to open
* @return 0 on success, negative error code on failure * @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 /** Close a directory
* *
* @param dir Dir handle * @param dir Dir handle
* return 0 on success, negative error code on failure * 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 /** Read the next directory entry
* *
@ -235,7 +233,7 @@ protected:
* @param ent The directory entry to fill out * @param ent The directory entry to fill out
* @return 1 on reading a filename, 0 at end of directory, negative error on failure * @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 /** Set the current position of the directory
* *
@ -243,20 +241,20 @@ protected:
* @param offset Offset of the location to seek to, * @param offset Offset of the location to seek to,
* must be a value returned from dir_tell * 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 /** Get the current position of the directory
* *
* @param dir Dir handle * @param dir Dir handle
* @return Position of the directory that can be passed to dir_rewind * @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 /** Rewind the current position to the beginning of the directory
* *
* @param dir Dir handle * @param dir Dir handle
*/ */
virtual void dir_rewind(fs_dir_t dir); virtual void dir_rewind(mbed::fs_dir_t dir);
private: private:
lfs_t _lfs; // _the actual filesystem lfs_t _lfs; // _the actual filesystem

View File

@ -15,6 +15,7 @@
*/ */
#include "ExhaustibleBlockDevice.h" #include "ExhaustibleBlockDevice.h"
#include "mbed.h"
ExhaustibleBlockDevice::ExhaustibleBlockDevice(BlockDevice *bd, uint32_t erase_cycles) ExhaustibleBlockDevice::ExhaustibleBlockDevice(BlockDevice *bd, uint32_t erase_cycles)

View File

@ -23,7 +23,6 @@
#define MBED_EXHAUSTIBLE_BLOCK_DEVICE_H #define MBED_EXHAUSTIBLE_BLOCK_DEVICE_H
#include "BlockDevice.h" #include "BlockDevice.h"
#include "mbed.h"
/** Heap backed block device which simulates failures /** Heap backed block device which simulates failures

View File

@ -22,6 +22,7 @@
#include "ObservingBlockDevice.h" #include "ObservingBlockDevice.h"
#include "ReadOnlyBlockDevice.h" #include "ReadOnlyBlockDevice.h"
#include "mbed.h"
ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd) ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd)

View File

@ -22,11 +22,9 @@
#ifndef MBED_OBSERVING_BLOCK_DEVICE_H #ifndef MBED_OBSERVING_BLOCK_DEVICE_H
#define MBED_OBSERVING_BLOCK_DEVICE_H #define MBED_OBSERVING_BLOCK_DEVICE_H
#include "FileSystem.h"
#include "BlockDevice.h" #include "BlockDevice.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
#include "Callback.h"
using namespace mbed;
class ObservingBlockDevice : public BlockDevice class ObservingBlockDevice : public BlockDevice
@ -44,7 +42,7 @@ public:
* *
* @param cb Function to call on filesystem change (erase or program) * @param cb Function to call on filesystem change (erase or program)
*/ */
void attach(Callback<void(BlockDevice *)> cb); void attach(mbed::Callback<void(BlockDevice *)> cb);
/** Initialize a block device /** Initialize a block device
* *
@ -114,7 +112,7 @@ public:
private: private:
BlockDevice *_bd; BlockDevice *_bd;
Callback<void(BlockDevice *)> _change; mbed::Callback<void(BlockDevice *)> _change;
}; };

View File

@ -22,12 +22,9 @@
#ifndef MBED_READ_ONLY_BLOCK_DEVICE_H #ifndef MBED_READ_ONLY_BLOCK_DEVICE_H
#define MBED_READ_ONLY_BLOCK_DEVICE_H #define MBED_READ_ONLY_BLOCK_DEVICE_H
#include "FileSystem.h"
#include "BlockDevice.h" #include "BlockDevice.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
using namespace mbed;
class ReadOnlyBlockDevice : public BlockDevice class ReadOnlyBlockDevice : public BlockDevice
{ {

View File

@ -23,7 +23,6 @@
#define MBED_ATOMIC_USAGE_H #define MBED_ATOMIC_USAGE_H
#include "BlockDevice.h" #include "BlockDevice.h"
#include "mbed.h"
/** /**
* Setup the given block device to test littlefs atomic operations * Setup the given block device to test littlefs atomic operations