mirror of https://github.com/ARMmbed/mbed-os.git
storage: fix astyle coding style
parent
5c79ba5189
commit
e54ce88bca
|
@ -45,7 +45,8 @@ const struct {
|
||||||
|
|
||||||
|
|
||||||
// Simple test that read/writes random set of blocks
|
// Simple test that read/writes random set of blocks
|
||||||
void test_read_write() {
|
void test_read_write()
|
||||||
|
{
|
||||||
uint8_t *dummy = new (std::nothrow) uint8_t[TEST_BLOCK_DEVICE_SIZE];
|
uint8_t *dummy = new (std::nothrow) uint8_t[TEST_BLOCK_DEVICE_SIZE];
|
||||||
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
||||||
delete[] dummy;
|
delete[] dummy;
|
||||||
|
@ -155,7 +156,8 @@ end:
|
||||||
|
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
|
{
|
||||||
GREENTEA_SETUP(30, "default_auto");
|
GREENTEA_SETUP(30, "default_auto");
|
||||||
return verbose_test_setup_handler(number_of_cases);
|
return verbose_test_setup_handler(number_of_cases);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +168,7 @@ Case cases[] = {
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
return !Harness::run(specification);
|
return !Harness::run(specification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,8 @@ end:
|
||||||
|
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
|
{
|
||||||
GREENTEA_SETUP(10, "default_auto");
|
GREENTEA_SETUP(10, "default_auto");
|
||||||
return verbose_test_setup_handler(number_of_cases);
|
return verbose_test_setup_handler(number_of_cases);
|
||||||
}
|
}
|
||||||
|
@ -245,6 +246,7 @@ Case cases[] = {
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
return !Harness::run(specification);
|
return !Harness::run(specification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ using namespace utest::v1;
|
||||||
|
|
||||||
|
|
||||||
// Simple test which read/writes blocks on a sliced block device
|
// Simple test which read/writes blocks on a sliced block device
|
||||||
void test_slicing() {
|
void test_slicing()
|
||||||
|
{
|
||||||
uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];
|
uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];
|
||||||
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
||||||
delete[] dummy;
|
delete[] dummy;
|
||||||
|
@ -141,7 +142,8 @@ end:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple test which read/writes blocks on a chain of block devices
|
// Simple test which read/writes blocks on a chain of block devices
|
||||||
void test_chaining() {
|
void test_chaining()
|
||||||
|
{
|
||||||
uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];
|
uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];
|
||||||
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
||||||
delete[] dummy;
|
delete[] dummy;
|
||||||
|
@ -211,7 +213,8 @@ end:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple test which read/writes blocks on a chain of block devices
|
// Simple test which read/writes blocks on a chain of block devices
|
||||||
void test_profiling() {
|
void test_profiling()
|
||||||
|
{
|
||||||
uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];
|
uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];
|
||||||
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
|
||||||
delete[] dummy;
|
delete[] dummy;
|
||||||
|
@ -287,7 +290,8 @@ end:
|
||||||
|
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
|
{
|
||||||
GREENTEA_SETUP(10, "default_auto");
|
GREENTEA_SETUP(10, "default_auto");
|
||||||
return verbose_test_setup_handler(number_of_cases);
|
return verbose_test_setup_handler(number_of_cases);
|
||||||
}
|
}
|
||||||
|
@ -300,6 +304,7 @@ Case cases[] = {
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
return !Harness::run(specification);
|
return !Harness::run(specification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ HeapBlockDevice bd(128*BLOCK_SIZE, BLOCK_SIZE);
|
||||||
|
|
||||||
|
|
||||||
// Test formatting
|
// Test formatting
|
||||||
void test_format() {
|
void test_format()
|
||||||
|
{
|
||||||
int err = FATFileSystem::format(&bd);
|
int err = FATFileSystem::format(&bd);
|
||||||
TEST_ASSERT_EQUAL(0, err);
|
TEST_ASSERT_EQUAL(0, err);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,8 @@ void test_format() {
|
||||||
|
|
||||||
// Simple test for reading/writing files
|
// Simple test for reading/writing files
|
||||||
template <ssize_t TEST_SIZE>
|
template <ssize_t TEST_SIZE>
|
||||||
void test_read_write() {
|
void test_read_write()
|
||||||
|
{
|
||||||
FATFileSystem fs("fat");
|
FATFileSystem fs("fat");
|
||||||
|
|
||||||
int err = fs.mount(&bd);
|
int err = fs.mount(&bd);
|
||||||
|
@ -86,7 +88,8 @@ void test_read_write() {
|
||||||
|
|
||||||
|
|
||||||
// Simple test for iterating dir entries
|
// Simple test for iterating dir entries
|
||||||
void test_read_dir() {
|
void test_read_dir()
|
||||||
|
{
|
||||||
FATFileSystem fs("fat");
|
FATFileSystem fs("fat");
|
||||||
|
|
||||||
int err = fs.mount(&bd);
|
int err = fs.mount(&bd);
|
||||||
|
@ -147,7 +150,8 @@ void test_read_dir() {
|
||||||
|
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
|
{
|
||||||
GREENTEA_SETUP(10, "default_auto");
|
GREENTEA_SETUP(10, "default_auto");
|
||||||
return verbose_test_setup_handler(number_of_cases);
|
return verbose_test_setup_handler(number_of_cases);
|
||||||
}
|
}
|
||||||
|
@ -161,6 +165,7 @@ Case cases[] = {
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
return !Harness::run(specification);
|
return !Harness::run(specification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,8 @@ HeapBlockDevice bd(BLOCK_COUNT*BLOCK_SIZE, BLOCK_SIZE);
|
||||||
|
|
||||||
|
|
||||||
// Test formatting and partitioning
|
// Test formatting and partitioning
|
||||||
void test_format() {
|
void test_format()
|
||||||
|
{
|
||||||
// Create two partitions splitting device in ~half
|
// Create two partitions splitting device in ~half
|
||||||
int err = MBRBlockDevice::partition(&bd, 1, 0x83, 0, (BLOCK_COUNT / 2) * BLOCK_SIZE);
|
int err = MBRBlockDevice::partition(&bd, 1, 0x83, 0, (BLOCK_COUNT / 2) * BLOCK_SIZE);
|
||||||
TEST_ASSERT_EQUAL(0, err);
|
TEST_ASSERT_EQUAL(0, err);
|
||||||
|
@ -72,7 +73,8 @@ void test_format() {
|
||||||
|
|
||||||
// Simple multipartition test for reading/writing files
|
// Simple multipartition test for reading/writing files
|
||||||
template <ssize_t TEST_SIZE>
|
template <ssize_t TEST_SIZE>
|
||||||
void test_read_write() {
|
void test_read_write()
|
||||||
|
{
|
||||||
// Load both partitions
|
// Load both partitions
|
||||||
MBRBlockDevice part1(&bd, 1);
|
MBRBlockDevice part1(&bd, 1);
|
||||||
int err = part1.init();
|
int err = part1.init();
|
||||||
|
@ -163,7 +165,8 @@ void test_read_write() {
|
||||||
TEST_ASSERT_EQUAL(0, err);
|
TEST_ASSERT_EQUAL(0, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_single_mbr() {
|
void test_single_mbr()
|
||||||
|
{
|
||||||
int err = bd.init();
|
int err = bd.init();
|
||||||
TEST_ASSERT_EQUAL(0, err);
|
TEST_ASSERT_EQUAL(0, err);
|
||||||
|
|
||||||
|
@ -205,7 +208,8 @@ void test_single_mbr() {
|
||||||
|
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
|
{
|
||||||
GREENTEA_SETUP(10, "default_auto");
|
GREENTEA_SETUP(10, "default_auto");
|
||||||
return verbose_test_setup_handler(number_of_cases);
|
return verbose_test_setup_handler(number_of_cases);
|
||||||
}
|
}
|
||||||
|
@ -219,6 +223,7 @@ Case cases[] = {
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
return !Harness::run(specification);
|
return !Harness::run(specification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ typedef uint64_t bd_size_t;
|
||||||
|
|
||||||
/** A hardware device capable of writing and reading blocks
|
/** A hardware device capable of writing and reading blocks
|
||||||
*/
|
*/
|
||||||
class BlockDevice
|
class BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Return the default block device
|
/** Return the default block device
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
* after a configurable number of cycles.
|
* after a configurable number of cycles.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class ExhaustibleBlockDevice : public BlockDevice
|
class ExhaustibleBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/** Lifetime of the block device
|
/** Lifetime of the block device
|
||||||
*
|
*
|
||||||
|
|
|
@ -50,8 +50,7 @@
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
class HeapBlockDevice : public BlockDevice
|
class HeapBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Lifetime of the memory block device
|
/** Lifetime of the memory block device
|
||||||
|
|
|
@ -87,8 +87,7 @@ enum {
|
||||||
* - At most 4 partitions are supported
|
* - At most 4 partitions are supported
|
||||||
* - Extended partitions are currently not supported and will error during init
|
* - Extended partitions are currently not supported and will error during init
|
||||||
*/
|
*/
|
||||||
class MBRBlockDevice : public BlockDevice
|
class MBRBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/** Format the MBR to contain the following partition
|
/** Format the MBR to contain the following partition
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
|
|
||||||
|
|
||||||
class ObservingBlockDevice : public BlockDevice
|
class ObservingBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Lifetime of the block device
|
/** Lifetime of the block device
|
||||||
|
|
|
@ -43,8 +43,7 @@
|
||||||
* printf("erase count: %lld\n", profiler.get_erase_count());
|
* printf("erase count: %lld\n", profiler.get_erase_count());
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
class ProfilingBlockDevice : public BlockDevice
|
class ProfilingBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/** Lifetime of the memory block device
|
/** Lifetime of the memory block device
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
#include "PlatformMutex.h"
|
#include "PlatformMutex.h"
|
||||||
|
|
||||||
|
|
||||||
class ReadOnlyBlockDevice : public BlockDevice
|
class ReadOnlyBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Lifetime of the block device
|
/** Lifetime of the block device
|
||||||
|
|
|
@ -45,8 +45,7 @@
|
||||||
* SlicingBlockDevice slice3(&mem, 16*512, -16*512);
|
* SlicingBlockDevice slice3(&mem, 16*512, -16*512);
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
class SlicingBlockDevice : public BlockDevice
|
class SlicingBlockDevice : public BlockDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/** Lifetime of the memory block device
|
/** Lifetime of the memory block device
|
||||||
*
|
*
|
||||||
|
|
|
@ -139,7 +139,8 @@ size_t FileSystem::dir_size(fs_dir_t dir)
|
||||||
template <typename F>
|
template <typename F>
|
||||||
class Managed : public F {
|
class Managed : public F {
|
||||||
public:
|
public:
|
||||||
virtual int close() {
|
virtual int close()
|
||||||
|
{
|
||||||
int err = F::close();
|
int err = F::close();
|
||||||
delete this;
|
delete this;
|
||||||
return err;
|
return err;
|
||||||
|
@ -159,7 +160,8 @@ int FileSystem::open(FileHandle **file, const char *path, int flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FileSystem::open(DirHandle **dir, const char *path) {
|
int FileSystem::open(DirHandle **dir, const char *path)
|
||||||
|
{
|
||||||
Dir *d = new Managed<Dir>;
|
Dir *d = new Managed<Dir>;
|
||||||
int err = d->open(this, path);
|
int err = d->open(this, path);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -280,7 +280,8 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
|
||||||
|
|
||||||
// Filesystem implementation (See FATFilySystem.h)
|
// Filesystem implementation (See FATFilySystem.h)
|
||||||
FATFileSystem::FATFileSystem(const char *name, BlockDevice *bd)
|
FATFileSystem::FATFileSystem(const char *name, BlockDevice *bd)
|
||||||
: FileSystem(name), _id(-1) {
|
: FileSystem(name), _id(-1)
|
||||||
|
{
|
||||||
if (bd) {
|
if (bd) {
|
||||||
mount(bd);
|
mount(bd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,7 +666,8 @@ clean:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
|
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason)
|
||||||
|
{
|
||||||
greentea_case_failure_abort_handler(source, reason);
|
greentea_case_failure_abort_handler(source, reason);
|
||||||
return STATUS_CONTINUE;
|
return STATUS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,7 @@ static const uint16_t master_record_key = 0xFFE;
|
||||||
static const uint16_t no_key = 0xFFF;
|
static const uint16_t no_key = 0xFFF;
|
||||||
static const uint16_t last_reserved_key = master_record_key;
|
static const uint16_t last_reserved_key = master_record_key;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint16_t key_and_flags;
|
uint16_t key_and_flags;
|
||||||
uint16_t size_and_owner;
|
uint16_t size_and_owner;
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
|
@ -88,10 +87,12 @@ static const uint8_t blank_flash_val = 0xFF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{NVSTORE_AREA_1_ADDRESS, NVSTORE_AREA_1_SIZE},
|
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{NVSTORE_AREA_1_ADDRESS, NVSTORE_AREA_1_SIZE},
|
||||||
{NVSTORE_AREA_2_ADDRESS, NVSTORE_AREA_2_SIZE}};
|
{NVSTORE_AREA_2_ADDRESS, NVSTORE_AREA_2_SIZE}
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{0, 0},
|
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{0, 0},
|
||||||
{0, 0}};
|
{0, 0}
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Reference in New Issue