From nobody Sun Feb 8 09:12:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1689086391; cv=none; d=zohomail.com; s=zohoarc; b=IJeS7OvrhO/RCySFPQ0Hpfgkp7/a2o2RYACVQjeiGSsg7HthEVP6i9KBCC6cVoposcP4lcbGzf886NvwEArq9Wsah6QdLZOXP41G8B1oOYG0Xi2Y0lP5/VI+CwZpkQXYK2HTMREBru9pcEYuxHG/kp1LozyeumWLTGcE3l8qz48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689086391; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=WFAPcT3nopJDiXekhgkffqRzqCnFPvmU+mKRR57rycM=; b=gDTW+kCcqwQ5IRKmN0sfG7hiz8uHC6/eRWjwjNVV5lsDZbMhPgVAJTrMtcIW76SBaidImyu19pXVCi3PEGggAjNNAV/Ij5i/EN/YRrPNj4Qbx6q7Od4RqsM9jzZFx99VQ4Ue4w09CisA42qfknsVNUgi231RSTU6d+zhSO71Fjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1689086391680728.9484237901447; Tue, 11 Jul 2023 07:39:51 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-xROPsYBEPcOfJiwM2EHF-Q-1; Tue, 11 Jul 2023 10:39:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A53283C1394E; Tue, 11 Jul 2023 14:39:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FFCE4087C75; Tue, 11 Jul 2023 12:31:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F0E2519465B6; Tue, 11 Jul 2023 14:39:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0B4CE194658D for ; Tue, 11 Jul 2023 14:39:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DE16F200B406; Tue, 11 Jul 2023 14:39:16 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C8AB200BA8B for ; Tue, 11 Jul 2023 14:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689086390; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WFAPcT3nopJDiXekhgkffqRzqCnFPvmU+mKRR57rycM=; b=hSVt5YX0Xyf3fLR9mQlLyxEafi8NYUYdFhZcxTn8sh3ZQ71dJKs0l+esUL+HK91XXo9bxr fZS13Orial7viUGsDz6JqwCcRYHB5TzMgVZU4S8EshvoHeRdUJsHZoXdsJrkyItscYglEJ BsElEojTGa9WRpzkVMjPmrgNvKLZmpk= X-MC-Unique: xROPsYBEPcOfJiwM2EHF-Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] node_device: Enclose Linux specific code in ifdef __linux__ Date: Tue, 11 Jul 2023 16:39:13 +0200 Message-ID: <9dcb6d10eafdc73122f751c9bb5f366b2bb1b970.1689086353.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689086394073100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Our CI started to enable udev backend on FreeBSD. And while there is udev on FreeBSD some parts of our code are highly Linux specific, e.g. translating SCSI device type to string (from an integer obtained from the sysfs). Obviously, this doesn't work anywhere else. This is the reason why we need to include scsi/scsi.h header file (which actually comes from the Linux kernel source tree but for some reason glibc started to distribute it, followed by musl). Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- src/node_device/node_device_udev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 4c37ec3189..960f3fd942 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -22,7 +22,9 @@ #include #include #include -#include +#ifdef __linux__ +# include +#endif =20 #include "node_device_conf.h" #include "node_device_event.h" @@ -678,6 +680,8 @@ udevGetSCSIType(virNodeDeviceDef *def G_GNUC_UNUSED, =20 *typestring =3D NULL; =20 +#ifdef __linux__ + /* These values are Linux specific. */ switch (type) { case TYPE_DISK: *typestring =3D g_strdup("disk"); @@ -714,6 +718,10 @@ udevGetSCSIType(virNodeDeviceDef *def G_GNUC_UNUSED, foundtype =3D 0; break; } +#else + /* Implement me. */ + foundtype =3D 0; +#endif =20 if (*typestring =3D=3D NULL) { if (foundtype =3D=3D 1) { --=20 2.41.0