[Skiboot] [RFC PATCH 04/13] libflash/libffs: Add setter for a partitions actual size

Cyril Bur cyril.bur at au1.ibm.com
Tue Aug 29 16:24:57 AEST 2017


Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/libffs.c | 13 +++++++++++++
 libflash/libffs.h |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/libflash/libffs.c b/libflash/libffs.c
index 66b1d3f2..1684388f 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -842,6 +842,19 @@ int ffs_entry_new(const char *name, uint32_t base, uint32_t size, struct ffs_ent
 	return 0;
 }
 
+int ffs_entry_set_act_size(struct ffs_entry *ent, uint32_t actual_size)
+{
+	if (!ent)
+		return -1;
+
+	if (actual_size > ent->size)
+		return FFS_ERR_BAD_PART_SIZE;
+
+	ent->actual = actual_size;
+
+	return 0;
+}
+
 int ffs_hdr_new(uint32_t block_size, uint32_t block_count, struct ffs_hdr **r)
 {
 	struct ffs_hdr *ret;
diff --git a/libflash/libffs.h b/libflash/libffs.h
index 6f8e34e3..2196d526 100644
--- a/libflash/libffs.h
+++ b/libflash/libffs.h
@@ -147,6 +147,8 @@ int ffs_entry_new(const char *name, uint32_t base, uint32_t size, struct ffs_ent
 
 int ffs_entry_user_set(struct ffs_entry *ent, struct ffs_entry_user *user);
 
+int ffs_entry_set_act_size(struct ffs_entry *ent, uint32_t actual_size);
+
 int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry, unsigned int side);
 
 struct ffs_entry_user ffs_entry_user_get(struct ffs_entry *ent);
-- 
2.14.1



More information about the Skiboot mailing list