Re: [Qemu-devel] [PATCH] util: move declarations out of qemu-common.h

2016-03-23 Thread Eric Blake
On 03/23/2016 06:17 PM, Eric Blake wrote:
> On 03/20/2016 08:43 AM, Veronia wrote:

>>
>> Signed-off-by: Veronia Bahaa
> 
> Space before <.  'git commit -s' (or 'git commit --amend -s' on an
> existing commit) will space things correctly if your ~/.gitconfig is
> correct; if you are typing the S-o-b by hand, I recommend figuring out
> how to get git to do it for you.

Oh, and I also suggest you fix your 'git send-email' settings to use the
same name as your S-o-b line (that is, you want the From: to say Veronia
Bahaa, to match the same spelling you used later on).

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH] util: move declarations out of qemu-common.h

2016-03-23 Thread Eric Blake
On 03/20/2016 08:43 AM, Veronia wrote:
> move declarations out of qemu-common.h for functions declared in
> utils/ files: e.g. include/qemu/path.h for utils/path.c.
> move inline functions out of qemu-common.h and into new files (e.g.
> include/qemu/bcd.h)
> 
> Signed-off-by: Veronia Bahaa

Space before <.  'git commit -s' (or 'git commit --amend -s' on an
existing commit) will space things correctly if your ~/.gitconfig is
correct; if you are typing the S-o-b by hand, I recommend figuring out
how to get git to do it for you.

> ---

>  161 files changed, 439 insertions(+), 320 deletions(-)
>  create mode 100644 include/qemu/bcd.h
>  create mode 100644 include/qemu/cutils.h
>  create mode 100644 include/qemu/help_option.h
>  create mode 100644 include/qemu/id.h
>  create mode 100644 include/qemu/path.h
>  create mode 100644 include/qemu/unicode.h

This is a big patch.  To make review easier, I highly suggest that you
repost this as a series of (at least) 6 patches, one per file (if any
one include file is huge, it might help to further break it down into
2-3 related functions per patch rather than all functions belonging to
the file).

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH] util: move declarations out of qemu-common.h

2016-03-21 Thread Paolo Bonzini
There are only two issues with the patch, which I fixed before queuing
it for my next pull request.


On 20/03/2016 18:16, veroniaba...@gmail.com wrote:
> -/* path.c */
> -void init_paths(const char *prefix);
> -const char *path(const char *pathname);

The first is that only the above two lines were really for path.c, so I
have removed everything else from path.h.  Likewise, unicode.c only has
mod_utf8_codepoint.

> -/* unicode.c */
> -int mod_utf8_codepoint(const char *s, size_t n, char **end);
> -
> -/*
> - * Hexdump a buffer to a file. An optional string prefix is added to every 
> line
> - */
> -
> -void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t 
> size);
> -
>  /* vector definitions */
>  #ifdef __ALTIVEC__
>  #include 
> diff --git a/include/qemu/bcd.h b/include/qemu/bcd.h
> new file mode 100644
> index 000..7e720c4
> --- /dev/null
> +++ b/include/qemu/bcd.h
> @@ -0,0 +1,10 @@
> +/* Convert a byte between binary and BCD.  */
> +static inline uint8_t to_bcd(uint8_t val)
> +{
> +return ((val / 10) << 4) | (val % 10);
> +}
> +
> +static inline uint8_t from_bcd(uint8_t val)
> +{
> +return ((val >> 4) * 10) + (val & 0x0f);
> +}

The second is that you need multiple-inclusion guards here, like

#ifndef QEMU_BCD_H
#define QEMU_BCD_H 1

/* Convert a byte between binary and BCD.  */
static inline uint8_t to_bcd(uint8_t val)
{
return ((val / 10) << 4) | (val % 10);
}

static inline uint8_t from_bcd(uint8_t val)
{
return ((val >> 4) * 10) + (val & 0x0f);
}

#endif

That said, great job, considering that even just creating qemu/bcd.h
would have been enough.  Instead, you went ahead and touched 140 files.
 Thanks!

Paolo



[Qemu-devel] [PATCH] util: move declarations out of qemu-common.h

2016-03-20 Thread veroniabahaa
From: Veronia 

Move declarations out of qemu-common.h for functions declared in
utils/ files: e.g. include/qemu/path.h for utils/path.c.
Move inline functions out of qemu-common.h and into new files (e.g.
include/qemu/bcd.h)

Signed-off-by: Veronia Bahaa
---
 arch_init.c   |1 +
 audio/audio.c |2 +
 block.c   |3 +-
 block/archipelago.c   |2 +-
 block/blkdebug.c  |2 +-
 block/blkverify.c |1 +
 block/block-backend.c |1 +
 block/curl.c  |1 +
 block/nbd.c   |2 +-
 block/qapi.c  |1 +
 block/qcow2-snapshot.c|2 +-
 block/qcow2.c |2 +-
 block/qed.h   |1 +
 block/raw-posix.c |2 +-
 block/raw-win32.c |2 +-
 block/rbd.c   |3 +-
 block/sheepdog.c  |2 +-
 block/vdi.c   |2 +-
 block/vmdk.c  |2 +-
 block/vvfat.c |3 +-
 blockdev.c|2 +
 bsd-user/elfload.c|1 +
 bsd-user/main.c   |3 +-
 contrib/ivshmem-server/main.c |2 +-
 disas/i386.c  |2 +
 dump.c|3 +-
 exec.c|2 +-
 gdbstub.c |3 +-
 hmp.c |1 +
 hw/9pfs/9p-proxy.c|1 +
 hw/9pfs/9p-synth.c|1 +
 hw/alpha/dp264.c  |1 +
 hw/arm/nseries.c  |2 +-
 hw/arm/omap1.c|2 +
 hw/arm/pxa2xx.c   |1 +
 hw/arm/strongarm.c|1 +
 hw/block/nvme.h   |1 +
 hw/bt/hci.c   |1 +
 hw/core/loader.c  |1 +
 hw/core/machine.c |1 +
 hw/core/qdev-properties.c |1 +
 hw/core/qdev.c|1 +
 hw/cris/boot.c|1 +
 hw/dma/pl330.c|1 +
 hw/ide/core.c |1 +
 hw/lm32/lm32_hwsetup.h|1 +
 hw/lm32/milkymist.c   |1 +
 hw/microblaze/boot.c  |1 +
 hw/mips/mips_jazz.c   |1 +
 hw/misc/ivshmem.c |1 +
 hw/misc/macio/cuda.c  |1 +
 hw/net/fsl_etsec/etsec.c  |1 +
 hw/net/fsl_etsec/rings.c  |1 +
 hw/nvram/fw_cfg.c |1 +
 hw/nvram/mac_nvram.c  |1 +
 hw/pci/pci.c  |1 +
 hw/ppc/mac_newworld.c |1 +
 hw/ppc/mac_oldworld.c |1 +
 hw/ppc/prep.c |1 +
 hw/ppc/spapr.c|2 +-
 hw/ppc/spapr_drc.c|1 +
 hw/ppc/spapr_events.c |3 +-
 hw/ppc/spapr_rtas.c   |1 +
 hw/ppc/spapr_rtc.c|1 +
 hw/scsi/scsi-bus.c|1 +
 hw/scsi/scsi-disk.c   |2 +-
 hw/scsi/vhost-scsi.c  |1 +
 hw/sparc/sun4m.c  |1 +
 hw/sparc64/sun4u.c|1 +
 hw/timer/ds1338.c |1 +
 hw/timer/exynos4210_rtc.c |1 +
 hw/timer/m48t59.c |1 +
 hw/timer/mc146818rtc.c|2 +
 hw/timer/pl031.c  |1 +
 hw/timer/twl92230.c   |1 +
 hw/usb/bus.c  |1 +
 hw/usb/dev-network.c  |1 +
 hw/usb/dev-serial.c   |1 +
 hw/usb/dev-storage.c  |1 +
 hw/usb/redirect.c |1 +
 hw/watchdog/watchdog.c|2 +-
 hw/xen/xen-host-pci-device.c  |1 +
 include/qemu-common.h |  265 -
 include/qemu/bcd.h|   10 ++
 include/qemu/cutils.h |  167 ++
 include/qemu/help_option.h|   17 +++
 include/qemu/id.h |8 ++
 include/qemu/path.h   |   47 
 include/qemu/unicode.h|5 +
 io/channel-socket.c   |1 +
 io/channel-util.c |2 +-
 linux-user/elfload.c  |1 +
 linux-user/main.c |4 +-
 linux-user/syscall.c  |2 +
 linux-user/uaccess.c  |1 +
 main-loop.c   |2 +-
 migration/migration.c |2 +-
 migration/qemu-file-unix.c|2 +-
 migration/savevm.c|3 +-
 monitor.c |2 +
 net/net.c |3 +-
 net/netmap.c  |1 +
 net/slirp.c   |1 +
 net/socket.c  |2 +-
 net/tap-bsd.c |2 +-
 net/tap-linux.c   |2 +-
 net/tap-solaris.c |1 +
 net/tap.c |1 +
 os-posix.c|1 +
 qapi/opts-visitor.c   |2 +-
 qdev-monitor.c|1 +
 qemu-char.c   |3 +-
 qemu-img.c|2 +-
 qemu-io-cmds.c|1 +
 qemu-nbd.c

[Qemu-devel] [PATCH] util: move declarations out of qemu-common.h

2016-03-20 Thread Veronia
move declarations out of qemu-common.h for functions declared in
utils/ files: e.g. include/qemu/path.h for utils/path.c.
move inline functions out of qemu-common.h and into new files (e.g.
include/qemu/bcd.h)

Signed-off-by: Veronia Bahaa
---
 arch_init.c   |1 +
 audio/audio.c |2 +
 block.c   |3 +-
 block/archipelago.c   |2 +-
 block/blkdebug.c  |2 +-
 block/blkverify.c |1 +
 block/block-backend.c |1 +
 block/curl.c  |1 +
 block/nbd.c   |2 +-
 block/qapi.c  |1 +
 block/qcow2-snapshot.c|2 +-
 block/qcow2.c |2 +-
 block/qed.h   |1 +
 block/raw-posix.c |2 +-
 block/raw-win32.c |2 +-
 block/rbd.c   |3 +-
 block/sheepdog.c  |2 +-
 block/vdi.c   |2 +-
 block/vmdk.c  |2 +-
 block/vvfat.c |3 +-
 blockdev.c|2 +
 bsd-user/elfload.c|1 +
 bsd-user/main.c   |3 +-
 contrib/ivshmem-server/main.c |2 +-
 disas/i386.c  |2 +
 dump.c|3 +-
 exec.c|2 +-
 gdbstub.c |3 +-
 hmp.c |1 +
 hw/9pfs/9p-proxy.c|1 +
 hw/9pfs/9p-synth.c|1 +
 hw/alpha/dp264.c  |1 +
 hw/arm/nseries.c  |2 +-
 hw/arm/omap1.c|2 +
 hw/arm/pxa2xx.c   |1 +
 hw/arm/strongarm.c|1 +
 hw/block/nvme.h   |1 +
 hw/bt/hci.c   |1 +
 hw/core/loader.c  |1 +
 hw/core/machine.c |1 +
 hw/core/qdev-properties.c |1 +
 hw/core/qdev.c|1 +
 hw/cris/boot.c|1 +
 hw/dma/pl330.c|1 +
 hw/ide/core.c |1 +
 hw/lm32/lm32_hwsetup.h|1 +
 hw/lm32/milkymist.c   |1 +
 hw/microblaze/boot.c  |1 +
 hw/mips/mips_jazz.c   |1 +
 hw/misc/ivshmem.c |1 +
 hw/misc/macio/cuda.c  |1 +
 hw/net/fsl_etsec/etsec.c  |1 +
 hw/net/fsl_etsec/rings.c  |1 +
 hw/nvram/fw_cfg.c |1 +
 hw/nvram/mac_nvram.c  |1 +
 hw/pci/pci.c  |1 +
 hw/ppc/mac_newworld.c |1 +
 hw/ppc/mac_oldworld.c |1 +
 hw/ppc/prep.c |1 +
 hw/ppc/spapr.c|2 +-
 hw/ppc/spapr_drc.c|1 +
 hw/ppc/spapr_events.c |3 +-
 hw/ppc/spapr_rtas.c   |1 +
 hw/ppc/spapr_rtc.c|1 +
 hw/scsi/scsi-bus.c|1 +
 hw/scsi/scsi-disk.c   |2 +-
 hw/scsi/vhost-scsi.c  |1 +
 hw/sparc/sun4m.c  |1 +
 hw/sparc64/sun4u.c|1 +
 hw/timer/ds1338.c |1 +
 hw/timer/exynos4210_rtc.c |1 +
 hw/timer/m48t59.c |1 +
 hw/timer/mc146818rtc.c|2 +
 hw/timer/pl031.c  |1 +
 hw/timer/twl92230.c   |1 +
 hw/usb/bus.c  |1 +
 hw/usb/dev-network.c  |1 +
 hw/usb/dev-serial.c   |1 +
 hw/usb/dev-storage.c  |1 +
 hw/usb/redirect.c |1 +
 hw/watchdog/watchdog.c|2 +-
 hw/xen/xen-host-pci-device.c  |1 +
 include/qemu-common.h |  265 -
 include/qemu/bcd.h|   10 ++
 include/qemu/cutils.h |  167 ++
 include/qemu/help_option.h|   17 +++
 include/qemu/id.h |8 ++
 include/qemu/path.h   |   47 
 include/qemu/unicode.h|5 +
 io/channel-socket.c   |1 +
 io/channel-util.c |2 +-
 linux-user/elfload.c  |1 +
 linux-user/main.c |4 +-
 linux-user/syscall.c  |2 +
 linux-user/uaccess.c  |1 +
 main-loop.c   |2 +-
 migration/migration.c |2 +-
 migration/qemu-file-unix.c|2 +-
 migration/savevm.c|3 +-
 monitor.c |2 +
 net/net.c |3 +-
 net/netmap.c  |1 +
 net/slirp.c   |1 +
 net/socket.c  |2 +-
 net/tap-bsd.c |2 +-
 net/tap-linux.c   |2 +-
 net/tap-solaris.c |1 +
 net/tap.c |1 +
 os-posix.c|1 +
 qapi/opts-visitor.c   |2 +-
 qdev-monitor.c|1 +
 qemu-char.c   |3 +-
 qemu-img.c|2 +-
 qemu-io-cmds.c|1 +
 qemu-nbd.c|3 +-