qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH v4 06/45] hw/block: Replace fprintf


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v4 06/45] hw/block: Replace fprintf(stderr, "*\n" with error_report()
Date: Thu, 9 Nov 2017 00:02:25 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 11/08/2017 07:56 PM, Alistair Francis wrote:
> Replace a large number of the fprintf(stderr, "*\n" calls with
> error_report(). The functions were renamed with these commands and then
> compiler issues where manually fixed.
> 
[...]
> diff --git a/hw/block/tc58128.c b/hw/block/tc58128.c
> index 1d9f7ee000..d274c9aafe 100644
> --- a/hw/block/tc58128.c
> +++ b/hw/block/tc58128.c

OMG you found a rare pearl, I enjoyed reading this file git history :)
Not a single logical change since his origin...

http://web.archive.org/web/20070917001736/perso.enst.fr/~polti/realisations/shix20
<3 <3

> @@ -50,8 +50,8 @@ static void init_dev(tc58128_dev * dev, const char 
> *filename)
>           dev->flash_contents[1] = (blocks >> 8) & 0xff;
>           dev->flash_contents[2] = (blocks >> 16) & 0xff;
>           dev->flash_contents[3] = (blocks >> 24) & 0xff;
> -         fprintf(stderr, "loaded %d bytes for %s into flash\n", ret,
> -                 filename);
> +        error_report("loaded %d bytes for %s into flash", ret,
> +                     filename);

This one should be info_report().

>       }
>      }
>  }
> @@ -60,26 +60,26 @@ static void handle_command(tc58128_dev * dev, uint8_t 
> command)
>  {
>      switch (command) {
>      case 0xff:
> -     fprintf(stderr, "reset flash device\n");
> -     dev->state = WAIT;
> -     break;
> +        error_report("reset flash device");

info_report() or even cleaner trace_tc58128_command()?

> +        dev->state = WAIT;
> +        break;
>      case 0x00:
> -     fprintf(stderr, "read mode 1\n");
> -     dev->state = READ1;
> -     dev->address_cycle = 0;
> -     break;
> +        error_report("read mode 1");

Ditto.

> +        dev->state = READ1;
> +        dev->address_cycle = 0;
> +        break;
>      case 0x01:
> -     fprintf(stderr, "read mode 2\n");
> -     dev->state = READ2;
> -     dev->address_cycle = 0;
> -     break;
> +        error_report("read mode 2");

Ditto.

> +        dev->state = READ2;
> +        dev->address_cycle = 0;
> +        break;
>      case 0x50:
> -     fprintf(stderr, "read mode 3\n");
> -     dev->state = READ3;
> -     dev->address_cycle = 0;
> -     break;
> +        error_report("read mode 3");

Ditto.

> +        dev->state = READ3;
> +        dev->address_cycle = 0;
> +        break;
>      default:
> -     fprintf(stderr, "unknown flash command 0x%02x\n", command);
> +        error_report("unknown flash command 0x%02x", command);
>          abort();
>      }
>  }
> @@ -103,8 +103,8 @@ static void handle_address(tc58128_dev * dev, uint8_t 
> data)
>           break;
>       case 2:
>           dev->address += data * 528;
> -         fprintf(stderr, "address pointer in flash: 0x%08x\n",
> -                 dev->address);
> +        error_report("address pointer in flash: 0x%08x",
> +                     dev->address);

warn_report()?

>           break;
>       default:
>           /* Invalid data */
> @@ -119,10 +119,6 @@ static void handle_address(tc58128_dev * dev, uint8_t 
> data)
>  
>  static uint8_t handle_read(tc58128_dev * dev)
>  {
> -#if 0
> -    if (dev->address % 0x100000 == 0)
> -     fprintf(stderr, "reading flash at address 0x%08x\n", dev->address);
> -#endif
>      return dev->flash_contents[dev->address++];
>  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]