Re: [Qemu-devel] [PATCH v2 2/4] trace-events: fix code style: %# -> 0x%

2017-07-31 Thread Eric Blake
On 07/29/2017 08:11 AM, Vladimir Sementsov-Ogievskiy wrote:
> In trace format '#' flag of printf is forbidden. Fix it to '0x%'.
> 
> This patch is created by the following:
> 
> check that we have a problem
>> find . -name trace-events | xargs grep '%#' | wc -l
> 56
> 
> check that there are no cases with additional printf flags
>> find . -name trace-events | xargs grep '%[-+ 0]+#' | wc -l
> 0

Missing a check for the ' flag required by POSIX (but not C99); although
we don't use that either.

> 
> check that there are no wrong usage of '#' and '0x' together
>> find . -name trace-events | xargs grep '0x%#' | wc -l
> 0
> 
> fix the problem
>> find . -name trace-events | xargs sed -i 's/%#/0x%/g'
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---

Reviewed-by: Eric Blake 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v2 2/4] trace-events: fix code style: %# -> 0x%

2017-07-31 Thread Stefan Hajnoczi
On Sat, Jul 29, 2017 at 04:11:57PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> In trace format '#' flag of printf is forbidden. Fix it to '0x%'.
> 
> This patch is created by the following:
> 
> check that we have a problem
> > find . -name trace-events | xargs grep '%#' | wc -l
> 56
> 
> check that there are no cases with additional printf flags
> > find . -name trace-events | xargs grep '%[-+ 0]+#' | wc -l
> 0
> 
> check that there are no wrong usage of '#' and '0x' together
> > find . -name trace-events | xargs grep '0x%#' | wc -l
> 0
> 
> fix the problem
> > find . -name trace-events | xargs sed -i 's/%#/0x%/g'
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---
>  audio/trace-events   |  4 ++--
>  block/trace-events   |  6 +++---
>  hw/display/trace-events  |  2 +-
>  hw/i386/xen/trace-events | 22 +++---
>  hw/input/trace-events|  2 +-
>  hw/intc/trace-events | 20 ++--
>  hw/net/trace-events  | 18 +-
>  hw/pci/trace-events  |  4 ++--
>  hw/scsi/trace-events |  6 +++---
>  hw/xen/trace-events  |  8 
>  trace-events | 20 ++--
>  11 files changed, 56 insertions(+), 56 deletions(-)

Reviewed-by: Stefan Hajnoczi 


signature.asc
Description: PGP signature


[Qemu-devel] [PATCH v2 2/4] trace-events: fix code style: %# -> 0x%

2017-07-29 Thread Vladimir Sementsov-Ogievskiy
In trace format '#' flag of printf is forbidden. Fix it to '0x%'.

This patch is created by the following:

check that we have a problem
> find . -name trace-events | xargs grep '%#' | wc -l
56

check that there are no cases with additional printf flags
> find . -name trace-events | xargs grep '%[-+ 0]+#' | wc -l
0

check that there are no wrong usage of '#' and '0x' together
> find . -name trace-events | xargs grep '0x%#' | wc -l
0

fix the problem
> find . -name trace-events | xargs sed -i 's/%#/0x%/g'

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
 audio/trace-events   |  4 ++--
 block/trace-events   |  6 +++---
 hw/display/trace-events  |  2 +-
 hw/i386/xen/trace-events | 22 +++---
 hw/input/trace-events|  2 +-
 hw/intc/trace-events | 20 ++--
 hw/net/trace-events  | 18 +-
 hw/pci/trace-events  |  4 ++--
 hw/scsi/trace-events |  6 +++---
 hw/xen/trace-events  |  8 
 trace-events | 20 ++--
 11 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/audio/trace-events b/audio/trace-events
index 517359039e..939ab99e76 100644
--- a/audio/trace-events
+++ b/audio/trace-events
@@ -3,7 +3,7 @@
 # audio/alsaaudio.c
 alsa_revents(int revents) "revents = %d"
 alsa_pollout(int i, int fd) "i = %d fd = %d"
-alsa_set_handler(int events, int index, int fd, int err) "events=%#x index=%d 
fd=%d err=%d"
+alsa_set_handler(int events, int index, int fd, int err) "events=0x%x index=%d 
fd=%d err=%d"
 alsa_wrote_zero(int len) "Failed to write %d frames (wrote zero)"
 alsa_read_zero(long len) "Failed to read %ld frames (read zero)"
 alsa_xrun_out(void) "Recovering from playback xrun"
@@ -13,5 +13,5 @@ alsa_resume_in(void) "Resuming suspended input stream"
 alsa_no_frames(int state) "No frames available and ALSA state is %d"
 
 # audio/ossaudio.c
-oss_version(int version) "OSS version = %#x"
+oss_version(int version) "OSS version = 0x%x"
 oss_invalid_available_size(int size, int bufsize) "Invalid available size, 
size=%d bufsize=%d"
diff --git a/block/trace-events b/block/trace-events
index 4a4df25323..622c754495 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -1,7 +1,7 @@
 # See docs/tracing.txt for syntax documentation.
 
 # block.c
-bdrv_open_common(void *bs, const char *filename, int flags, const char 
*format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\""
+bdrv_open_common(void *bs, const char *filename, int flags, const char 
*format_name) "bs %p filename \"%s\" flags 0x%x format_name \"%s\""
 bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
 
 # block/block-backend.c
@@ -11,7 +11,7 @@ blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned 
int bytes, int flag
 # block/io.c
 bdrv_co_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num 
%"PRId64" nb_sectors %d"
 bdrv_co_writev(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num 
%"PRId64" nb_sectors %d"
-bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs %p 
offset %"PRId64" count %d flags %#x"
+bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs %p 
offset %"PRId64" count %d flags 0x%x"
 bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes, int64_t 
cluster_offset, unsigned int cluster_bytes) "bs %p offset %"PRId64" bytes %u 
cluster_offset %"PRId64" cluster_bytes %u"
 
 # block/stream.c
@@ -100,7 +100,7 @@ qed_need_check_timer_cb(void *s) "s %p"
 qed_start_need_check_timer(void *s) "s %p"
 qed_cancel_need_check_timer(void *s) "s %p"
 qed_aio_complete(void *s, void *acb, int ret) "s %p acb %p ret %d"
-qed_aio_setup(void *s, void *acb, int64_t sector_num, int nb_sectors, void 
*opaque, int flags) "s %p acb %p sector_num %"PRId64" nb_sectors %d opaque %p 
flags %#x"
+qed_aio_setup(void *s, void *acb, int64_t sector_num, int nb_sectors, void 
*opaque, int flags) "s %p acb %p sector_num %"PRId64" nb_sectors %d opaque %p 
flags 0x%x"
 qed_aio_next_io(void *s, void *acb, int ret, uint64_t cur_pos) "s %p acb %p 
ret %d cur_pos %"PRIu64
 qed_aio_read_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s 
%p acb %p ret %d offset %"PRIu64" len %zu"
 qed_aio_write_data(void *s, void *acb, int ret, uint64_t offset, size_t len) 
"s %p acb %p ret %d offset %"PRIu64" len %zu"
diff --git a/hw/display/trace-events b/hw/display/trace-events
index 3e896d2e3f..16d19122f0 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -5,7 +5,7 @@ jazz_led_read(uint64_t addr, uint8_t val) "read 
addr=0x%"PRIx64": 0x%x"
 jazz_led_write(uint64_t addr, uint8_t new) "write addr=0x%"PRIx64": 0x%x"
 
 # hw/display/xenfb.c
-xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state, int 
abs_pointer_wanted) "%p x %d y %d z %d bs %#x abs %d"
+xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state, int 
abs_pointer_wanted) "%p x %d y %d z %d bs 0x%x abs %d"