libflashrom/fmap: Don't use off_t for flash offsets

off_t is a special POSIX type that is used to represent file offsets in
certain APIs (e.g. lseek(), mmap()), and should not be reused to
represent anything else (such as flash offsets). In particular, the
width of the type may change based on the definition of the
_FILE_OFFSET_BITS macro. Using such a type at the libflashrom interface
is particularly dangerous, because if a program is built with a
different _FILE_OFFSET_BITS value than libflashrom, the resulting ABI
corruption will cause very very nasty and confusing bugs. This patch
replaces all instances of off_t that are not related to file offsets
with (s)size_t.

Tested: `elogtool list` on cherry.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I68a386973f79ea634f63dfcd7d95a63400e1fdee
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/61943
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71445
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/libflashrom.h b/libflashrom.h
index 972e7d1..603dccf 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -68,7 +68,7 @@
 struct flashrom_layout;
 int flashrom_layout_read_from_ifd(struct flashrom_layout **, struct flashrom_flashctx *, const void *dump, size_t len);
 int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **,
-		struct flashrom_flashctx *, off_t offset, size_t length);
+		struct flashrom_flashctx *, size_t offset, size_t length);
 int flashrom_layout_read_fmap_from_buffer(struct flashrom_layout **layout,
 		struct flashrom_flashctx *, const uint8_t *buf, size_t len);
 int flashrom_layout_include_region(struct flashrom_layout *, const char *name);