[libvirt] [PATCH 1/2] qemu: Split out various utility functions to qemu_util.c
Eric Blake
eblake at redhat.com
Thu Jan 3 17:32:42 UTC 2013
On 01/03/2013 09:45 AM, Peter Krempa wrote:
> ---
> po/POTFILES.in | 1 +
> src/Makefile.am | 1 +
> src/qemu/qemu_driver.c | 492 ++-----------------------------------------------
> src/qemu/qemu_util.c | 486 ++++++++++++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_util.h | 111 +++++++++++
> 5 files changed, 611 insertions(+), 480 deletions(-)
> create mode 100644 src/qemu/qemu_util.c
> create mode 100644 src/qemu/qemu_util.h
>
>
> +
> +static inline void
> +bswap_header(virQEMUSaveHeaderPtr hdr) {
It looks weird that you moved this function, but only to later in the
same file rather than into a new file, and also weird that this function
doesn't follow naming conventions. I would leave it untouched in this
patch, and then do a followup patch that inlines the body of this
function into its lone caller (qemuDomainSaveImageOpen); which will get
rid of the bad naming at the same time.
> +++ b/src/qemu/qemu_util.c
> @@ -0,0 +1,486 @@
> +/*
> + * qemu_util.c: Various util functions for the QEMU driver
> + *
> + * Copyright (C) 2013 Red Hat, Inc.
Although this file only exists in 2013, it copies from other files with
earlier copyrights. Please preserve all of the copyrights from
qemu_driver.c (or, for bonus points, take the time to audit which year
each individual function was added and later modified while it lived
within qemu_driver.c). Same to the qemu_util.h file.
> +
> +#include <config.h>
> +
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <unistd.h>
> +#include <byteswap.h>
> +#include <fcntl.h>
> +
> +#include "qemu_util.h"
> +#include "qemu_cgroup.h"
> +#include "qemu_migration.h"
> +
> +#include "internal.h"
> +
> +#include "virerror.h"
> +#include "domain_conf.h"
> +#include "locking/domain_lock.h"
> +#include "datatypes.h"
> +#include "virlog.h"
> +#include "viralloc.h"
> +#include "virfile.h"
Do we need all of these, or can it be trimmed a bit? Should we sort things?
> +++ b/src/qemu/qemu_util.h
> @@ -0,0 +1,111 @@
> +typedef enum {
> + QEMU_SAVE_FORMAT_RAW = 0,
> + QEMU_SAVE_FORMAT_GZIP = 1,
> + QEMU_SAVE_FORMAT_BZIP2 = 2,
> + /*
> + * Deprecated by xz and never used as part of a release
> + * QEMU_SAVE_FORMAT_LZMA
> + */
This comment is safe to drop now. We have version control for a reason.
ACK with those points addressed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130103/97f39b21/attachment-0001.sig>
More information about the libvir-list
mailing list