[Skiboot] [PATCH 04/15] libflash/libffs: Add setter for a partitions actual size
Cyril Bur
cyril.bur at au1.ibm.com
Thu Mar 15 16:58:16 AEDT 2018
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 9a80a56e..abc61389 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -856,6 +856,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 dfdcbbc0..4c74aed8 100644
--- a/libflash/libffs.h
+++ b/libflash/libffs.h
@@ -149,6 +149,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.16.2
More information about the Skiboot
mailing list