From nobody Sun Feb 8 16:31:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547822592681600.7167061914255; Fri, 18 Jan 2019 06:43:12 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB14287645; Fri, 18 Jan 2019 14:43:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B91060851; Fri, 18 Jan 2019 14:43:10 +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 10C793F7D0; Fri, 18 Jan 2019 14:43:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0IEgiZn030447 for ; Fri, 18 Jan 2019 09:42:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 478421048115; Fri, 18 Jan 2019 14:42:44 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.net.com (ovpn-116-100.phx2.redhat.com [10.3.116.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F38331019627 for ; Fri, 18 Jan 2019 14:42:43 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 18 Jan 2019 09:42:34 -0500 Message-Id: <20190118144237.4434-2-jferlan@redhat.com> In-Reply-To: <20190118144237.4434-1-jferlan@redhat.com> References: <20190118144237.4434-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/4] util: Modify virStorageFileGetSCSIKey return 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Jan 2019 14:43:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Alter the "real" code to return -2 on virCommandRun failure. Alter the comments and function header to describe the function and it's returns. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index bd4b0274df..2511511d14 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1425,9 +1425,24 @@ int virStorageFileGetLVMKey(const char *path, } #endif =20 + #ifdef WITH_UDEV -int virStorageFileGetSCSIKey(const char *path, - char **key) +/* virStorageFileGetSCSIKey + * @path: Path to the SCSI device + * @key: Unique key to be returned + * + * Using a udev specific function, query the @path to get and return a + * unique @key for the caller to use. + * + * Returns: + * 0 On success, with the @key filled in or @key=3DNULL if the + * returned string was empty. + * -1 When WITH_UDEV is undefined and a system error is reported + * -2 When WITH_UDEV is defined, but calling virCommandRun fails + */ +int +virStorageFileGetSCSIKey(const char *path, + char **key) { int status; virCommandPtr cmd =3D virCommandNewArgList("/lib/udev/scsi_id", @@ -1436,7 +1451,7 @@ int virStorageFileGetSCSIKey(const char *path, "--device", path, NULL ); - int ret =3D -1; + int ret =3D -2; =20 *key =3D NULL; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list