Raul Rangel submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Karthik Ramasubramanian: Looks good to me, approved
commonlib/region: Add rdev_readat_full helper method

This helper method makes the code a bit cleaner.

BUG=b:179699789
TEST=none

Suggested-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ie442217eba2e8f99de1407d61f965428b5c6f3bf
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58761
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
---
M src/commonlib/include/commonlib/region.h
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/commonlib/include/commonlib/region.h b/src/commonlib/include/commonlib/region.h
index 764870f..5d73d9e 100644
--- a/src/commonlib/include/commonlib/region.h
+++ b/src/commonlib/include/commonlib/region.h
@@ -158,6 +158,17 @@
}

/*
+ * Returns < 0 on error otherwise returns size of data read at provided
+ * offset filling in the buffer passed.
+ *
+ * You must ensure the buffer is large enough to hold the full region_device.
+ */
+static inline ssize_t rdev_readat_full(const struct region_device *rd, void *b)
+{
+ return rdev_readat(rd, b, 0, region_device_sz(rd));
+}
+
+/*
* Compute relative offset of the child (c) w.r.t. the parent (p). Returns < 0
* when child is not within the parent's region.
*/

To view, visit change 58761. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie442217eba2e8f99de1407d61f965428b5c6f3bf
Gerrit-Change-Number: 58761
Gerrit-PatchSet: 3
Gerrit-Owner: Raul Rangel <rrangel@chromium.org>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Karthik Ramasubramanian <kramasub@google.com>
Gerrit-Reviewer: Raul Rangel <rrangel@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged