[PATCH v3 10/10] system/replay: Rename some method parameters

Philippe Mathieu-Daudé posted 10 patches 2 days, 6 hours ago
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alistair Francis <alistair@alistair23.me>, Peter Maydell <peter.maydell@linaro.org>, Palmer Dabbelt <palmer@dabbelt.com>, "Alex Bennée" <alex.bennee@linaro.org>
[PATCH v3 10/10] system/replay: Rename some method parameters
Posted by Philippe Mathieu-Daudé 2 days, 6 hours ago
replay_char_read_all_save_error() saves %errno, so rename as @errcode,
replay_char_write_event_save() saves the number of bytes written, so
rename as @nbytes (same for replay_char_write_event_load).

Use the forward declaration in both replay_register_char_driver() and
replay_chr_be_write() declarations, matching their definitions.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/system/replay.h | 16 ++++++++--------
 replay/replay-char.c    | 14 +++++++-------
 stubs/replay-tools.c    | 10 +++++-----
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/include/system/replay.h b/include/system/replay.h
index 68f91bdfbf2..56d2aebac7f 100644
--- a/include/system/replay.h
+++ b/include/system/replay.h
@@ -136,18 +136,18 @@ uint64_t blkreplay_next_id(void);
 
 /* Character device */
 
-/*! Registers char driver to save it's events */
-void replay_register_char_driver(struct Chardev *chr);
-/*! Saves write to char device event to the log */
-void replay_chr_be_write(struct Chardev *s, const uint8_t *buf, int len);
+/*! Registers @chr char driver to save it's events */
+void replay_register_char_driver(Chardev *chr);
+/*! Saves write to char device @s event to the log */
+void replay_chr_be_write(Chardev *s, const uint8_t *buf, int len);
 /*! Writes char write return value to the replay log. */
-void replay_char_write_event_save(int res, int offset);
+void replay_char_write_event_save(int nbytes, int offset);
 /*! Reads char write return value from the replay log. */
-void replay_char_write_event_load(int *res, int *offset);
+void replay_char_write_event_load(int *nbytes, int *offset);
 /*! Reads information about read_all character event. */
 int replay_char_read_all_load(uint8_t *buf);
-/*! Writes character read_all error code into the replay log. */
-void replay_char_read_all_save_error(int res);
+/*! Writes character read_all error code @errcode into the replay log. */
+void replay_char_read_all_save_error(int errcode);
 /*! Writes character read_all execution result into the replay log. */
 void replay_char_read_all_save_buf(uint8_t *buf, int offset);
 
diff --git a/replay/replay-char.c b/replay/replay-char.c
index 81dc416e988..023159b155f 100644
--- a/replay/replay-char.c
+++ b/replay/replay-char.c
@@ -93,23 +93,23 @@ void *replay_event_char_read_load(void)
     return event;
 }
 
-void replay_char_write_event_save(int res, int offset)
+void replay_char_write_event_save(int nbytes, int offset)
 {
     g_assert(replay_mutex_locked());
 
     replay_save_instructions();
     replay_put_event(EVENT_CHAR_WRITE);
-    replay_put_dword(res);
+    replay_put_dword(nbytes);
     replay_put_dword(offset);
 }
 
-void replay_char_write_event_load(int *res, int *offset)
+void replay_char_write_event_load(int *nbytes, int *offset)
 {
     g_assert(replay_mutex_locked());
 
     replay_account_executed_instructions();
     if (replay_next_event_is(EVENT_CHAR_WRITE)) {
-        *res = replay_get_dword();
+        *nbytes = replay_get_dword();
         *offset = replay_get_dword();
         replay_finish_event();
     } else {
@@ -138,13 +138,13 @@ int replay_char_read_all_load(uint8_t *buf)
     }
 }
 
-void replay_char_read_all_save_error(int res)
+void replay_char_read_all_save_error(int errcode)
 {
     g_assert(replay_mutex_locked());
-    assert(res < 0);
+    assert(errcode < 0);
     replay_save_instructions();
     replay_put_event(EVENT_CHAR_READ_ALL_ERROR);
-    replay_put_dword(res);
+    replay_put_dword(errcode);
 }
 
 void replay_char_read_all_save_buf(uint8_t *buf, int offset)
diff --git a/stubs/replay-tools.c b/stubs/replay-tools.c
index c537485f401..df21475cec5 100644
--- a/stubs/replay-tools.c
+++ b/stubs/replay-tools.c
@@ -49,21 +49,21 @@ void replay_mutex_unlock(void)
 {
 }
 
-void replay_register_char_driver(struct Chardev *chr)
+void replay_register_char_driver(Chardev *chr)
 {
 }
 
-void replay_chr_be_write(struct Chardev *s, const uint8_t *buf, int len)
+void replay_chr_be_write(Chardev *s, const uint8_t *buf, int len)
 {
     abort();
 }
 
-void replay_char_write_event_save(int res, int offset)
+void replay_char_write_event_save(int nbytes, int offset)
 {
     abort();
 }
 
-void replay_char_write_event_load(int *res, int *offset)
+void replay_char_write_event_load(int *nbytes, int *offset)
 {
     abort();
 }
@@ -73,7 +73,7 @@ int replay_char_read_all_load(uint8_t *buf)
     abort();
 }
 
-void replay_char_read_all_save_error(int res)
+void replay_char_read_all_save_error(int errcode)
 {
     abort();
 }
-- 
2.51.0