diff options
-rw-r--r-- | libflash/ffs.h | 2 | ||||
-rw-r--r-- | libflash/libffs.c | 52 | ||||
-rw-r--r-- | libflash/libffs.h | 2 |
3 files changed, 1 insertions, 55 deletions
diff --git a/libflash/ffs.h b/libflash/ffs.h index 8fc5580..dbbaa09 100644 --- a/libflash/ffs.h +++ b/libflash/ffs.h @@ -206,7 +206,6 @@ struct __ffs_hdr { * @size: Size of partition table (in bytes) * @block_size: Size of block on device (in bytes) * @block_count: Number of blocks on device. - * @backup The backup partition * @entries: List of partition entries */ struct ffs_hdr { @@ -216,7 +215,6 @@ struct ffs_hdr { uint32_t block_size; uint32_t block_count; struct ffs_entry *part; - struct ffs_entry *backup; struct list_head entries; }; diff --git a/libflash/libffs.c b/libflash/libffs.c index c32b453..6c30e09 100644 --- a/libflash/libffs.c +++ b/libflash/libffs.c @@ -558,7 +558,7 @@ int ffs_next_side(struct ffs_handle *ffs, struct ffs_handle **new_ffs, return ffs_init(offset, max_size, ffs->bl, new_ffs, mark_ecc); } -static int __ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry) +int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry) { struct ffs_entry *ent; uint32_t smallest_base; @@ -611,50 +611,6 @@ static int __ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry) return 0; } -int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry) -{ - /* - * Refuse to add anything after BACKUP_PART has been added, not - * sure why this is needed anymore - */ - if (hdr->backup) - return FLASH_ERR_PARM_ERROR; - - return __ffs_entry_add(hdr, entry); -} - -/* This should be done last! */ -int ffs_hdr_create_backup(struct ffs_hdr *hdr) -{ - struct ffs_entry *ent; - struct ffs_entry *backup; - uint32_t hdr_size, flash_end; - int rc = 0; - - ent = list_tail(&hdr->entries, struct ffs_entry, list); - if (!ent) { - return FLASH_ERR_PARM_ERROR; - } - - hdr_size = ffs_hdr_raw_size(ffs_num_entries(hdr) + 1); - /* Whole number of blocks BACKUP_PART needs to be */ - hdr_size = ((hdr_size + hdr->block_size) / hdr->block_size) * hdr->block_size; - flash_end = hdr->base + (hdr->block_size * hdr->block_count); - rc = ffs_entry_new("BACKUP_PART", flash_end - hdr_size, hdr_size, &backup); - if (rc) - return rc; - - rc = __ffs_entry_add(hdr, backup); - if (rc) { - free(backup); - return rc; - } - - hdr->backup = backup; - - return rc; -} - int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr) { int num_entries, i, rc = 0; @@ -711,12 +667,6 @@ int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr) if (rc) goto out; - if (hdr->backup) { - fprintf(stderr, "Actually writing backup part @ 0x%08x\n", hdr->backup->base); - blocklevel_erase(bl, hdr->backup->base, hdr->size); - rc = blocklevel_write(bl, hdr->backup->base, real_hdr, - ffs_hdr_raw_size(num_entries)); - } out: free(real_hdr); return rc; diff --git a/libflash/libffs.h b/libflash/libffs.h index 05db033..0cf0522 100644 --- a/libflash/libffs.h +++ b/libflash/libffs.h @@ -156,8 +156,6 @@ struct ffs_entry_user ffs_entry_user_get(struct ffs_entry *ent); int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry); -int ffs_hdr_create_backup(struct ffs_hdr *hdr); - int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr); int ffs_hdr_free(struct ffs_hdr *hdr); |