[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v4 05/25] replay: internal functions for rep
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [RFC PATCH v4 05/25] replay: internal functions for replay log |
Date: |
Fri, 07 Nov 2014 16:01:19 +0000 |
Pavel Dovgalyuk <address@hidden> writes:
> This patch adds functions to perform read and write operations
> with replay log.
>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
<snip>
> +
> +/* File for replay writing */
> +FILE *replay_file;
> +
> +void replay_put_byte(unsigned char byte)
> +{
> + if (replay_file) {
> + fwrite(&byte, sizeof(byte), 1, replay_file);
> + }
> +}
> +
> +void replay_put_event(unsigned char event)
> +{
> + replay_put_byte(event);
> +}
> +
> +
<snip>
> +void replay_put_dword(unsigned int dword)
> +{
> + if (replay_file) {
> + fwrite(&dword, sizeof(dword), 1, replay_file);
> + }
> +}
Given you use the unambiguous types bellow shouldn't you use uint8_t and
uint32_t here to be safe?
<snip>
> +
> +unsigned char replay_get_byte(void)
> +{
> + unsigned char byte;
> + if (replay_file) {
> + fread(&byte, sizeof(byte), 1, replay_file);
> + }
> + return byte;
> +}
> +
> +uint16_t replay_get_word(void)
> +{
> + uint16_t word;
> + if (replay_file) {
> + fread(&word, sizeof(word), 1, replay_file);
> + }
> +
> + return word;
> +}
> +
> +unsigned int replay_get_dword(void)
> +{
> + unsigned int dword;
> + if (replay_file) {
> + fread(&dword, sizeof(dword), 1, replay_file);
> + }
> +
> + return dword;
> +}
Ditto for the fetchers
<snip>
--
Alex Bennée
- [Qemu-devel] [RFC PATCH v4 00/25] Deterministic replay and reverse execution, Pavel Dovgalyuk, 2014/11/07
- [Qemu-devel] [RFC PATCH v4 01/25] acpi: accurate overflow check, Pavel Dovgalyuk, 2014/11/07
- [Qemu-devel] [RFC PATCH v4 02/25] mc146818rtc: add missed field to vmstate, Pavel Dovgalyuk, 2014/11/07
- [Qemu-devel] [RFC PATCH v4 03/25] replay: global variables and function stubs, Pavel Dovgalyuk, 2014/11/07
- [Qemu-devel] [RFC PATCH v4 04/25] sysemu: system functions for replay, Pavel Dovgalyuk, 2014/11/07
- [Qemu-devel] [RFC PATCH v4 05/25] replay: internal functions for replay log, Pavel Dovgalyuk, 2014/11/07
- Re: [Qemu-devel] [RFC PATCH v4 05/25] replay: internal functions for replay log,
Alex Bennée <=
- [Qemu-devel] [RFC PATCH v4 06/25] cpu-exec: reset exception_index correctly, Pavel Dovgalyuk, 2014/11/07
- [Qemu-devel] [RFC PATCH v4 07/25] icount: implement icount requesting, Pavel Dovgalyuk, 2014/11/07
[Qemu-devel] [RFC PATCH v4 08/25] icount: improve enable/disable ticks, Pavel Dovgalyuk, 2014/11/07