From nobody Mon Nov 25 22:30:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1591875933; cv=none; d=zohomail.com; s=zohoarc; b=cCW/c/BqMJLFSlCJ1brc0dO0vo9YfiutFz2Leu0FqyPqPBRFfQMzcoGkfRB0RNG5+J7iIeuxTMnTSzlytUKh2tkiwQaUfv2nSFIpaaTbt2dSxm3PQ6F2SpaN+faHk/JApS4nvF/SXhKVVXNTPkvl5povsG+CuDDIQynUZIh2syA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591875933; 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=u3hAT6q9BJkDKHxtp+jNZGrjCnIm6ZvA0tjAZxF5S84=; b=SRUl01NeDK/zqbdIl8ITmNXKsEGO93qBiAzENIADswtw/JlxAWOsAPG08HnkHnt17hdMLusJ7eiy/djsH6kkVUpCSJncvBZOI598YESXdAyVi+zfdfBg6n/5cVzxKmWUUXfPChsTBB4KFk7f1ajO6tSq4XQzDranrFHWZhX2kzA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1591875933023626.5069646043099; Thu, 11 Jun 2020 04:45:33 -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-254-YlhzOlj8PV-jCgTuWy31bw-1; Thu, 11 Jun 2020 07:45:29 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1584F8018AD; Thu, 11 Jun 2020 11:45:23 +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 9CA57891E2; Thu, 11 Jun 2020 11:45:22 +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 839A0104809; Thu, 11 Jun 2020 11:45:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05BBjH3s013558 for ; Thu, 11 Jun 2020 07:45:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C1419CA0; Thu, 11 Jun 2020 11:45:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 917847F4FE for ; Thu, 11 Jun 2020 11:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591875931; 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=u3hAT6q9BJkDKHxtp+jNZGrjCnIm6ZvA0tjAZxF5S84=; b=QeSNXuSZ9EkybFK7uU4D62fvjkR0+dodbR+XqcwyNtYZPUnqgDWZdvDJ20kRmU6cOX0dbu 1NecOuccbIZU/W1vzOVl2wXmhsaDD90LQhdAR7b0GIuUvKU7C0rH+xH/nm27vkdg5YPoOb F7InucJg7RQyML+NsPC5+ElhuTLJ9Lw= X-MC-Unique: YlhzOlj8PV-jCgTuWy31bw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] util: Move virIsDevMapperDevice() to virdevmapper.c Date: Thu, 11 Jun 2020 13:44:47 +0200 Message-Id: <13f611fdc0f1d1d4bc4505001149babc369d7c53.1591875846.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.79 on 10.5.11.13 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" When introducing virdevmapper.c (in v4.3.0-rc1~427) I didn't realize there is a function that calls in devmapper. The function is called virIsDevMapperDevice() and lives in virutil.c. Now that we have a special file for handling devmapper move it there. Signed-off-by: Michal Privoznik --- src/libvirt_private.syms | 2 +- src/storage/parthelper.c | 2 +- src/storage/storage_backend_disk.c | 1 + src/util/virdevmapper.c | 24 ++++++++++++++++++++++++ src/util/virdevmapper.h | 3 +++ src/util/virutil.c | 24 ------------------------ src/util/virutil.h | 2 -- 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a6af44fe1c..247d7f4741 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1943,6 +1943,7 @@ virDBusSetSharedBus; =20 # util/virdevmapper.h virDevMapperGetTargets; +virIsDevMapperDevice; =20 =20 # util/virdnsmasq.h @@ -3432,7 +3433,6 @@ virGetUserShell; virHostGetDRMRenderNode; virHostHasIOMMU; virIndexToDiskName; -virIsDevMapperDevice; virMemoryLimitIsSet; virMemoryLimitTruncate; virMemoryMaxValue; diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c index 761a7f93fc..812e90d3cb 100644 --- a/src/storage/parthelper.c +++ b/src/storage/parthelper.c @@ -36,10 +36,10 @@ #include #include =20 -#include "virutil.h" #include "virfile.h" #include "virstring.h" #include "virgettext.h" +#include "virdevmapper.h" =20 /* we don't need to include the full internal.h just for this */ #define STREQ(a, b) (strcmp(a, b) =3D=3D 0) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backe= nd_disk.c index 35b07abbfe..eae23ec24a 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -32,6 +32,7 @@ #include "virutil.h" #include "configmake.h" #include "virstring.h" +#include "virdevmapper.h" =20 #define VIR_FROM_THIS VIR_FROM_STORAGE =20 diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c index 79dbc3d02a..600e1f6322 100644 --- a/src/util/virdevmapper.c +++ b/src/util/virdevmapper.c @@ -212,3 +212,27 @@ virDevMapperGetTargets(const char *path G_GNUC_UNUSED, return -1; } #endif /* ! WITH_DEVMAPPER */ + + +#if WITH_DEVMAPPER +bool +virIsDevMapperDevice(const char *dev_name) +{ + struct stat buf; + + if (!stat(dev_name, &buf) && + S_ISBLK(buf.st_mode) && + dm_is_dm_major(major(buf.st_rdev))) + return true; + + return false; +} + +#else /* ! WITH_DEVMAPPER */ + +bool +virIsDevMapperDevice(const char *dev_name G_GNUC_UNUSED) +{ + return false; +} +#endif /* ! WITH_DEVMAPPER */ diff --git a/src/util/virdevmapper.h b/src/util/virdevmapper.h index 87bbc63cfd..834900692e 100644 --- a/src/util/virdevmapper.h +++ b/src/util/virdevmapper.h @@ -25,3 +25,6 @@ int virDevMapperGetTargets(const char *path, char ***devPaths) G_GNUC_NO_INLINE; + +bool +virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1); diff --git a/src/util/virutil.c b/src/util/virutil.c index fb46501142..929afb82d0 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -37,10 +37,6 @@ =20 #include =20 -#if WITH_DEVMAPPER -# include -#endif - #ifdef HAVE_GETPWUID_R # include # include @@ -1340,26 +1336,6 @@ void virWaitForDevices(void) ignore_value(virCommandRun(cmd, &exitstatus)); } =20 -#if WITH_DEVMAPPER -bool -virIsDevMapperDevice(const char *dev_name) -{ - struct stat buf; - - if (!stat(dev_name, &buf) && - S_ISBLK(buf.st_mode) && - dm_is_dm_major(major(buf.st_rdev))) - return true; - - return false; -} -#else -bool virIsDevMapperDevice(const char *dev_name G_GNUC_UNUSED) -{ - return false; -} -#endif - bool virValidateWWN(const char *wwn) { diff --git a/src/util/virutil.h b/src/util/virutil.h index 49b4bf440f..ef01fd9e36 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -114,8 +114,6 @@ bool virDoesUserExist(const char *name); bool virDoesGroupExist(const char *name); =20 =20 -bool virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1); - bool virValidateWWN(const char *wwn); =20 int virGetDeviceID(const char *path, --=20 2.26.2