From nobody Fri Dec 19 19:19:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766960; cv=none; d=zohomail.com; s=zohoarc; b=m9LJ1RTzyViI5kkyuYjU2u9Wc2FuHAqbhaSrf7HA0qhJDZ+AqkSqAUn2nwywM0IgFn5IWiZbuoYdW4f2X6k88hJsXoSqM3/w9Y2khvFdt8BgYZq3P8BwBFpLzlPtCyKagwdnXMxHiSslZQjx+QxbZfGyokin7rFEr9fg+mqifBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766960; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ihLVKTBdfWbbA9v3Fk3iRHdH9Ij0UEDlawgRitJMWTI=; b=NbOwTwnyF2/SUerOdzFdhdPPS6KUo/voF4W1YKsNpf+sZcbFGi60V8bmrTnJU0Xbo1mTR+k5rDTuWM4Rr86Xhcv/tPXfZwdAxUn/CfDN5RLZ5OUrnBKtnr7ZOCGWvKuQ0LqySHQvAlWVeHaJkLFC7HqWZ7pGBM89FPpHS9aB7mk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588766960462892.8754842645473; Wed, 6 May 2020 05:09:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-3aFDt_erO3umkczruZy7oQ-1; Wed, 06 May 2020 08:09:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 353BE100CCDE; Wed, 6 May 2020 12:09:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0651A1002398; Wed, 6 May 2020 12:09:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9E5571809563; Wed, 6 May 2020 12:09:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8roa029652 for ; Wed, 6 May 2020 08:08:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9939B5C1BD; Wed, 6 May 2020 12:08:53 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C18F5C241 for ; Wed, 6 May 2020 12:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766959; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ihLVKTBdfWbbA9v3Fk3iRHdH9Ij0UEDlawgRitJMWTI=; b=HZfTVjINCjHhjC//azbs8/mMYcV+ikrlhiGA33LqMuj5Gs66xQ29dY29qDZTMoWds+P0Eh 8iDG1+GbjygYXzUfyrZ2VUOZ0brgFFXEsT/TqhOtiUI8Ye32UxGv95X+kLcnZlNbZ+82qM e/wSzRHfQYG8dHDPH2E9eOPfP5rtPKA= X-MC-Unique: 3aFDt_erO3umkczruZy7oQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/20] qemuBuildDriveStr: Refactor formatting of command line for 'sd' cards Date: Wed, 6 May 2020 14:08:24 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Remove all the universal code since the 'else' part formats commandline only for the SD card based disk. Note that we can use virDiskNameToIndex without the check as we already validate that 'disk->dst' contains a properly formatted string in the validation code. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3f3e3b69a8..9836972234 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1449,17 +1449,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, virBufferAddLit(&opt, "if=3Dnone"); virBufferAsprintf(&opt, ",id=3D%s", drivealias); } else { - int idx =3D virDiskNameToIndex(disk->dst); - - if (idx < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type '%s'"), disk->dst); - return NULL; - } - - virBufferAsprintf(&opt, "if=3D%s", - virDomainDiskQEMUBusTypeToString(disk->bus)); - virBufferAsprintf(&opt, ",index=3D%d", idx); + virBufferAsprintf(&opt, "if=3Dsd,index=3D%d", + virDiskNameToIndex(disk->dst)); } /* werror/rerror are really frontend attributes, but older --=20 2.26.2