summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-11 13:55:04 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-12 01:03:47 -0700
commitd5f1d40f2ddf9234099b331e1d90c54ece0ee88b (patch)
tree41b69f239b5121ee39f7f2ca51453cfa6d62a44e
parentb7c49b22ccb82add7874b30cd96931b0f19b20e0 (diff)
downloadphosphor-mboxbridge-d5f1d40f2ddf9234099b331e1d90c54ece0ee88b.tar.gz
phosphor-mboxbridge-d5f1d40f2ddf9234099b331e1d90c54ece0ee88b.zip
clang-format: Pull the format rules from the openbmc/docs repo
This makes it consistent with other openbmc projects for c++ formatting. Tested: Run through the unit test suite. Change-Id: I92030ce5b42de01360393687fb438faf26f36ac8 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--.clang-format-c++24
-rw-r--r--vpnor/flash.cpp17
-rw-r--r--vpnor/lpc_reset.cpp4
-rw-r--r--vpnor/mboxd_pnor_partition_table.cpp34
-rw-r--r--vpnor/pnor_partition.cpp29
-rw-r--r--vpnor/pnor_partition.hpp7
-rw-r--r--vpnor/pnor_partition_table.cpp19
-rw-r--r--vpnor/pnor_partition_table.hpp8
-rw-r--r--vpnor/protocol.cpp22
-rw-r--r--vpnor/protocol_negotiate_version.cpp4
-rw-r--r--vpnor/test/create_pnor_partition_table.cpp7
-rw-r--r--vpnor/test/create_read_window_oob.cpp5
-rw-r--r--vpnor/test/create_read_window_partition_exists.cpp8
-rw-r--r--vpnor/test/create_read_window_partition_invalid.cpp5
-rw-r--r--vpnor/test/create_read_window_remap.cpp8
-rw-r--r--vpnor/test/create_read_window_size.cpp6
-rw-r--r--vpnor/test/create_read_window_straddle_partitions.cpp2
-rw-r--r--vpnor/test/create_read_window_toc.cpp9
-rw-r--r--vpnor/test/create_write_window_ro_partition.cpp5
-rw-r--r--vpnor/test/create_write_window_rw_partition.cpp5
-rw-r--r--vpnor/test/create_write_window_unmapped.cpp5
-rw-r--r--vpnor/test/dump_flash.cpp7
-rw-r--r--vpnor/test/read_patch.cpp7
-rw-r--r--vpnor/test/tmpd.cpp8
-rw-r--r--vpnor/test/tmpd.hpp11
-rw-r--r--vpnor/test/toc_flags.cpp4
-rw-r--r--vpnor/test/toc_lookup_failed.cpp7
-rw-r--r--vpnor/test/toc_lookup_found.cpp7
-rw-r--r--vpnor/test/toc_missing_file.cpp7
-rw-r--r--vpnor/test/toc_no_end.cpp3
-rw-r--r--vpnor/test/toc_no_name.cpp3
-rw-r--r--vpnor/test/toc_no_start.cpp3
-rw-r--r--vpnor/test/toc_no_version.cpp3
-rw-r--r--vpnor/test/toc_overlap.cpp7
-rw-r--r--vpnor/test/toc_start_gt_end.cpp3
-rw-r--r--vpnor/test/write_patch.cpp8
-rw-r--r--vpnor/test/write_patch_resize.cpp8
-rw-r--r--vpnor/test/write_prsv.cpp2
-rw-r--r--vpnor/test/write_rw.cpp2
39 files changed, 198 insertions, 135 deletions
diff --git a/.clang-format-c++ b/.clang-format-c++
index 309a9d6..ea71ad6 100644
--- a/.clang-format-c++
+++ b/.clang-format-c++
@@ -17,7 +17,7 @@ AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -42,15 +42,29 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 5
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.hpp"'
+ Priority: 1
+ - Regex: '^<.*\.h>'
+ Priority: 2
+ - Regex: '^<.*'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 4
IndentCaseLabels: true
IndentWidth: 4
-IndentWrappedFunctionNames: false
+IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -65,9 +79,9 @@ PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
-SortIncludes: false
+SortIncludes: true
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
diff --git a/vpnor/flash.cpp b/vpnor/flash.cpp
index f7e0713..cd2a37f 100644
--- a/vpnor/flash.cpp
+++ b/vpnor/flash.cpp
@@ -4,10 +4,11 @@
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
-#include <syslog.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <syslog.h>
#include <unistd.h>
-#include <sys/ioctl.h>
+
#include <algorithm>
extern "C" {
@@ -16,17 +17,19 @@ extern "C" {
}
#include "config.h"
-#include "mboxd_pnor_partition_table.h"
+
#include "pnor_partition.hpp"
#include "pnor_partition_table.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog-errors.hpp>
-#include <memory>
-#include <string>
#include <exception>
+#include <memory>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
#include <stdexcept>
+#include <string>
+
+#include "mboxd_pnor_partition_table.h"
namespace err = sdbusplus::xyz::openbmc_project::Common::Error;
namespace fs = std::experimental::filesystem;
diff --git a/vpnor/lpc_reset.cpp b/vpnor/lpc_reset.cpp
index 8143737..80ec6ac 100644
--- a/vpnor/lpc_reset.cpp
+++ b/vpnor/lpc_reset.cpp
@@ -18,8 +18,8 @@
*/
extern "C" {
-#include "mboxd.h"
#include "lpc.h"
+#include "mboxd.h"
}
#include "mboxd_pnor_partition_table.h"
@@ -30,7 +30,7 @@ extern "C" {
*
* Return 0 on success otherwise negative error code
*/
-int lpc_reset(struct mbox_context *context)
+int lpc_reset(struct mbox_context* context)
{
int rc;
diff --git a/vpnor/mboxd_pnor_partition_table.cpp b/vpnor/mboxd_pnor_partition_table.cpp
index 23fc4cf..9a82151 100644
--- a/vpnor/mboxd_pnor_partition_table.cpp
+++ b/vpnor/mboxd_pnor_partition_table.cpp
@@ -4,17 +4,19 @@ extern "C" {
#include "flash.h"
}
-#include "mboxd_pnor_partition_table.h"
-#include "pnor_partition_table.hpp"
-#include "common.h"
-#include "mboxd.h"
-#include "pnor_partition_table.hpp"
#include "config.h"
+
+#include "pnor_partition_table.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
-#include <phosphor-logging/elog-errors.hpp>
+
#include <experimental/filesystem>
+#include <phosphor-logging/elog-errors.hpp>
+
+#include "common.h"
+#include "mboxd.h"
+#include "mboxd_pnor_partition_table.h"
-int init_vpnor(struct mbox_context *context)
+int init_vpnor(struct mbox_context* context)
{
if (context && !context->vpnor)
{
@@ -39,7 +41,7 @@ int init_vpnor(struct mbox_context *context)
return 0;
}
-int init_vpnor_from_paths(struct mbox_context *context)
+int init_vpnor_from_paths(struct mbox_context* context)
{
namespace err = sdbusplus::xyz::openbmc_project::Common::Error;
namespace fs = std::experimental::filesystem;
@@ -53,7 +55,7 @@ int init_vpnor_from_paths(struct mbox_context *context)
context->vpnor->table =
new openpower::virtual_pnor::partition::Table(context);
}
- catch (vpnor::TocEntryError &e)
+ catch (vpnor::TocEntryError& e)
{
MSG_ERR("%s\n", e.what());
phosphor::logging::commit<err::InternalFailure>();
@@ -64,7 +66,7 @@ int init_vpnor_from_paths(struct mbox_context *context)
return 0;
}
-int vpnor_copy_bootloader_partition(const struct mbox_context *context)
+int vpnor_copy_bootloader_partition(const struct mbox_context* context)
{
// The hostboot bootloader has certain size/offset assumptions, so
// we need a special partition table here.
@@ -100,21 +102,21 @@ int vpnor_copy_bootloader_partition(const struct mbox_context *context)
// Copy TOC
flash_copy(&local, tocOffset,
- static_cast<uint8_t *>(context->mem) + tocStart,
+ static_cast<uint8_t*>(context->mem) + tocStart,
blTable.capacity());
- const pnor_partition &partition = blTable.partition(blPartitionName);
+ const pnor_partition& partition = blTable.partition(blPartitionName);
size_t hbbOffset = partition.data.base * eraseSize;
uint32_t hbbSize = partition.data.actual;
// Copy HBB
flash_copy(&local, hbbOffset,
- static_cast<uint8_t *>(context->mem) + hbbOffset, hbbSize);
+ static_cast<uint8_t*>(context->mem) + hbbOffset, hbbSize);
}
- catch (err::InternalFailure &e)
+ catch (err::InternalFailure& e)
{
phosphor::logging::commit<err::InternalFailure>();
return -EIO;
}
- catch (vpnor::ReasonedError &e)
+ catch (vpnor::ReasonedError& e)
{
MSG_ERR("%s\n", e.what());
phosphor::logging::commit<err::InternalFailure>();
@@ -124,7 +126,7 @@ int vpnor_copy_bootloader_partition(const struct mbox_context *context)
return 0;
}
-void destroy_vpnor(struct mbox_context *context)
+void destroy_vpnor(struct mbox_context* context)
{
if (context && context->vpnor)
{
diff --git a/vpnor/pnor_partition.cpp b/vpnor/pnor_partition.cpp
index 4c5a95c..613ee26 100644
--- a/vpnor/pnor_partition.cpp
+++ b/vpnor/pnor_partition.cpp
@@ -4,30 +4,31 @@ extern "C" {
#include "flash.h"
}
+#include "config.h"
+
#include "pnor_partition.hpp"
#include "pnor_partition_table.hpp"
-#include "config.h"
-#include "mboxd_pnor_partition_table.h"
#include "xyz/openbmc_project/Common/error.hpp"
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog-errors.hpp>
#include <assert.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
-#include <syslog.h>
-#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <sys/types.h>
+#include <syslog.h>
#include <unistd.h>
-#include "common.h"
-
-#include <string>
#include <exception>
-#include <stdexcept>
#include <iostream>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
+#include <stdexcept>
+#include <string>
+
+#include "common.h"
+#include "mboxd_pnor_partition_table.h"
namespace openpower
{
@@ -99,7 +100,7 @@ size_t Request::clamp(size_t len)
return std::min(maxAccess, partSize) - offset;
}
-void Request::resize(const fs::path &path, size_t len)
+void Request::resize(const fs::path& path, size_t len)
{
size_t maxAccess = offset + len;
size_t fileSize = fs::file_size(path);
@@ -116,7 +117,7 @@ void Request::resize(const fs::path &path, size_t len)
}
}
-size_t Request::fulfil(const fs::path &path, int flags, void *buf, size_t len)
+size_t Request::fulfil(const fs::path& path, int flags, void* buf, size_t len)
{
if (!(flags == O_RDONLY || flags == O_RDWR))
{
@@ -162,11 +163,11 @@ size_t Request::fulfil(const fs::path &path, int flags, void *buf, size_t len)
if (flags == O_RDONLY)
{
memset(buf, 0xff, len);
- memcpy(buf, (char *)map + offset, std::min(len, fileSize));
+ memcpy(buf, (char*)map + offset, std::min(len, fileSize));
}
else
{
- memcpy((char *)map + offset, buf, len);
+ memcpy((char*)map + offset, buf, len);
flash_set_bytemap(ctx, base + offset, len, FLASH_DIRTY);
}
munmap(map, fileSize);
diff --git a/vpnor/pnor_partition.hpp b/vpnor/pnor_partition.hpp
index e98890d..95d4309 100644
--- a/vpnor/pnor_partition.hpp
+++ b/vpnor/pnor_partition.hpp
@@ -6,12 +6,15 @@ extern "C" {
#include "mboxd.h"
};
-#include "mboxd_pnor_partition_table.h"
#include "pnor_partition_table.hpp"
+
#include <fcntl.h>
-#include <string>
#include <unistd.h>
+
#include <experimental/filesystem>
+#include <string>
+
+#include "mboxd_pnor_partition_table.h"
namespace openpower
{
diff --git a/vpnor/pnor_partition_table.cpp b/vpnor/pnor_partition_table.cpp
index c77b938..aa0b2fb 100644
--- a/vpnor/pnor_partition_table.cpp
+++ b/vpnor/pnor_partition_table.cpp
@@ -1,16 +1,21 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include "pnor_partition_table.hpp"
-#include "common.h"
#include "config.h"
-#include "mboxd.h"
+
+#include "pnor_partition_table.hpp"
+
#include "xyz/openbmc_project/Common/error.hpp"
-#include <phosphor-logging/elog-errors.hpp>
-#include <syslog.h>
+
#include <endian.h>
-#include <regex>
-#include <fstream>
+#include <syslog.h>
+
#include <algorithm>
+#include <fstream>
+#include <phosphor-logging/elog-errors.hpp>
+#include <regex>
+
+#include "common.h"
+#include "mboxd.h"
namespace openpower
{
diff --git a/vpnor/pnor_partition_table.hpp b/vpnor/pnor_partition_table.hpp
index 8b80d74..8ba432a 100644
--- a/vpnor/pnor_partition_table.hpp
+++ b/vpnor/pnor_partition_table.hpp
@@ -2,10 +2,11 @@
/* Copyright (C) 2018 IBM Corp. */
#pragma once
-#include <vector>
+#include <experimental/filesystem>
#include <memory>
#include <numeric>
-#include <experimental/filesystem>
+#include <vector>
+
#include "common.h"
#include "pnor_partition_defs.h"
@@ -52,7 +53,8 @@ namespace details
*
* @returns computed checksum
*/
-template <class T> checksum_t checksum(const T& data)
+template <class T>
+checksum_t checksum(const T& data)
{
static_assert(sizeof(decltype(data)) % sizeof(checksum_t) == 0,
"sizeof(data) is not aligned to sizeof(checksum_t) boundary");
diff --git a/vpnor/protocol.cpp b/vpnor/protocol.cpp
index e5e1ad8..c3f4fca 100644
--- a/vpnor/protocol.cpp
+++ b/vpnor/protocol.cpp
@@ -11,16 +11,16 @@ extern "C" {
#include "vpnor/pnor_partition_table.hpp"
/* XXX: Maybe this should be a method on a class? */
-static bool vpnor_partition_is_readonly(const pnor_partition &part)
+static bool vpnor_partition_is_readonly(const pnor_partition& part)
{
return part.data.user.data[1] & PARTITION_READONLY;
}
-typedef int (*create_window_fn)(struct mbox_context *context,
- struct protocol_create_window *io);
+typedef int (*create_window_fn)(struct mbox_context* context,
+ struct protocol_create_window* io);
-static int generic_vpnor_create_window(struct mbox_context *context,
- struct protocol_create_window *io,
+static int generic_vpnor_create_window(struct mbox_context* context,
+ struct protocol_create_window* io,
create_window_fn create_window)
{
if (io->req.ro)
@@ -33,13 +33,13 @@ static int generic_vpnor_create_window(struct mbox_context *context,
offset <<= context->block_size_shift;
try
{
- const pnor_partition &part = context->vpnor->table->partition(offset);
+ const pnor_partition& part = context->vpnor->table->partition(offset);
if (vpnor_partition_is_readonly(part))
{
return -EPERM;
}
}
- catch (const openpower::virtual_pnor::UnmappedOffset &e)
+ catch (const openpower::virtual_pnor::UnmappedOffset& e)
{
/*
* Writes to unmapped areas are not meaningful, so deny the request.
@@ -52,14 +52,14 @@ static int generic_vpnor_create_window(struct mbox_context *context,
return create_window(context, io);
}
-int protocol_v1_vpnor_create_window(struct mbox_context *context,
- struct protocol_create_window *io)
+int protocol_v1_vpnor_create_window(struct mbox_context* context,
+ struct protocol_create_window* io)
{
return generic_vpnor_create_window(context, io, protocol_v1_create_window);
}
-int protocol_v2_vpnor_create_window(struct mbox_context *context,
- struct protocol_create_window *io)
+int protocol_v2_vpnor_create_window(struct mbox_context* context,
+ struct protocol_create_window* io)
{
return generic_vpnor_create_window(context, io, protocol_v2_create_window);
}
diff --git a/vpnor/protocol_negotiate_version.cpp b/vpnor/protocol_negotiate_version.cpp
index 046d536..12593ea 100644
--- a/vpnor/protocol_negotiate_version.cpp
+++ b/vpnor/protocol_negotiate_version.cpp
@@ -36,13 +36,13 @@ static const struct protocol_ops protocol_ops_v2 = {
.ack = protocol_v1_ack,
};
-static const struct protocol_ops *protocol_ops_map[] = {
+static const struct protocol_ops* protocol_ops_map[] = {
[0] = NULL,
[1] = &protocol_ops_v1,
[2] = &protocol_ops_v2,
};
-int protocol_negotiate_version(struct mbox_context *context, uint8_t requested)
+int protocol_negotiate_version(struct mbox_context* context, uint8_t requested)
{
/* Check we support the version requested */
if (requested < API_MIN_VERSION)
diff --git a/vpnor/test/create_pnor_partition_table.cpp b/vpnor/test/create_pnor_partition_table.cpp
index 3a46e38..ab28180 100644
--- a/vpnor/test/create_pnor_partition_table.cpp
+++ b/vpnor/test/create_pnor_partition_table.cpp
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include <assert.h>
-#include <string.h>
-
#include "config.h"
+
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+#include <string.h>
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
diff --git a/vpnor/test/create_read_window_oob.cpp b/vpnor/test/create_read_window_oob.cpp
index 445b0a1..2b8fe6d 100644
--- a/vpnor/test/create_read_window_oob.cpp
+++ b/vpnor/test/create_read_window_oob.cpp
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
#include <string.h>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -41,7 +42,7 @@ int main()
{
namespace test = openpower::virtual_pnor::test;
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
int rc;
system_set_reserved_size(MEM_SIZE);
diff --git a/vpnor/test/create_read_window_partition_exists.cpp b/vpnor/test/create_read_window_partition_exists.cpp
index 12ac19b..f02272d 100644
--- a/vpnor/test/create_read_window_partition_exists.cpp
+++ b/vpnor/test/create_read_window_partition_exists.cpp
@@ -1,13 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
+#include <string.h>
+
#include <experimental/filesystem>
#include <fstream>
-#include <string.h>
#include <vector>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -47,7 +49,7 @@ namespace test = openpower::virtual_pnor::test;
int main()
{
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/create_read_window_partition_invalid.cpp b/vpnor/test/create_read_window_partition_invalid.cpp
index 9ed4347..e6747c8 100644
--- a/vpnor/test/create_read_window_partition_invalid.cpp
+++ b/vpnor/test/create_read_window_partition_invalid.cpp
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
#include <string.h>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -37,7 +38,7 @@ int main()
{
namespace test = openpower::virtual_pnor::test;
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
int rc;
system_set_reserved_size(MEM_SIZE);
diff --git a/vpnor/test/create_read_window_remap.cpp b/vpnor/test/create_read_window_remap.cpp
index ea319c1..c05ef02 100644
--- a/vpnor/test/create_read_window_remap.cpp
+++ b/vpnor/test/create_read_window_remap.cpp
@@ -1,13 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
+#include <string.h>
+
#include <experimental/filesystem>
#include <fstream>
-#include <string.h>
#include <vector>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -41,7 +43,7 @@ int main()
uint8_t response[] = {0x04, 0x01, 0xe0, 0xff, 0x10, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/create_read_window_size.cpp b/vpnor/test/create_read_window_size.cpp
index 1837546..6f9a7ed 100644
--- a/vpnor/test/create_read_window_size.cpp
+++ b/vpnor/test/create_read_window_size.cpp
@@ -1,10 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
+
#include <experimental/filesystem>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -49,7 +51,7 @@ namespace test = openpower::virtual_pnor::test;
int main()
{
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/create_read_window_straddle_partitions.cpp b/vpnor/test/create_read_window_straddle_partitions.cpp
index e396088..168598d 100644
--- a/vpnor/test/create_read_window_straddle_partitions.cpp
+++ b/vpnor/test/create_read_window_straddle_partitions.cpp
@@ -47,7 +47,7 @@ int main()
namespace test = openpower::virtual_pnor::test;
namespace fs = std::experimental::filesystem;
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/create_read_window_toc.cpp b/vpnor/test/create_read_window_toc.cpp
index 32f6523..e0a5548 100644
--- a/vpnor/test/create_read_window_toc.cpp
+++ b/vpnor/test/create_read_window_toc.cpp
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include <assert.h>
-#include <sys/mman.h>
-#include <string.h>
-
#include "config.h"
+
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+#include <string.h>
+#include <sys/mman.h>
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
diff --git a/vpnor/test/create_write_window_ro_partition.cpp b/vpnor/test/create_write_window_ro_partition.cpp
index 09dbba0..fa53003 100644
--- a/vpnor/test/create_write_window_ro_partition.cpp
+++ b/vpnor/test/create_write_window_ro_partition.cpp
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -39,7 +40,7 @@ namespace test = openpower::virtual_pnor::test;
int main()
{
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/create_write_window_rw_partition.cpp b/vpnor/test/create_write_window_rw_partition.cpp
index 74b5831..896c284 100644
--- a/vpnor/test/create_write_window_rw_partition.cpp
+++ b/vpnor/test/create_write_window_rw_partition.cpp
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -39,7 +40,7 @@ namespace test = openpower::virtual_pnor::test;
int main()
{
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/create_write_window_unmapped.cpp b/vpnor/test/create_write_window_unmapped.cpp
index 47ba57e..e26749e 100644
--- a/vpnor/test/create_write_window_unmapped.cpp
+++ b/vpnor/test/create_write_window_unmapped.cpp
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
-#include "config.h"
#include "vpnor/mboxd_pnor_partition_table.h"
extern "C" {
@@ -40,7 +41,7 @@ namespace test = openpower::virtual_pnor::test;
int main()
{
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/dump_flash.cpp b/vpnor/test/dump_flash.cpp
index 905bebd..84a88d8 100644
--- a/vpnor/test/dump_flash.cpp
+++ b/vpnor/test/dump_flash.cpp
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
#include <string.h>
-#include "config.h"
#include "transport_mbox.h"
#include "vpnor/mboxd_pnor_partition_table.h"
@@ -18,7 +19,7 @@ extern "C" {
struct test_context
{
uint8_t seq;
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
};
// Configure the system and the paritions such that we eventually request a
@@ -41,7 +42,7 @@ static const uint8_t get_info[] = {0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
static constexpr auto MBOX_CREATE_READ_WINDOW = 4;
-static int mbox_create_read_window(struct test_context *tctx, size_t offset,
+static int mbox_create_read_window(struct test_context* tctx, size_t offset,
size_t len)
{
union mbox_regs regs;
diff --git a/vpnor/test/read_patch.cpp b/vpnor/test/read_patch.cpp
index 31a422e..9429d4d 100644
--- a/vpnor/test/read_patch.cpp
+++ b/vpnor/test/read_patch.cpp
@@ -2,11 +2,12 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
-#include "common.h"
-#include "vpnor/mboxd_pnor_partition_table.h"
#include <assert.h>
+#include "common.h"
+#include "vpnor/mboxd_pnor_partition_table.h"
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
@@ -42,7 +43,7 @@ int main()
{
namespace test = openpower::virtual_pnor::test;
- struct mbox_context *ctx;
+ struct mbox_context* ctx;
system_set_reserved_size(MEM_SIZE);
system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE);
diff --git a/vpnor/test/tmpd.cpp b/vpnor/test/tmpd.cpp
index 1aaa1fb..917fb71 100644
--- a/vpnor/test/tmpd.cpp
+++ b/vpnor/test/tmpd.cpp
@@ -12,7 +12,7 @@ namespace test
namespace fs = std::experimental::filesystem;
-size_t VpnorRoot::write(const std::string &name, const void *data, size_t len)
+size_t VpnorRoot::write(const std::string& name, const void* data, size_t len)
{
// write() is for test environment setup - always write to ro section
fs::path path = root / "ro" / name;
@@ -21,18 +21,18 @@ size_t VpnorRoot::write(const std::string &name, const void *data, size_t len)
/* It's not in the ToC */
throw std::invalid_argument(name);
- std::ofstream(path).write((const char *)data, len);
+ std::ofstream(path).write((const char*)data, len);
return len;
}
-size_t VpnorRoot::patch(const std::string &name, const void *data, size_t len)
+size_t VpnorRoot::patch(const std::string& name, const void* data, size_t len)
{
if (!fs::exists(root / "ro" / name))
/* It's not in the ToC */
throw std::invalid_argument(name);
- std::ofstream(root / "patch" / name).write((const char *)data, len);
+ std::ofstream(root / "patch" / name).write((const char*)data, len);
return len;
}
diff --git a/vpnor/test/tmpd.hpp b/vpnor/test/tmpd.hpp
index 19890eb..2239f9c 100644
--- a/vpnor/test/tmpd.hpp
+++ b/vpnor/test/tmpd.hpp
@@ -1,15 +1,18 @@
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright (C) 2018 IBM Corp. */
+#include "config.h"
+
+#include "vpnor/pnor_partition_table.hpp"
+
#include <assert.h>
#include <string.h>
-#include <vector>
-#include <fstream>
+
#include <experimental/filesystem>
+#include <fstream>
+#include <vector>
-#include "config.h"
#include "mboxd.h"
-#include "vpnor/pnor_partition_table.hpp"
namespace openpower
{
diff --git a/vpnor/test/toc_flags.cpp b/vpnor/test/toc_flags.cpp
index c30f7ad..b32b6c2 100644
--- a/vpnor/test/toc_flags.cpp
+++ b/vpnor/test/toc_flags.cpp
@@ -2,11 +2,13 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
+
+#include "vpnor/pnor_partition_table.hpp"
+
#include <assert.h>
#include "common.h"
#include "vpnor/pnor_partition_defs.h"
-#include "vpnor/pnor_partition_table.hpp"
static constexpr auto BLOCK_SIZE = 4 * 1024;
static constexpr auto DATA_MASK = ((1 << 24) - 1);
diff --git a/vpnor/test/toc_lookup_failed.cpp b/vpnor/test/toc_lookup_failed.cpp
index 199a00b..7c68c7d 100644
--- a/vpnor/test/toc_lookup_failed.cpp
+++ b/vpnor/test/toc_lookup_failed.cpp
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include <assert.h>
-#include <string.h>
-
#include "config.h"
+
#include "vpnor/pnor_partition_table.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
+#include <assert.h>
+#include <string.h>
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
diff --git a/vpnor/test/toc_lookup_found.cpp b/vpnor/test/toc_lookup_found.cpp
index 411e3f8..507f6d9 100644
--- a/vpnor/test/toc_lookup_found.cpp
+++ b/vpnor/test/toc_lookup_found.cpp
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include <assert.h>
-#include <string.h>
-
#include "config.h"
+
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+#include <string.h>
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
diff --git a/vpnor/test/toc_missing_file.cpp b/vpnor/test/toc_missing_file.cpp
index 821653f..117a0bf 100644
--- a/vpnor/test/toc_missing_file.cpp
+++ b/vpnor/test/toc_missing_file.cpp
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include <assert.h>
-#include <string.h>
-
#include "config.h"
+
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+#include <string.h>
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
diff --git a/vpnor/test/toc_no_end.cpp b/vpnor/test/toc_no_end.cpp
index f9c5187..1eff2f2 100644
--- a/vpnor/test/toc_no_end.cpp
+++ b/vpnor/test/toc_no_end.cpp
@@ -2,10 +2,11 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
-#include <assert.h>
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+
static constexpr auto BLOCK_SIZE = 4 * 1024;
int main()
diff --git a/vpnor/test/toc_no_name.cpp b/vpnor/test/toc_no_name.cpp
index d62056f..0415ead 100644
--- a/vpnor/test/toc_no_name.cpp
+++ b/vpnor/test/toc_no_name.cpp
@@ -2,10 +2,11 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
-#include <assert.h>
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+
static constexpr auto BLOCK_SIZE = 4 * 1024;
int main()
diff --git a/vpnor/test/toc_no_start.cpp b/vpnor/test/toc_no_start.cpp
index 1d20a46..e07c5d4 100644
--- a/vpnor/test/toc_no_start.cpp
+++ b/vpnor/test/toc_no_start.cpp
@@ -2,10 +2,11 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
-#include <assert.h>
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+
static constexpr auto BLOCK_SIZE = 4 * 1024;
int main()
diff --git a/vpnor/test/toc_no_version.cpp b/vpnor/test/toc_no_version.cpp
index 68cb057..65ed071 100644
--- a/vpnor/test/toc_no_version.cpp
+++ b/vpnor/test/toc_no_version.cpp
@@ -2,10 +2,11 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
-#include <assert.h>
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+
static constexpr auto BLOCK_SIZE = 4 * 1024;
int main()
diff --git a/vpnor/test/toc_overlap.cpp b/vpnor/test/toc_overlap.cpp
index 94d071c..70a992e 100644
--- a/vpnor/test/toc_overlap.cpp
+++ b/vpnor/test/toc_overlap.cpp
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
-#include <assert.h>
-#include <string.h>
-
#include "config.h"
+
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+#include <string.h>
+
extern "C" {
#include "test/mbox.h"
#include "test/system.h"
diff --git a/vpnor/test/toc_start_gt_end.cpp b/vpnor/test/toc_start_gt_end.cpp
index 69edc63..ea64344 100644
--- a/vpnor/test/toc_start_gt_end.cpp
+++ b/vpnor/test/toc_start_gt_end.cpp
@@ -2,10 +2,11 @@
// Copyright (C) 2018 IBM Corp.
#include "config.h"
-#include <assert.h>
#include "vpnor/pnor_partition_table.hpp"
+#include <assert.h>
+
static constexpr auto BLOCK_SIZE = 4 * 1024;
int main()
diff --git a/vpnor/test/write_patch.cpp b/vpnor/test/write_patch.cpp
index e5a367d..b735d10 100644
--- a/vpnor/test/write_patch.cpp
+++ b/vpnor/test/write_patch.cpp
@@ -1,15 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
-#include <experimental/filesystem>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/syslog.h>
#include <unistd.h>
-#include "config.h"
+#include <experimental/filesystem>
+
#include "common.h"
#include "mboxd.h"
extern "C" {
@@ -35,7 +37,7 @@ int main(void)
struct mbox_context _ctx, *ctx = &_ctx;
char src[DATA_SIZE]{0};
- void *map;
+ void* map;
int rc;
int fd;
diff --git a/vpnor/test/write_patch_resize.cpp b/vpnor/test/write_patch_resize.cpp
index 28a73ce..866333f 100644
--- a/vpnor/test/write_patch_resize.cpp
+++ b/vpnor/test/write_patch_resize.cpp
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
+#include "config.h"
+
#include <assert.h>
-#include <experimental/filesystem>
#include <fcntl.h>
#include <stdint.h>
#include <sys/ioctl.h>
@@ -10,7 +11,8 @@
#include <sys/syslog.h>
#include <unistd.h>
-#include "config.h"
+#include <experimental/filesystem>
+
#include "common.h"
#include "mboxd.h"
@@ -35,7 +37,7 @@ int main(void)
namespace test = openpower::virtual_pnor::test;
struct mbox_context _ctx, *ctx = &_ctx;
- void *map;
+ void* map;
int rc;
int fd;
diff --git a/vpnor/test/write_prsv.cpp b/vpnor/test/write_prsv.cpp
index 21a0366..69b4989 100644
--- a/vpnor/test/write_prsv.cpp
+++ b/vpnor/test/write_prsv.cpp
@@ -30,7 +30,7 @@ int main(void)
struct mbox_context _ctx, *ctx = &_ctx;
uint8_t src[8];
- void *map;
+ void* map;
int fd;
int rc;
diff --git a/vpnor/test/write_rw.cpp b/vpnor/test/write_rw.cpp
index c40af6a..c9d2b60 100644
--- a/vpnor/test/write_rw.cpp
+++ b/vpnor/test/write_rw.cpp
@@ -29,7 +29,7 @@ int main(void)
struct mbox_context _ctx, *ctx = &_ctx;
uint8_t src[8] = {0};
- void *map;
+ void* map;
int rc;
int fd;
OpenPOWER on IntegriCloud