summaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/include/commonlib/cbfs.h5
-rw-r--r--src/commonlib/include/commonlib/region.h8
2 files changed, 9 insertions, 4 deletions
diff --git a/src/commonlib/include/commonlib/cbfs.h b/src/commonlib/include/commonlib/cbfs.h
index cadc8c92cc..b0aa9d3ddb 100644
--- a/src/commonlib/include/commonlib/cbfs.h
+++ b/src/commonlib/include/commonlib/cbfs.h
@@ -32,14 +32,13 @@ int cbfs_locate(struct cbfsf *fh, const struct region_device *cbfs,
static inline void cbfs_file_data(struct region_device *data,
const struct cbfsf *file)
{
- rdev_chain(data, &file->data, 0, region_device_sz(&file->data));
+ rdev_chain_full(data, &file->data);
}
static inline void cbfs_file_metadata(struct region_device *metadata,
const struct cbfsf *file)
{
- rdev_chain(metadata, &file->metadata, 0,
- region_device_sz(&file->metadata));
+ rdev_chain_full(metadata, &file->metadata);
}
/*
diff --git a/src/commonlib/include/commonlib/region.h b/src/commonlib/include/commonlib/region.h
index dca12dc741..f27a494d39 100644
--- a/src/commonlib/include/commonlib/region.h
+++ b/src/commonlib/include/commonlib/region.h
@@ -73,7 +73,6 @@ ssize_t rdev_eraseat(const struct region_device *rd, size_t offset,
int rdev_chain(struct region_device *child, const struct region_device *parent,
size_t offset, size_t size);
-
/* A region_device operations. */
struct region_device_ops {
void *(*mmap)(const struct region_device *, size_t, size_t);
@@ -145,6 +144,13 @@ static inline void *rdev_mmap_full(const struct region_device *rd)
return rdev_mmap(rd, 0, region_device_sz(rd));
}
+static inline int rdev_chain_full(struct region_device *child,
+ const struct region_device *parent)
+{
+ /* Chain full size of parent. */
+ return rdev_chain(child, parent, 0, region_device_sz(parent));
+}
+
/*
* Compute relative offset of the child (c) w.r.t. the parent (p). Returns < 0
* when child is not within the parent's region.