From patchwork Wed Apr 27 18:29:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 66821 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2345677qge; Wed, 27 Apr 2016 11:32:10 -0700 (PDT) X-Received: by 10.28.222.69 with SMTP id v66mr11943741wmg.84.1461781930056; Wed, 27 Apr 2016 11:32:10 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id j80si17756159wmj.57.2016.04.27.11.32.09 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Apr 2016 11:32:10 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3RITWjE002281; Wed, 27 Apr 2016 14:29:32 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3RITTB9004041 for ; Wed, 27 Apr 2016 14:29:29 -0400 Received: from colepc.redhat.com (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3RITRjO002489; Wed, 27 Apr 2016 14:29:28 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 27 Apr 2016 14:29:21 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] qemu: parse: Use virControllerDefNew X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com Rather than reimplement it. This will be needed in upcoming patches --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 2 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_parse_command.c | 8 +++----- 4 files changed, 7 insertions(+), 6 deletions(-) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b46cd2a..04817bd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1637,7 +1637,7 @@ virDomainDiskSetFormat(virDomainDiskDefPtr def, int format) } -static virDomainControllerDefPtr +virDomainControllerDefPtr virDomainControllerDefNew(virDomainControllerType type) { virDomainControllerDefPtr def; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ee66e6d..d98f052 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2558,6 +2558,8 @@ virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def, int bus, char *dst); void virDomainControllerDefFree(virDomainControllerDefPtr def); +virDomainControllerDefPtr +virDomainControllerDefNew(virDomainControllerType type); void virDomainFSDefFree(virDomainFSDefPtr def); void virDomainActualNetDefFree(virDomainActualNetDefPtr def); void virDomainNetDefFree(virDomainNetDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0de35ef..4d09dae 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -186,6 +186,7 @@ virDomainClockOffsetTypeToString; virDomainConfigFile; virDomainControllerAliasFind; virDomainControllerDefFree; +virDomainControllerDefNew; virDomainControllerFind; virDomainControllerFindByType; virDomainControllerInsert; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 79f5b92..455d515 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2351,13 +2351,11 @@ qemuParseCommandLine(virCapsPtr caps, /* ignore, generted on the fly */ } else if (STREQ(arg, "-usb")) { virDomainControllerDefPtr ctldef; - if (VIR_ALLOC(ctldef) < 0) + ctldef = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB); + if (!ctldef) goto error; - ctldef->type = VIR_DOMAIN_CONTROLLER_TYPE_USB; - ctldef->idx = 0; - ctldef->model = -1; if (virDomainControllerInsert(def, ctldef) < 0) { - VIR_FREE(ctldef); + virDomainControllerDefFree(ctldef); goto error; } } else if (STREQ(arg, "-pidfile")) {