summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2021-10-29 15:18:40 -0600
committerRaul Rangel <rrangel@chromium.org>2021-11-01 18:01:53 +0000
commit0f4b8a24db92fa8b1abd79308ff69c4e48808878 (patch)
tree15071ddc9dd46c817a219ca14fed830aa324f7fd
parent67258983e6ffb2de02617784dafe37584fd4c089 (diff)
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>
-rw-r--r--src/commonlib/include/commonlib/region.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/region.h b/src/commonlib/include/commonlib/region.h
index 764870f46c..5d73d9e199 100644
--- a/src/commonlib/include/commonlib/region.h
+++ b/src/commonlib/include/commonlib/region.h
@@ -158,6 +158,17 @@ static inline int rdev_chain_full(struct region_device *child,
}
/*
+ * 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.
*/