flash: Rename write_flash to flash_write
Change-Id: I4b41aac597299c93369d8998b03a7d3e2a128742
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/vpnor/flash.cpp b/vpnor/flash.cpp
index 3b928d4..3756141 100644
--- a/vpnor/flash.cpp
+++ b/vpnor/flash.cpp
@@ -158,7 +158,7 @@
* Hooo boy. Pretend that this is valid flash so we don't have
* discontiguous regions presented to the host. Instead, fill a window
* with 0xff so the 'flash' looks erased. Writes to such regions are
- * dropped on the floor, see the implementation of write_flash() below.
+ * dropped on the floor, see the implementation of flash_write() below.
*/
MSG_INFO("Host requested unmapped region of %" PRId32
" bytes at offset 0x%" PRIx32 "\n",
@@ -177,7 +177,7 @@
}
/*
- * write_flash() - Write to the virtual pnor from a provided buffer
+ * flash_write() - Write to the virtual pnor from a provided buffer
* @context: The mbox context pointer
* @offset: The flash offset to write to (bytes)
* @buf: The buffer to write from (must be of atleast size)
@@ -186,7 +186,7 @@
* Return: 0 on success otherwise negative error code
*/
-int write_flash(struct mbox_context* context, uint32_t offset, void* buf,
+int flash_write(struct mbox_context* context, uint32_t offset, void* buf,
uint32_t count)
{
diff --git a/vpnor/test/write_patch.cpp b/vpnor/test/write_patch.cpp
index a146bcf..5d93fc9 100644
--- a/vpnor/test/write_patch.cpp
+++ b/vpnor/test/write_patch.cpp
@@ -47,7 +47,7 @@
test::VpnorRoot root(ctx, toc, BLOCK_SIZE);
root.write("TEST1", data, sizeof(data));
- /* write_flash doesn't copy the file for us */
+ /* flash_write doesn't copy the file for us */
assert(fs::copy_file(root.ro() / "TEST1", root.rw() / "TEST1"));
fs::path patch = root.patch() / "TEST1";
assert(fs::copy_file(root.ro() / "TEST1", patch));
@@ -56,7 +56,7 @@
/* Test */
memset(src, 0x33, sizeof(src));
- rc = write_flash(ctx, 0x1000, src, sizeof(src));
+ rc = flash_write(ctx, 0x1000, src, sizeof(src));
assert(rc == 0);
/* Check that RW file is unmodified after the patch write */
diff --git a/vpnor/test/write_patch_resize.cpp b/vpnor/test/write_patch_resize.cpp
index ff2558b..b55727b 100644
--- a/vpnor/test/write_patch_resize.cpp
+++ b/vpnor/test/write_patch_resize.cpp
@@ -48,7 +48,7 @@
test::VpnorRoot root(ctx, toc, BLOCK_SIZE);
std::vector<uint8_t> roContent(PART_SIZE, 0xff);
root.write("TEST1", roContent.data(), roContent.size());
- /* write_flash doesn't copy the file for us */
+ /* flash_write doesn't copy the file for us */
std::vector<uint8_t> patchContent(PATCH_SIZE, 0xaa);
root.patch("TEST1", patchContent.data(), patchContent.size());
@@ -56,7 +56,7 @@
/* Test */
std::vector<uint8_t> update(UPDATE_SIZE, 0x55);
- rc = write_flash(ctx, 0x1000, update.data(), update.size());
+ rc = flash_write(ctx, 0x1000, update.data(), update.size());
assert(rc == 0);
/* Check that PATCH is modified with the new data */
diff --git a/vpnor/test/write_prsv.cpp b/vpnor/test/write_prsv.cpp
index b89b954..c358ae1 100644
--- a/vpnor/test/write_prsv.cpp
+++ b/vpnor/test/write_prsv.cpp
@@ -45,7 +45,7 @@
/* Test */
memset(src, 0xaa, sizeof(src));
- rc = write_flash(ctx, 0x1000, src, sizeof(src));
+ rc = flash_write(ctx, 0x1000, src, sizeof(src));
assert(rc == 0);
/* Verify */
diff --git a/vpnor/test/write_ro.cpp b/vpnor/test/write_ro.cpp
index 24a534a..95e953c 100644
--- a/vpnor/test/write_ro.cpp
+++ b/vpnor/test/write_ro.cpp
@@ -42,7 +42,7 @@
init_vpnor_from_paths(ctx);
/* Test */
- rc = write_flash(ctx, 0x1000, src, sizeof(src));
+ rc = flash_write(ctx, 0x1000, src, sizeof(src));
/* Verify we can't write to RO partitions */
assert(rc != 0);
diff --git a/vpnor/test/write_rw.cpp b/vpnor/test/write_rw.cpp
index 76b1525..88ef97f 100644
--- a/vpnor/test/write_rw.cpp
+++ b/vpnor/test/write_rw.cpp
@@ -40,13 +40,13 @@
verbosity = (verbose)2;
test::VpnorRoot root(ctx, toc, BLOCK_SIZE);
- /* write_flash() doesn't copy the file for us */
+ /* flash_write() doesn't copy the file for us */
assert(fs::copy_file(root.ro() / "TEST1", root.rw() / "TEST1"));
init_vpnor_from_paths(ctx);
/* Test */
memset(src, 0xbb, sizeof(src));
- rc = write_flash(ctx, 0x1000, src, sizeof(src));
+ rc = flash_write(ctx, 0x1000, src, sizeof(src));
assert(rc == 0);
fd = open((root.rw() / "TEST1").c_str(), O_RDONLY);
map = mmap(NULL, sizeof(src), PROT_READ, MAP_SHARED, fd, 0);
@@ -56,31 +56,31 @@
/* Ensure single byte writes function */
memset(src, 0xcc, sizeof(src));
- rc = write_flash(ctx, 0x1000, src, sizeof(src));
+ rc = flash_write(ctx, 0x1000, src, sizeof(src));
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
src[0] = 0xff;
- rc = write_flash(ctx, 0x1000, src, 1);
+ rc = flash_write(ctx, 0x1000, src, 1);
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
src[1] = 0xff;
- rc = write_flash(ctx, 0x1000 + 1, &src[1], 1);
+ rc = flash_write(ctx, 0x1000 + 1, &src[1], 1);
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
src[2] = 0xff;
- rc = write_flash(ctx, 0x1000 + 2, &src[2], 1);
+ rc = flash_write(ctx, 0x1000 + 2, &src[2], 1);
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
/* Writes past the end of the partition should fail */
- rc = write_flash(ctx, 0x1000 + 0xff9, src, sizeof(src));
+ rc = flash_write(ctx, 0x1000 + 0xff9, src, sizeof(src));
assert(rc < 0);
/* Check that RW file is unmodified after the bad write */