Fix-up coding style and add PREUPLOAD.cfg file.
Previous commits broke the style specified our .clang-format file -
fixed this by running it through clang-format(1). During this process
discovered that I've been invoking clang-format(1) without the
--style=file option meaning that our .clang-format file actually
hadn't been used at all. So there's a rather big amount of formatting
changes in this CL.
Also replaced the .clang-format symlink target to
../../build/tools/brillo-clang-format with our own file since the
brillo one may go away in the future or not exist at all.
Finally, added a PREULOAD.cfg file to do this on every commit. See
https://android.googlesource.com/platform/tools/repohooks/
for more information about how this works.
Bug: None
Test: Manually tested.
Test: All unit tests pass.
Change-Id: I6461478a62efd81689bc4316c22f758e7f98f59f
diff --git a/libavb_ab/avb_ab_flow.c b/libavb_ab/avb_ab_flow.c
index 37f0216..ed41556 100644
--- a/libavb_ab/avb_ab_flow.c
+++ b/libavb_ab/avb_ab_flow.c
@@ -86,9 +86,12 @@
AvbIOResult io_ret;
size_t num_bytes_read;
- io_ret =
- ops->read_from_partition(ops, "misc", AB_METADATA_MISC_PARTITION_OFFSET,
- sizeof(AvbABData), &serialized, &num_bytes_read);
+ io_ret = ops->read_from_partition(ops,
+ "misc",
+ AB_METADATA_MISC_PARTITION_OFFSET,
+ sizeof(AvbABData),
+ &serialized,
+ &num_bytes_read);
if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
return AVB_IO_RESULT_ERROR_OOM;
} else if (io_ret != AVB_IO_RESULT_OK ||
@@ -114,9 +117,11 @@
AvbIOResult io_ret;
avb_ab_data_update_crc_and_byteswap(data, &serialized);
- io_ret =
- ops->write_to_partition(ops, "misc", AB_METADATA_MISC_PARTITION_OFFSET,
- sizeof(AvbABData), &serialized);
+ io_ret = ops->write_to_partition(ops,
+ "misc",
+ AB_METADATA_MISC_PARTITION_OFFSET,
+ sizeof(AvbABData),
+ &serialized);
if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
return AVB_IO_RESULT_ERROR_OOM;
} else if (io_ret != AVB_IO_RESULT_OK) {
@@ -163,7 +168,8 @@
/* Helper function to load metadata - returns AVB_IO_RESULT_OK on
* success, error code otherwise.
*/
-static AvbIOResult load_metadata(AvbABOps* ab_ops, AvbABData* ab_data,
+static AvbIOResult load_metadata(AvbABOps* ab_ops,
+ AvbABData* ab_data,
AvbABData* ab_data_orig) {
AvbIOResult io_ret;
@@ -224,9 +230,11 @@
AvbSlotVerifyResult verify_result;
bool set_slot_unbootable = false;
- verify_result =
- avb_slot_verify(ops, requested_partitions, slot_suffixes[n],
- allow_verification_error, &slot_data[n]);
+ verify_result = avb_slot_verify(ops,
+ requested_partitions,
+ slot_suffixes[n],
+ allow_verification_error,
+ &slot_data[n]);
switch (verify_result) {
case AVB_SLOT_VERIFY_RESULT_ERROR_OOM:
ret = AVB_AB_FLOW_RESULT_ERROR_OOM;
@@ -250,11 +258,13 @@
case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED:
if (allow_verification_error) {
/* Do nothing since we allow this. */
- avb_debugv("Allowing slot ", slot_suffixes[n],
+ avb_debugv("Allowing slot ",
+ slot_suffixes[n],
" which verified "
"with result ",
avb_slot_verify_result_to_string(verify_result),
- " because |allow_verification_error| is true.\n", NULL);
+ " because |allow_verification_error| is true.\n",
+ NULL);
saw_and_allowed_verification_error = true;
} else {
set_slot_unbootable = true;
@@ -263,9 +273,12 @@
}
if (set_slot_unbootable) {
- avb_errorv("Error verifying slot ", slot_suffixes[n], " with result ",
+ avb_errorv("Error verifying slot ",
+ slot_suffixes[n],
+ " with result ",
avb_slot_verify_result_to_string(verify_result),
- " - setting unbootable.\n", NULL);
+ " - setting unbootable.\n",
+ NULL);
slot_set_unbootable(&ab_data.slots[n]);
}
}