Skip to content

Commit

Permalink
libflash/libffs: Add setter for a partitions actual size
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
cyrilbur-ibm authored and stewartsmith committed Apr 9, 2018
1 parent 2b9ae3a commit 07426f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libflash/libffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions libflash/libffs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07426f4

Please sign in to comment.