diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-14 03:55:12 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-14 03:55:12 +0000 |
| commit | 55564d40641825cd117d14ae31ac2145f89f5a7d (patch) | |
| tree | 50f18d71fe4f8c8ff35cbab366ac2ba293da00e6 | |
| parent | eb8a297ba0b189fd93eef19e21e3c275f756c0c9 (diff) | |
util/nvmutil: split up rw_gbe_file_part
the post-verification stage deserves a function
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 0292a4cb..d08b27fc 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -332,6 +332,7 @@ static void check_bin(size_t a, const char *a_name); */ static void rw_gbe_file_part(size_t p, int rw_type, const char *rw_type_str); +static void verify_gbe_bin_write(size_t p); static u8 *gbe_mem_offset(size_t part, const char *f_op); static off_t gbe_file_offset(size_t part, const char *f_op); static off_t gbe_x_offset(size_t part, const char *f_op, @@ -1526,9 +1527,21 @@ rw_gbe_file_part(size_t p, int rw_type, * to ensure that it was done correctly. * NOTE: using "pad" (only cat uses it) */ + if (rw_type == IO_PWRITE) + verify_gbe_bin_write(p); +} + +static void +verify_gbe_bin_write(size_t p) +{ + ssize_t r; + size_t gbe_rw_size = command[cmd_index].rw_size; + u8 *mem_offset; + off_t file_offset; - if (rw_type != IO_PWRITE) - return; /* skip for reads */ + /* invert not needed for pwrite */ + mem_offset = gbe_mem_offset(p, "pwrite"); + file_offset = (off_t)gbe_file_offset(p, "pwrite"); /* * We may otherwise read from |
