aboutsummaryrefslogtreecommitdiff
path: root/libflash/libffs.h
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2018-03-15 16:58:23 +1100
committerStewart Smith <stewart@linux.ibm.com>2018-04-09 03:45:23 -0500
commit79316cb6aca6fc79585f4f47c18a37f2eb177780 (patch)
treec228abad78786db2ac503444a56eec0467b089e8 /libflash/libffs.h
parent3d47dbb4fb8dc010c1905a878794731e812a05ac (diff)
downloadskiboot-79316cb6aca6fc79585f4f47c18a37f2eb177780.zip
skiboot-79316cb6aca6fc79585f4f47c18a37f2eb177780.tar.gz
skiboot-79316cb6aca6fc79585f4f47c18a37f2eb177780.tar.bz2
libflash/libffs: Refcount ffs entries
Currently consumers can add an new ffs entry to multiple headers, this is fine but freeing any of the headers will cause the entry to be freed, this causes double free problems. Even if only one header is uses, the consumer of the library still has a reference to the entry, which they may well reuse at some other point. libffs will now refcount entries and only free when there are no more references. This patch also removes the pointless return value of ffs_hdr_free() Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash/libffs.h')
-rw-r--r--libflash/libffs.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libflash/libffs.h b/libflash/libffs.h
index 0cf0522..c56574d 100644
--- a/libflash/libffs.h
+++ b/libflash/libffs.h
@@ -147,6 +147,8 @@ int ffs_hdr_add_side(struct ffs_hdr *hdr);
int ffs_entry_new(const char *name, uint32_t base, uint32_t size, struct ffs_entry **r);
+struct ffs_entry *ffs_entry_put(struct ffs_entry *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);
@@ -158,5 +160,5 @@ int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry);
int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr);
-int ffs_hdr_free(struct ffs_hdr *hdr);
+void ffs_hdr_free(struct ffs_hdr *hdr);
#endif /* __LIBFFS_H */