于 2010年12月24日 00:57, Eric Blake 写道:
On 12/23/2010 06:53 AM, Osier Yang wrote:
> Add VM name/UUID in log for domain related APIs.
> Format: "param0=%p, param1=%p, (VM: %s)"
>
> * src/libvirt.c
> ---
> src/libvirt.c | 294 +++++++++++++++++++++++++++++++++++++++++++--------------
> 1 files changed, 221 insertions(+), 73 deletions(-)
>
> diff --git a/src/libvirt.c b/src/libvirt.c
> index ee2495a..03dcafc 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -1961,7 +1961,9 @@ error:
> virConnectPtr
> virDomainGetConnect (virDomainPtr dom)
> {
> - DEBUG("dom=%p", dom);
> + const char *name = virDomainGetName(dom);
> +
> + DEBUG("dom=%p, (VM: %s)", dom, name);
virDomainGetName() can return NULL, so you'd need to use NULLSTR(name)
everywhere. That alone requires a v2, but I'd wait for feedback from
danpb or DV as to whether this makes sense.
Thanks, sent v2 patch with NULLSTR(name), wait for your feedback there.
Regards
Osier