[Skiboot] [PATCH 1/2] libflash/libffs: Rename ffs_cmp() to ffs_equal()

Cyril Bur cyril.bur at au1.ibm.com
Tue Jan 12 16:15:38 AEDT 2016


Some confusion has arisen from the first consumer of ffs_cmp() in that they
expected a strcmp style less than one, zero or greater than one return value.

This has been addressed in this patch in two ways, by changing the return
type to a boolean in order to (attempt) to alert the programmer that this
is not the case and by renaming it to equal to avoid the implied comparison
and imply very much a boolean outcome.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/libffs.c | 2 +-
 libflash/libffs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libflash/libffs.c b/libflash/libffs.c
index 401b4db..cc534e2 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -282,7 +282,7 @@ int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx,
  * simple, the underlying blocklevel_devices must be the same along with
  * the toc_offset and the max_size.
  */
-int ffs_cmp(struct ffs_handle *one, struct ffs_handle *two)
+bool ffs_equal(struct ffs_handle *one, struct ffs_handle *two)
 {
 	return (!one && !two) || (one && two && one->bl == two->bl
 		&& one->toc_offset == two->toc_offset
diff --git a/libflash/libffs.h b/libflash/libffs.h
index 0d0d5f5..a9ff574 100644
--- a/libflash/libffs.h
+++ b/libflash/libffs.h
@@ -58,7 +58,7 @@ int ffs_next_side(struct ffs_handle *ffs, struct ffs_handle **new_ffs,
  * simple, the underlying blocklevel_devices must be the same along with
  * the toc_offset and the max_size.
  */
-int ffs_cmp(struct ffs_handle *one, struct ffs_handle *two);
+bool ffs_equal(struct ffs_handle *one, struct ffs_handle *two);
 
 void ffs_close(struct ffs_handle *ffs);
 
-- 
2.7.0



More information about the Skiboot mailing list