* [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
@ 2010-09-13 11:18 Michal Novotny
2010-09-13 11:37 ` [Qemu-devel] " Paolo Bonzini
2010-09-13 12:07 ` [Qemu-devel] " Edgar E. Iglesias
0 siblings, 2 replies; 7+ messages in thread
From: Michal Novotny @ 2010-09-13 11:18 UTC (permalink / raw)
To: qemu-devel
Hi,
this is the patch to introduce DPRINTF() macro as used in the rest of the
qemu source files for printing debug messages when the debugging macro is
set (i.e. the debugging is enabled) - e.g. as used in LSI SCSI controller
implementation.
Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
diff --git a/hw/serial.c b/hw/serial.c
index b66d13a..49431b2 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -99,6 +99,14 @@
#define RECV_FIFO 1
#define MAX_XMIT_RETRY 4
+#ifdef DEBUG_SERIAL
+#define DPRINTF(fmt, ...) \
+do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0);
+#else
+#define DPRINTF(fmt, ...) \
+do {} while(0);
+#endif
+
typedef struct SerialFIFO {
uint8_t data[UART_FIFO_LENGTH];
uint8_t count;
@@ -267,10 +275,9 @@ static void serial_update_parameters(SerialState *s)
ssp.stop_bits = stop_bits;
s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size;
qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
-#if 0
- printf("speed=%d parity=%c data=%d stop=%d\n",
+
+ DPRINTF("speed=%d parity=%c data=%d stop=%d\n",
speed, parity, data_bits, stop_bits);
-#endif
}
static void serial_update_msl(SerialState *s)
@@ -360,9 +367,7 @@ static void serial_ioport_write(void *opaque,
uint32_t addr, uint32_t val)
SerialState *s = opaque;
addr &= 7;
-#ifdef DEBUG_SERIAL
- printf("serial: write addr=0x%02x val=0x%02x\n", addr, val);
-#endif
+ DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
switch(addr) {
default:
case 0:
@@ -583,9 +588,7 @@ static uint32_t serial_ioport_read(void *opaque,
uint32_t addr)
ret = s->scr;
break;
}
-#ifdef DEBUG_SERIAL
- printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret);
-#endif
+ DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
return ret;
}
@@ -651,9 +654,7 @@ static void serial_receive1(void *opaque, const
uint8_t *buf, int size)
static void serial_event(void *opaque, int event)
{
SerialState *s = opaque;
-#ifdef DEBUG_SERIAL
- printf("serial: event %x\n", event);
-#endif
+ DPRINTF("event %x\n", event);
if (event == CHR_EVENT_BREAK)
serial_receive_break(s);
}
--
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
2010-09-13 11:18 [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s Michal Novotny
@ 2010-09-13 11:37 ` Paolo Bonzini
2010-09-13 12:07 ` [Qemu-devel] " Edgar E. Iglesias
1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2010-09-13 11:37 UTC (permalink / raw)
To: Michal Novotny; +Cc: qemu-devel
On 09/13/2010 01:18 PM, Michal Novotny wrote:
> Hi,
> this is the patch to introduce DPRINTF() macro as used in the rest of the
> qemu source files for printing debug messages when the debugging macro is
> set (i.e. the debugging is enabled) - e.g. as used in LSI SCSI controller
> implementation.
>
> Signed-off-by: Michal Novotny <minovotn@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
2010-09-13 11:18 [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s Michal Novotny
2010-09-13 11:37 ` [Qemu-devel] " Paolo Bonzini
@ 2010-09-13 12:07 ` Edgar E. Iglesias
2010-09-13 12:37 ` Michal Novotny
1 sibling, 1 reply; 7+ messages in thread
From: Edgar E. Iglesias @ 2010-09-13 12:07 UTC (permalink / raw)
To: Michal Novotny; +Cc: qemu-devel
On Mon, Sep 13, 2010 at 01:18:27PM +0200, Michal Novotny wrote:
> Hi,
> this is the patch to introduce DPRINTF() macro as used in the rest of the
> qemu source files for printing debug messages when the debugging macro is
> set (i.e. the debugging is enabled) - e.g. as used in LSI SCSI controller
> implementation.
Hi,
This patch seems to be corrupt, can you please resubmit with git send-email?
Thanks,
Edgar
>
> Signed-off-by: Michal Novotny <minovotn@redhat.com>
> ---
> diff --git a/hw/serial.c b/hw/serial.c
> index b66d13a..49431b2 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
> @@ -99,6 +99,14 @@
> #define RECV_FIFO 1
> #define MAX_XMIT_RETRY 4
>
> +#ifdef DEBUG_SERIAL
> +#define DPRINTF(fmt, ...) \
> +do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0);
> +#else
> +#define DPRINTF(fmt, ...) \
> +do {} while(0);
> +#endif
> +
> typedef struct SerialFIFO {
> uint8_t data[UART_FIFO_LENGTH];
> uint8_t count;
> @@ -267,10 +275,9 @@ static void serial_update_parameters(SerialState *s)
> ssp.stop_bits = stop_bits;
> s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size;
> qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
> -#if 0
> - printf("speed=%d parity=%c data=%d stop=%d\n",
> +
> + DPRINTF("speed=%d parity=%c data=%d stop=%d\n",
> speed, parity, data_bits, stop_bits);
> -#endif
> }
>
> static void serial_update_msl(SerialState *s)
> @@ -360,9 +367,7 @@ static void serial_ioport_write(void *opaque,
> uint32_t addr, uint32_t val)
> SerialState *s = opaque;
>
> addr &= 7;
> -#ifdef DEBUG_SERIAL
> - printf("serial: write addr=0x%02x val=0x%02x\n", addr, val);
> -#endif
> + DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
> switch(addr) {
> default:
> case 0:
> @@ -583,9 +588,7 @@ static uint32_t serial_ioport_read(void *opaque,
> uint32_t addr)
> ret = s->scr;
> break;
> }
> -#ifdef DEBUG_SERIAL
> - printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret);
> -#endif
> + DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
> return ret;
> }
>
> @@ -651,9 +654,7 @@ static void serial_receive1(void *opaque, const
> uint8_t *buf, int size)
> static void serial_event(void *opaque, int event)
> {
> SerialState *s = opaque;
> -#ifdef DEBUG_SERIAL
> - printf("serial: event %x\n", event);
> -#endif
> + DPRINTF("event %x\n", event);
> if (event == CHR_EVENT_BREAK)
> serial_receive_break(s);
> }
>
> --
> Michal Novotny<minovotn@redhat.com>, RHCE
> Virtualization Team (xen userspace), Red Hat
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
2010-09-13 12:07 ` [Qemu-devel] " Edgar E. Iglesias
@ 2010-09-13 12:37 ` Michal Novotny
2010-09-13 12:37 ` Edgar E. Iglesias
2010-09-13 22:34 ` Andreas Färber
0 siblings, 2 replies; 7+ messages in thread
From: Michal Novotny @ 2010-09-13 12:37 UTC (permalink / raw)
To: Edgar E. Iglesias; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 3578 bytes --]
On 09/13/2010 02:07 PM, Edgar E. Iglesias wrote:
> On Mon, Sep 13, 2010 at 01:18:27PM +0200, Michal Novotny wrote:
>
>> Hi,
>> this is the patch to introduce DPRINTF() macro as used in the rest of the
>> qemu source files for printing debug messages when the debugging macro is
>> set (i.e. the debugging is enabled) - e.g. as used in LSI SCSI controller
>> implementation.
>>
> Hi,
>
> This patch seems to be corrupt, can you please resubmit with git send-email?
>
> Thanks,
> Edgar
>
>
>
Well, I'd love to but I'm having git 1.7.0.1 and it's saying that
send-email it doesn't know send-email [1] so I did append it myself.
Nevertheless when I did copy & paste of this e-mails body to one file
and applied using `cat patchfile | patch -p1` in the current git tree
(pulled from upstream repository before issuing the command) it applied
fine so I don't know what's wrong. The patch file applicable to latest
qemu codebase is attached.
Michal
[1] This is what I'm having:
$ git send-email 0001-dprintf-implementation.patch --to minovotn@redhat.com
git: 'send-email' is not a git command. See 'git --help'.
$
>> Signed-off-by: Michal Novotny<minovotn@redhat.com>
>> ---
>> diff --git a/hw/serial.c b/hw/serial.c
>> index b66d13a..49431b2 100644
>> --- a/hw/serial.c
>> +++ b/hw/serial.c
>> @@ -99,6 +99,14 @@
>> #define RECV_FIFO 1
>> #define MAX_XMIT_RETRY 4
>>
>> +#ifdef DEBUG_SERIAL
>> +#define DPRINTF(fmt, ...) \
>> +do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0);
>> +#else
>> +#define DPRINTF(fmt, ...) \
>> +do {} while(0);
>> +#endif
>> +
>> typedef struct SerialFIFO {
>> uint8_t data[UART_FIFO_LENGTH];
>> uint8_t count;
>> @@ -267,10 +275,9 @@ static void serial_update_parameters(SerialState *s)
>> ssp.stop_bits = stop_bits;
>> s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size;
>> qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS,&ssp);
>> -#if 0
>> - printf("speed=%d parity=%c data=%d stop=%d\n",
>> +
>> + DPRINTF("speed=%d parity=%c data=%d stop=%d\n",
>> speed, parity, data_bits, stop_bits);
>> -#endif
>> }
>>
>> static void serial_update_msl(SerialState *s)
>> @@ -360,9 +367,7 @@ static void serial_ioport_write(void *opaque,
>> uint32_t addr, uint32_t val)
>> SerialState *s = opaque;
>>
>> addr&= 7;
>> -#ifdef DEBUG_SERIAL
>> - printf("serial: write addr=0x%02x val=0x%02x\n", addr, val);
>> -#endif
>> + DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
>> switch(addr) {
>> default:
>> case 0:
>> @@ -583,9 +588,7 @@ static uint32_t serial_ioport_read(void *opaque,
>> uint32_t addr)
>> ret = s->scr;
>> break;
>> }
>> -#ifdef DEBUG_SERIAL
>> - printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret);
>> -#endif
>> + DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
>> return ret;
>> }
>>
>> @@ -651,9 +654,7 @@ static void serial_receive1(void *opaque, const
>> uint8_t *buf, int size)
>> static void serial_event(void *opaque, int event)
>> {
>> SerialState *s = opaque;
>> -#ifdef DEBUG_SERIAL
>> - printf("serial: event %x\n", event);
>> -#endif
>> + DPRINTF("event %x\n", event);
>> if (event == CHR_EVENT_BREAK)
>> serial_receive_break(s);
>> }
>>
>> --
>> Michal Novotny<minovotn@redhat.com>, RHCE
>> Virtualization Team (xen userspace), Red Hat
>>
>>
>>
--
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat
[-- Attachment #2: qemu-convert-serial-to-dprintf.patch --]
[-- Type: text/x-patch, Size: 2080 bytes --]
commit 03615a2319e7ef85fc54661493f33c172883cecf
Author: Michal Novotny <minovotn@redhat.com>
Date: Mon Sep 13 13:36:29 2010 +0200
DPRINTF() impl.
diff --git a/hw/serial.c b/hw/serial.c
index b66d13a..49431b2 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -99,6 +99,14 @@
#define RECV_FIFO 1
#define MAX_XMIT_RETRY 4
+#ifdef DEBUG_SERIAL
+#define DPRINTF(fmt, ...) \
+do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0);
+#else
+#define DPRINTF(fmt, ...) \
+do {} while(0);
+#endif
+
typedef struct SerialFIFO {
uint8_t data[UART_FIFO_LENGTH];
uint8_t count;
@@ -267,10 +275,9 @@ static void serial_update_parameters(SerialState *s)
ssp.stop_bits = stop_bits;
s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size;
qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
-#if 0
- printf("speed=%d parity=%c data=%d stop=%d\n",
+
+ DPRINTF("speed=%d parity=%c data=%d stop=%d\n",
speed, parity, data_bits, stop_bits);
-#endif
}
static void serial_update_msl(SerialState *s)
@@ -360,9 +367,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
SerialState *s = opaque;
addr &= 7;
-#ifdef DEBUG_SERIAL
- printf("serial: write addr=0x%02x val=0x%02x\n", addr, val);
-#endif
+ DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
switch(addr) {
default:
case 0:
@@ -583,9 +588,7 @@ static uint32_t serial_ioport_read(void *opaque, uint32_t addr)
ret = s->scr;
break;
}
-#ifdef DEBUG_SERIAL
- printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret);
-#endif
+ DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
return ret;
}
@@ -651,9 +654,7 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
static void serial_event(void *opaque, int event)
{
SerialState *s = opaque;
-#ifdef DEBUG_SERIAL
- printf("serial: event %x\n", event);
-#endif
+ DPRINTF("event %x\n", event);
if (event == CHR_EVENT_BREAK)
serial_receive_break(s);
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
2010-09-13 12:37 ` Michal Novotny
@ 2010-09-13 12:37 ` Edgar E. Iglesias
2010-09-13 22:34 ` Andreas Färber
1 sibling, 0 replies; 7+ messages in thread
From: Edgar E. Iglesias @ 2010-09-13 12:37 UTC (permalink / raw)
To: Michal Novotny; +Cc: qemu-devel
On Mon, Sep 13, 2010 at 02:37:26PM +0200, Michal Novotny wrote:
> On 09/13/2010 02:07 PM, Edgar E. Iglesias wrote:
> > On Mon, Sep 13, 2010 at 01:18:27PM +0200, Michal Novotny wrote:
> >
> >> Hi,
> >> this is the patch to introduce DPRINTF() macro as used in the rest of the
> >> qemu source files for printing debug messages when the debugging macro is
> >> set (i.e. the debugging is enabled) - e.g. as used in LSI SCSI controller
> >> implementation.
> >>
> > Hi,
> >
> > This patch seems to be corrupt, can you please resubmit with git send-email?
> >
> > Thanks,
> > Edgar
> >
> >
> >
>
> Well, I'd love to but I'm having git 1.7.0.1 and it's saying that
> send-email it doesn't know send-email [1] so I did append it myself.
> Nevertheless when I did copy & paste of this e-mails body to one file
> and applied using `cat patchfile | patch -p1` in the current git tree
> (pulled from upstream repository before issuing the command) it applied
> fine so I don't know what's wrong. The patch file applicable to latest
> qemu codebase is attached.
Thanks, the attached one works. Applied.
Cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
2010-09-13 12:37 ` Michal Novotny
2010-09-13 12:37 ` Edgar E. Iglesias
@ 2010-09-13 22:34 ` Andreas Färber
2010-09-14 8:56 ` Michal Novotny
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2010-09-13 22:34 UTC (permalink / raw)
To: Michal Novotny; +Cc: Edgar E. Iglesias, qemu-devel
Am 13.09.2010 um 14:37 schrieb Michal Novotny:
> I'm having git 1.7.0.1 and it's saying that send-email it doesn't
> know send-email [1]
> [1] This is what I'm having:
> $ git send-email 0001-dprintf-implementation.patch --to minovotn@redhat.com
> git: 'send-email' is not a git command. See 'git --help'.
I believe on Fedora it's in an extra package. Don't have the name at
hand.
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s
2010-09-13 22:34 ` Andreas Färber
@ 2010-09-14 8:56 ` Michal Novotny
0 siblings, 0 replies; 7+ messages in thread
From: Michal Novotny @ 2010-09-14 8:56 UTC (permalink / raw)
To: Andreas Färber; +Cc: Edgar E. Iglesias, qemu-devel
On 09/14/2010 12:34 AM, Andreas Färber wrote:
> Am 13.09.2010 um 14:37 schrieb Michal Novotny:
>
>> I'm having git 1.7.0.1 and it's saying that send-email it doesn't
>> know send-email [1]
>
>> [1] This is what I'm having:
>> $ git send-email 0001-dprintf-implementation.patch --to
>> minovotn@redhat.com
>> git: 'send-email' is not a git command. See 'git --help'.
>
> I believe on Fedora it's in an extra package. Don't have the name at
> hand.
>
> Andreas
Paolo already helped me (thanks a lot!) with this one, it's in the
git-email package for Fedora - it can be useful to send this information
to the list so I'm CCing list now.
Michal
--
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-14 8:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-13 11:18 [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s Michal Novotny
2010-09-13 11:37 ` [Qemu-devel] " Paolo Bonzini
2010-09-13 12:07 ` [Qemu-devel] " Edgar E. Iglesias
2010-09-13 12:37 ` Michal Novotny
2010-09-13 12:37 ` Edgar E. Iglesias
2010-09-13 22:34 ` Andreas Färber
2010-09-14 8:56 ` Michal Novotny
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.