On Tue, Aug 02, 2016 at 05:18:32PM +0800, Fam Zheng wrote: > A number of different places across the code base use CONFIG_UUID. Some > of them are soft dependency, some are not built if libuuid is not > available, some come with dummy fallback, some throws runtime error. > > It is hard to maintain, and hard to reason for users. > > Since UUID is a simple standard with only a small number of operations, > it is cleaner to have a central support in libqemuutil. This patch adds > qemu_uuid_* the functions so that all uuid users in the code base can > rely on. Except for qemu_uuid_generate which is new code, all other > functions are just copy from existing fallbacks from other files. > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > arch_init.c | 19 --------------- > block/iscsi.c | 2 +- > hw/smbios/smbios.c | 1 + > include/qemu/uuid.h | 37 +++++++++++++++++++++++++++++ > include/sysemu/sysemu.h | 4 ---- > qmp.c | 1 + > stubs/uuid.c | 2 +- > util/Makefile.objs | 1 + > util/uuid.c | 63 > +++++++++++++++++++++++++++++++++++++++++++++++++ > vl.c | 1 + > 10 files changed, 106 insertions(+), 25 deletions(-) > create mode 100644 include/qemu/uuid.h > create mode 100644 util/uuid.c
It would be nice to see you add a tests/test-uuid.c unit test to exercise all the new utility APIs you're adding & check their corner cases. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|