Skip to content

Storage: Add required header file and namespace element instead add all #8002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/storage/blockdevice/BufferedBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

#include "BufferedBlockDevice.h"
#include "mbed_assert.h"
#include "mbed_critical.h"
#include "platform/mbed_assert.h"
#include "platform/mbed_critical.h"
#include <algorithm>
#include <string.h>

Expand Down
2 changes: 1 addition & 1 deletion features/storage/blockdevice/ChainingBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "ChainingBlockDevice.h"
#include "mbed_critical.h"
#include "platform/mbed_critical.h"


ChainingBlockDevice::ChainingBlockDevice(BlockDevice **bds, size_t bd_count)
Expand Down
8 changes: 3 additions & 5 deletions features/storage/blockdevice/ChainingBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#define MBED_CHAINING_BLOCK_DEVICE_H

#include "BlockDevice.h"
#include "mbed.h"

#include "platform/mbed_assert.h"
#include <stdlib.h>

/** Block device for chaining multiple block devices
* with the similar block sizes at sequential addresses
Expand All @@ -45,8 +45,7 @@
* ChainingBlockDevice chainmem(bds);
* @endcode
*/
class ChainingBlockDevice : public BlockDevice
{
class ChainingBlockDevice : public BlockDevice {
public:
/** Lifetime of the memory block device
*
Expand Down Expand Up @@ -179,5 +178,4 @@ class ChainingBlockDevice : public BlockDevice
bool _is_initialized;
};


#endif
5 changes: 2 additions & 3 deletions features/storage/blockdevice/ExhaustibleBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
*/

#include "ExhaustibleBlockDevice.h"
#include "mbed.h"
#include "mbed_critical.h"

#include "platform/mbed_critical.h"
#include "platform/mbed_assert.h"

ExhaustibleBlockDevice::ExhaustibleBlockDevice(BlockDevice *bd, uint32_t erase_cycles)
: _bd(bd), _erase_array(NULL), _erase_cycles(erase_cycles), _init_ref_count(0), _is_initialized(false)
Expand Down
4 changes: 2 additions & 2 deletions features/storage/blockdevice/FlashSimBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

#include "FlashSimBlockDevice.h"
#include "mbed_assert.h"
#include "mbed_critical.h"
#include "platform/mbed_assert.h"
#include "platform/mbed_critical.h"
#include <algorithm>
#include <stdlib.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion features/storage/blockdevice/HeapBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "HeapBlockDevice.h"
#include "mbed_critical.h"
#include "platform/mbed_critical.h"


HeapBlockDevice::HeapBlockDevice(bd_size_t size, bd_size_t block)
Expand Down
5 changes: 3 additions & 2 deletions features/storage/blockdevice/HeapBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
#define MBED_MEM_BLOCK_DEVICE_H

#include "BlockDevice.h"
#include "mbed.h"

#include "platform/mbed_assert.h"
#include <string.h>
#include <stdlib.h>

/** Lazily allocated heap-backed block device
*
Expand Down
6 changes: 4 additions & 2 deletions features/storage/blockdevice/MBRBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
*/

#include "MBRBlockDevice.h"
#include "mbed_critical.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_toolchain.h"
#include "platform/mbed_assert.h"
#include <algorithm>

#include <string.h>

// On disk structures, all entries are little endian
MBED_PACKED(struct) mbr_entry {
Expand Down
1 change: 0 additions & 1 deletion features/storage/blockdevice/MBRBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#define MBED_MBR_BLOCK_DEVICE_H

#include "BlockDevice.h"
#include "mbed.h"


/** Additional error codes used for MBR records
Expand Down
3 changes: 1 addition & 2 deletions features/storage/blockdevice/ObservingBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "ObservingBlockDevice.h"
#include "ReadOnlyBlockDevice.h"
#include "mbed.h"


ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd)
Expand All @@ -36,7 +35,7 @@ ObservingBlockDevice::~ObservingBlockDevice()
// Does nothing
}

void ObservingBlockDevice::attach(Callback<void(BlockDevice *)> cb)
void ObservingBlockDevice::attach(mbed::Callback<void(BlockDevice *)> cb)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not adding using namespace mbed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency, also after this cleanup next PR is to add all block devices and filesystem into the mbed namespace

Copy link
Contributor

@yossi2le yossi2le Oct 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can live with it. Specifically, if next PR is to bring those block devices into mbed namespace.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have that PR already in place, but cannot merge unless this cleanup is done

{
_change = cb;
}
Expand Down
4 changes: 2 additions & 2 deletions features/storage/blockdevice/ObservingBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#define MBED_OBSERVING_BLOCK_DEVICE_H

#include "BlockDevice.h"
#include "PlatformMutex.h"
#include "Callback.h"
#include "platform/PlatformMutex.h"
#include "platform/Callback.h"


class ObservingBlockDevice : public BlockDevice
Expand Down
1 change: 0 additions & 1 deletion features/storage/blockdevice/ProfilingBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#define MBED_PROFILING_BLOCK_DEVICE_H

#include "BlockDevice.h"
#include "mbed.h"


/** Block device for measuring storage operations of another block device
Expand Down
1 change: 0 additions & 1 deletion features/storage/blockdevice/ReadOnlyBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "ReadOnlyBlockDevice.h"
#include "mbed_error.h"


ReadOnlyBlockDevice::ReadOnlyBlockDevice(BlockDevice *bd)
: _bd(bd)
{
Expand Down
3 changes: 1 addition & 2 deletions features/storage/blockdevice/SlicingBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#define MBED_SLICING_BLOCK_DEVICE_H

#include "BlockDevice.h"
#include "mbed.h"

#include "platform/mbed_assert.h"

/** Block device for mapping to a slice of another block device
*
Expand Down
2 changes: 2 additions & 0 deletions features/storage/filesystem/fat/FATFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <errno.h>
////// Error handling /////

using namespace mbed;

static int fat_error_remap(FRESULT res)
{
switch(res) {
Expand Down
2 changes: 2 additions & 0 deletions features/storage/filesystem/littlefs/LittleFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "lfs_util.h"
#include "MbedCRC.h"

using namespace mbed;

extern "C" void lfs_crc(uint32_t *crc, const void *buffer, size_t size)
{
uint32_t initial_xor = *crc;
Expand Down
4 changes: 2 additions & 2 deletions features/storage/nvstore/TESTS/nvstore/functionality/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static void nvstore_multi_thread_test()
if (!threads[i]) {
goto mem_fail;
}
threads[i]->start(callback(thread_test_worker));
threads[i]->start(mbed::callback(thread_test_worker));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again why not just adding using namespace mbed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@yossi2le yossi2le Oct 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you intend to bring nvstore files also into mbed namespace in the next PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block device and file system was for sure.. NVstore will have to check with the storage and other teams

}

wait_ms(thr_test_num_secs * 1000);
Expand Down Expand Up @@ -635,7 +635,7 @@ static void nvstore_race_test()
}
delete[] dummy;

threads[i]->start(callback(race_test_worker, (void *) buffs[i]));
threads[i]->start(mbed::callback(race_test_worker, (void *) buffs[i]));
threads[i]->join();
}

Expand Down