storage: fix astyle coding style

pull/8591/head
Martin Kojtal 2018-10-30 14:57:42 +00:00
parent 5c79ba5189
commit e54ce88bca
30 changed files with 241 additions and 224 deletions

View File

@ -45,7 +45,8 @@ const struct {
// 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];
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
delete[] dummy;
@ -155,7 +156,8 @@ end:
// 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");
return verbose_test_setup_handler(number_of_cases);
}
@ -166,6 +168,7 @@ Case cases[] = {
Specification specification(test_setup, cases);
int main() {
int main()
{
return !Harness::run(specification);
}

View File

@ -232,7 +232,8 @@ end:
// 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");
return verbose_test_setup_handler(number_of_cases);
}
@ -245,6 +246,7 @@ Case cases[] = {
Specification specification(test_setup, cases);
int main() {
int main()
{
return !Harness::run(specification);
}

View File

@ -36,7 +36,8 @@ using namespace utest::v1;
// 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];
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
delete[] dummy;
@ -141,7 +142,8 @@ end:
}
// 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];
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
delete[] dummy;
@ -211,7 +213,8 @@ end:
}
// 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];
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
delete[] dummy;
@ -287,7 +290,8 @@ end:
// 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");
return verbose_test_setup_handler(number_of_cases);
}
@ -300,6 +304,7 @@ Case cases[] = {
Specification specification(test_setup, cases);
int main() {
int main()
{
return !Harness::run(specification);
}

View File

@ -35,7 +35,8 @@ HeapBlockDevice bd(128*BLOCK_SIZE, BLOCK_SIZE);
// Test formatting
void test_format() {
void test_format()
{
int err = FATFileSystem::format(&bd);
TEST_ASSERT_EQUAL(0, err);
}
@ -43,7 +44,8 @@ void test_format() {
// Simple test for reading/writing files
template <ssize_t TEST_SIZE>
void test_read_write() {
void test_read_write()
{
FATFileSystem fs("fat");
int err = fs.mount(&bd);
@ -86,7 +88,8 @@ void test_read_write() {
// Simple test for iterating dir entries
void test_read_dir() {
void test_read_dir()
{
FATFileSystem fs("fat");
int err = fs.mount(&bd);
@ -147,7 +150,8 @@ void test_read_dir() {
// 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");
return verbose_test_setup_handler(number_of_cases);
}
@ -161,6 +165,7 @@ Case cases[] = {
Specification specification(test_setup, cases);
int main() {
int main()
{
return !Harness::run(specification);
}

View File

@ -37,7 +37,8 @@ HeapBlockDevice bd(BLOCK_COUNT*BLOCK_SIZE, BLOCK_SIZE);
// Test formatting and partitioning
void test_format() {
void test_format()
{
// Create two partitions splitting device in ~half
int err = MBRBlockDevice::partition(&bd, 1, 0x83, 0, (BLOCK_COUNT / 2) * BLOCK_SIZE);
TEST_ASSERT_EQUAL(0, err);
@ -72,7 +73,8 @@ void test_format() {
// Simple multipartition test for reading/writing files
template <ssize_t TEST_SIZE>
void test_read_write() {
void test_read_write()
{
// Load both partitions
MBRBlockDevice part1(&bd, 1);
int err = part1.init();
@ -163,7 +165,8 @@ void test_read_write() {
TEST_ASSERT_EQUAL(0, err);
}
void test_single_mbr() {
void test_single_mbr()
{
int err = bd.init();
TEST_ASSERT_EQUAL(0, err);
@ -205,7 +208,8 @@ void test_single_mbr() {
// 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");
return verbose_test_setup_handler(number_of_cases);
}
@ -219,6 +223,7 @@ Case cases[] = {
Specification specification(test_setup, cases);
int main() {
int main()
{
return !Harness::run(specification);
}

View File

@ -40,8 +40,7 @@ typedef uint64_t bd_size_t;
/** A hardware device capable of writing and reading blocks
*/
class BlockDevice
{
class BlockDevice {
public:
/** Return the default block device

View File

@ -31,8 +31,7 @@
* after a configurable number of cycles.
*
*/
class ExhaustibleBlockDevice : public BlockDevice
{
class ExhaustibleBlockDevice : public BlockDevice {
public:
/** Lifetime of the block device
*

View File

@ -50,8 +50,7 @@
* }
* @endcode
*/
class HeapBlockDevice : public BlockDevice
{
class HeapBlockDevice : public BlockDevice {
public:
/** Lifetime of the memory block device

View File

@ -87,8 +87,7 @@ enum {
* - At most 4 partitions are supported
* - Extended partitions are currently not supported and will error during init
*/
class MBRBlockDevice : public BlockDevice
{
class MBRBlockDevice : public BlockDevice {
public:
/** Format the MBR to contain the following partition
*

View File

@ -27,8 +27,7 @@
#include "platform/Callback.h"
class ObservingBlockDevice : public BlockDevice
{
class ObservingBlockDevice : public BlockDevice {
public:
/** Lifetime of the block device

View File

@ -43,8 +43,7 @@
* printf("erase count: %lld\n", profiler.get_erase_count());
* @endcode
*/
class ProfilingBlockDevice : public BlockDevice
{
class ProfilingBlockDevice : public BlockDevice {
public:
/** Lifetime of the memory block device
*

View File

@ -26,8 +26,7 @@
#include "PlatformMutex.h"
class ReadOnlyBlockDevice : public BlockDevice
{
class ReadOnlyBlockDevice : public BlockDevice {
public:
/** Lifetime of the block device

View File

@ -45,8 +45,7 @@
* SlicingBlockDevice slice3(&mem, 16*512, -16*512);
* @endcode
*/
class SlicingBlockDevice : public BlockDevice
{
class SlicingBlockDevice : public BlockDevice {
public:
/** Lifetime of the memory block device
*

View File

@ -139,7 +139,8 @@ size_t FileSystem::dir_size(fs_dir_t dir)
template <typename F>
class Managed : public F {
public:
virtual int close() {
virtual int close()
{
int err = F::close();
delete this;
return err;
@ -159,7 +160,8 @@ int FileSystem::open(FileHandle **file, const char *path, int flags)
return 0;
}
int FileSystem::open(DirHandle **dir, const char *path) {
int FileSystem::open(DirHandle **dir, const char *path)
{
Dir *d = new Managed<Dir>;
int err = d->open(this, path);
if (err) {

View File

@ -280,7 +280,8 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
// Filesystem implementation (See FATFilySystem.h)
FATFileSystem::FATFileSystem(const char *name, BlockDevice *bd)
: FileSystem(name), _id(-1) {
: FileSystem(name), _id(-1)
{
if (bd) {
mount(bd);
}

View File

@ -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);
return STATUS_CONTINUE;
}

View File

@ -38,8 +38,7 @@ static const uint16_t master_record_key = 0xFFE;
static const uint16_t no_key = 0xFFF;
static const uint16_t last_reserved_key = master_record_key;
typedef struct
{
typedef struct {
uint16_t key_and_flags;
uint16_t size_and_owner;
uint32_t crc;
@ -88,10 +87,12 @@ static const uint8_t blank_flash_val = 0xFF;
#endif
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
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{0, 0},
{0, 0}};
{0, 0}
};
#endif
typedef enum {