diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2015-05-22 15:30:12 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-06-01 17:24:37 +1000 |
commit | 5bc52050148a0399df73f7e8119b234767759700 (patch) | |
tree | b4b6721d0975375efb3ded487332cfad152a97c9 /libflash | |
parent | ce48d7efe84848e5ac49600477d029f5202ce5f2 (diff) | |
download | skiboot-5bc52050148a0399df73f7e8119b234767759700.zip skiboot-5bc52050148a0399df73f7e8119b234767759700.tar.gz skiboot-5bc52050148a0399df73f7e8119b234767759700.tar.bz2 |
libffs: Rename various offset variables to toc_offset
The word offset can be ambiguous, it can be unclear what offset the variable
refers to or what it is the offset of. As this library now has to deal with
flash with more than one libffs TOC, it makes sense to rename all uses of
'offset' to 'toc_offset' which relate to the offset of the TOC within in the
flash.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash')
-rw-r--r-- | libflash/libffs.c | 26 | ||||
-rw-r--r-- | libflash/libffs.h | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/libflash/libffs.c b/libflash/libffs.c index 2d05cc9..1f5cd94 100644 --- a/libflash/libffs.c +++ b/libflash/libffs.c @@ -37,7 +37,7 @@ struct ffs_handle { struct ffs_hdr hdr; /* Converted header */ enum ffs_type type; struct flash_chip *chip; - uint32_t flash_offset; + uint32_t toc_offset; uint32_t max_size; void *cache; uint32_t cached_size; @@ -71,7 +71,7 @@ static int ffs_check_convert_header(struct ffs_hdr *dst, struct ffs_hdr *src) return 0; } -int ffs_open_flash(struct flash_chip *chip, uint32_t offset, +int ffs_open_flash(struct flash_chip *chip, uint32_t toc_offset, uint32_t max_size, struct ffs_handle **ffs) { struct ffs_hdr hdr; @@ -89,13 +89,13 @@ int ffs_open_flash(struct flash_chip *chip, uint32_t offset, FL_ERR("FFS: Error %d retrieving flash info\n", rc); return rc; } - if ((offset + max_size) < offset) + if ((toc_offset + max_size) < toc_offset) return FLASH_ERR_PARM_ERROR; - if ((offset + max_size) > fl_size) + if ((toc_offset + max_size) > fl_size) return FLASH_ERR_PARM_ERROR; /* Read flash header */ - rc = flash_read(chip, offset, &hdr, sizeof(hdr)); + rc = flash_read(chip, toc_offset, &hdr, sizeof(hdr)); if (rc) { FL_ERR("FFS: Error %d reading flash header\n", rc); return rc; @@ -107,8 +107,8 @@ int ffs_open_flash(struct flash_chip *chip, uint32_t offset, return FLASH_ERR_MALLOC_FAILED; memset(f, 0, sizeof(*f)); f->type = ffs_type_flash; - f->flash_offset = offset; - f->max_size = max_size ? max_size : (fl_size - offset); + f->toc_offset = toc_offset; + f->max_size = max_size ? max_size : (fl_size - toc_offset); f->chip = chip; /* Convert and check flash header */ @@ -139,7 +139,7 @@ int ffs_open_flash(struct flash_chip *chip, uint32_t offset, } /* Read the cached map */ - rc = flash_read(chip, offset, f->cache, f->cached_size); + rc = flash_read(chip, toc_offset, f->cache, f->cached_size); if (rc) { FL_ERR("FFS: Error %d reading flash partition map\n", rc); free(f); @@ -152,7 +152,7 @@ int ffs_open_flash(struct flash_chip *chip, uint32_t offset, /* ffs_open_image is Linux only as it uses lseek, which skiboot does not * implement */ #ifndef __SKIBOOT__ -int ffs_open_image(int fd, uint32_t size, uint32_t offset, +int ffs_open_image(int fd, uint32_t size, uint32_t toc_offset, struct ffs_handle **ffsh) { struct ffs_hdr hdr; @@ -166,11 +166,11 @@ int ffs_open_image(int fd, uint32_t size, uint32_t offset, if (fd < 0) return FLASH_ERR_PARM_ERROR; - if ((offset + size) < offset) + if ((toc_offset + size) < toc_offset) return FLASH_ERR_PARM_ERROR; /* Read flash header */ - rc = lseek(fd, offset, SEEK_SET); + rc = lseek(fd, toc_offset, SEEK_SET); if (rc < 0) return FLASH_ERR_PARM_ERROR; @@ -184,7 +184,7 @@ int ffs_open_image(int fd, uint32_t size, uint32_t offset, return FLASH_ERR_MALLOC_FAILED; memset(f, 0, sizeof(*f)); f->type = ffs_type_image; - f->flash_offset = offset; + f->toc_offset = toc_offset; f->max_size = size; f->chip = NULL; @@ -211,7 +211,7 @@ int ffs_open_image(int fd, uint32_t size, uint32_t offset, } /* Read the cached map */ - rc = lseek(fd, offset, SEEK_SET); + rc = lseek(fd, toc_offset, SEEK_SET); if (rc < 0) return FLASH_ERR_PARM_ERROR; diff --git a/libflash/libffs.h b/libflash/libffs.h index dd58d28..faaa4bc 100644 --- a/libflash/libffs.h +++ b/libflash/libffs.h @@ -34,13 +34,13 @@ struct ffs_handle; #define FFS_ERR_PART_NOT_FOUND 103 #define FFS_ERR_BAD_ECC 104 -int ffs_open_flash(struct flash_chip *chip, uint32_t offset, +int ffs_open_flash(struct flash_chip *chip, uint32_t toc_offset, uint32_t max_size, struct ffs_handle **ffs); /* ffs_open_image is Linux only as it uses lseek, which skiboot does not * implement */ #ifndef __SKIBOOT__ -int ffs_open_image(int fd, uint32_t size, uint32_t offset, +int ffs_open_image(int fd, uint32_t size, uint32_t toc_offset, struct ffs_handle **ffs); #endif |