summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--flash.c4
-rw-r--r--flash.h2
-rw-r--r--mboxd_windows.c10
-rw-r--r--test/Makefile.am.include6
-rw-r--r--test/flash_erase.c12
-rw-r--r--test/flash_write.c (renamed from test/write_flash.c)10
-rw-r--r--vpnor/flash.cpp6
-rw-r--r--vpnor/test/write_patch.cpp4
-rw-r--r--vpnor/test/write_patch_resize.cpp4
-rw-r--r--vpnor/test/write_prsv.cpp2
-rw-r--r--vpnor/test/write_ro.cpp2
-rw-r--r--vpnor/test/write_rw.cpp14
12 files changed, 38 insertions, 38 deletions
diff --git a/flash.c b/flash.c
index 0f0b6b5..6fb9c2c 100644
--- a/flash.c
+++ b/flash.c
@@ -259,7 +259,7 @@ int64_t flash_copy(struct mbox_context *context, uint32_t offset, void *mem,
}
/*
- * write_flash() - Write the flash from a provided buffer
+ * flash_write() - Write the flash 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)
@@ -267,7 +267,7 @@ int64_t flash_copy(struct mbox_context *context, uint32_t offset, void *mem,
*
* 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)
{
uint32_t buf_offset = 0;
diff --git a/flash.h b/flash.h
index bd16038..b86ec7d 100644
--- a/flash.h
+++ b/flash.h
@@ -16,7 +16,7 @@ int64_t flash_copy(struct mbox_context *context, uint32_t offset, void *mem,
int flash_set_bytemap(struct mbox_context *context, uint32_t offset,
uint32_t count, uint8_t val);
int flash_erase(struct mbox_context *context, uint32_t offset, uint32_t count);
-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);
#endif /* FLASH_H */
diff --git a/mboxd_windows.c b/mboxd_windows.c
index e689b47..c7d223e 100644
--- a/mboxd_windows.c
+++ b/mboxd_windows.c
@@ -228,13 +228,13 @@ int write_from_window_v1(struct mbox_context *context,
/* Write back over the erased area */
if (low_mem.mem) {
/* Exceed window at the start */
- rc = write_flash(context, low_mem.flash_offset, low_mem.mem,
+ rc = flash_write(context, low_mem.flash_offset, low_mem.mem,
low_mem.size);
if (rc < 0) {
goto out;
}
}
- rc = write_flash(context, flash_offset,
+ rc = flash_write(context, flash_offset,
context->current->mem + offset_bytes, count_bytes);
if (rc < 0) {
goto out;
@@ -245,14 +245,14 @@ int write_from_window_v1(struct mbox_context *context,
*/
if (high_mem.mem) {
/* Exceed window at the end */
- rc = write_flash(context, high_mem.flash_offset, high_mem.mem,
+ rc = flash_write(context, high_mem.flash_offset, high_mem.mem,
high_mem.size);
if (rc < 0) {
goto out;
}
} else {
/* Write from the current window - it's atleast that big */
- rc = write_flash(context, high_mem.flash_offset,
+ rc = flash_write(context, high_mem.flash_offset,
context->current->mem + offset_bytes +
count_bytes, high_mem.size);
if (rc < 0) {
@@ -311,7 +311,7 @@ int write_from_window(struct mbox_context *context, uint32_t offset,
}
/* Write to the erased flash */
- rc = write_flash(context, flash_offset,
+ rc = flash_write(context, flash_offset,
context->current->mem + offset_bytes,
count_bytes);
if (rc < 0) {
diff --git a/test/Makefile.am.include b/test/Makefile.am.include
index 4520ce7..7f8f6d7 100644
--- a/test/Makefile.am.include
+++ b/test/Makefile.am.include
@@ -12,8 +12,8 @@ test_flash_erase_SOURCES = \
common.c \
%reldir%/tmpf.c
-test_write_flash_SOURCES = \
- %reldir%/write_flash.c \
+test_flash_write_SOURCES = \
+ %reldir%/flash_write.c \
flash.c \
common.c \
%reldir%/tmpf.c
@@ -101,7 +101,7 @@ check_PROGRAMS += \
%reldir%/sanity \
%reldir%/flash_copy \
%reldir%/flash_erase \
- %reldir%/write_flash \
+ %reldir%/flash_write \
%reldir%/get_mbox_info_v2 \
%reldir%/reset_state \
%reldir%/get_flash_info_v2 \
diff --git a/test/flash_erase.c b/test/flash_erase.c
index 9dfdb05..acbf378 100644
--- a/test/flash_erase.c
+++ b/test/flash_erase.c
@@ -132,7 +132,7 @@ int main(void)
memset(data, 0xaa, sizeof(data));
/* Erase written flash */
- rc = write_flash(&context, 0, data, sizeof(data));
+ rc = flash_write(&context, 0, data, sizeof(data));
assert(rc == 0);
rc = flash_erase(&context, 0, sizeof(data));
@@ -146,7 +146,7 @@ int main(void)
n_ioctls = 0;
/* Erase the start of flash */
- rc = write_flash(&context, 0, data, sizeof(data) - 1);
+ rc = flash_write(&context, 0, data, sizeof(data) - 1);
assert(rc == 0);
rc = flash_erase(&context, 0, sizeof(data));
@@ -160,7 +160,7 @@ int main(void)
n_ioctls = 0;
/* Erase the end of flash */
- rc = write_flash(&context, 1, data, sizeof(data) - 1);
+ rc = flash_write(&context, 1, data, sizeof(data) - 1);
assert(rc == 0);
rc = flash_erase(&context, 0, sizeof(data));
@@ -174,8 +174,8 @@ int main(void)
n_ioctls = 0;
/* Erase each end of flash */
- rc = write_flash(&context, 0, data, 1);
- rc = write_flash(&context, 2, data, 1);
+ rc = flash_write(&context, 0, data, 1);
+ rc = flash_write(&context, 2, data, 1);
assert(rc == 0);
rc = flash_erase(&context, 0, sizeof(data));
@@ -191,7 +191,7 @@ int main(void)
n_ioctls = 0;
/* Erase the middle of flash */
- rc = write_flash(&context, 1, data, 1);
+ rc = flash_write(&context, 1, data, 1);
assert(rc == 0);
rc = flash_erase(&context, 0, sizeof(data));
diff --git a/test/write_flash.c b/test/flash_write.c
index f0c107c..cec6c92 100644
--- a/test/write_flash.c
+++ b/test/flash_write.c
@@ -70,31 +70,31 @@ int main(void)
assert(map != MAP_FAILED);
memset(src, 0xaa, sizeof(src));
- rc = write_flash(context, 0, src, sizeof(src));
+ rc = flash_write(context, 0, src, sizeof(src));
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
memset(src, 0x55, sizeof(src));
- rc = write_flash(context, 0, src, sizeof(src));
+ rc = flash_write(context, 0, src, sizeof(src));
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
src[0] = 0xff;
- rc = write_flash(context, 0, src, 1);
+ rc = flash_write(context, 0, src, 1);
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
src[1] = 0xff;
- rc = write_flash(context, 1, &src[1], 1);
+ rc = flash_write(context, 1, &src[1], 1);
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
src[2] = 0xff;
- rc = write_flash(context, 2, &src[2], 1);
+ rc = flash_write(context, 2, &src[2], 1);
assert(rc == 0);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
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 @@ int64_t flash_copy(struct mbox_context* context, uint32_t offset, void* mem,
* 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 @@ int64_t flash_copy(struct mbox_context* context, uint32_t offset, void* mem,
}
/*
- * 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 @@ int64_t flash_copy(struct mbox_context* context, uint32_t offset, void* mem,
* 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 @@ int main(void)
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 @@ int main(void)
/* 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 @@ int main(void)
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 @@ int main(void)
/* 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 @@ int main(void)
/* 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 @@ int main(void)
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 @@ int main(void)
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 @@ int main(void)
/* 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 */
OpenPOWER on IntegriCloud