From nobody Sun May 19 03:12:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1662385032; cv=none; d=zohomail.com; s=zohoarc; b=MQys8ii/dv0SwGOlKL1C4aJcPaTbdhSlT/jSzfsRcB7zKO7LzpehplAoT0PCEqwxebQ+MYOJi3wFmb0DVaXxn4JFe+UH7Exn0RHMo03fX5f3RUbIF2UWG3XMRzoCtHbyH9ZxYRu070W+J2e/hFJo+IdZ6jcbgJTIsLaOk8Whn5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662385032; 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=yD62u0V0jDweZlQK0DFsI0gPnAtdx4/oYMkMpq+XHnM=; b=QD42A9NV4cstqqpRRtgmEjWnpznYfI69qjkeAQObENW9CNVT7Th7gNxEU4Fc2mLZiASlxp2h7T2MnSW5M7WswcUZJM1G6g8VQlHnMiuyuUkJWct3P5iL7vu2GDGkzxQiH0Sa8rpTs8FJHMcRkdO+Y6GVUI33aJZW25ZVst5Y/QY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1662385032423728.8351933427523; Mon, 5 Sep 2022 06:37:12 -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-315-DJPwAjMIPAqk0QU9yxisaA-1; Mon, 05 Sep 2022 09:34:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DEAB33C0F398; Mon, 5 Sep 2022 13:34:26 +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 942709458A; Mon, 5 Sep 2022 13:34:26 +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 5ED2C194035B; Mon, 5 Sep 2022 13:34:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7428F193F515 for ; Mon, 5 Sep 2022 13:34:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6946C40D2830; Mon, 5 Sep 2022 13:34:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F1DE40D282E for ; Mon, 5 Sep 2022 13:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662385031; 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=yD62u0V0jDweZlQK0DFsI0gPnAtdx4/oYMkMpq+XHnM=; b=GbqpUIUR/OEmFQF7i0Bz+oTVRhryhEK6xPSOPxY4xJNUODptyFzACHCFQA8yElVedlXKL9 BnK6msYX+nsXMT72Rz5RvZ0YJieVAMZ4N/gP3lOSINmBa1VqLl4T6dfY9pxBYXGOo8qO34 o+mvUENME7JUXRZ+Rf4nxeQX8wvYqcc= X-MC-Unique: DJPwAjMIPAqk0QU9yxisaA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/7] util: virFileIsSharedFSType: Pass bitmap of checked fs types as unsigned Date: Mon, 5 Sep 2022 15:34:15 +0200 Message-Id: <388cc1e696cca9b32b7e8fa54e8b7256334b849e.1662384799.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.79 on 10.11.54.5 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: 1662385032839100001 Content-Type: text/plain; charset="utf-8" We populate the bits individualy so unsigned is the proper type. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.c | 4 ++-- src/util/virfile.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index ce541b8946..1def05b6c4 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3394,7 +3394,7 @@ virFileIsSharedFixFUSE(const char *path, int virFileIsSharedFSType(const char *path, - int fstypes) + unsigned int fstypes) { g_autofree char *dirpath =3D NULL; char *p =3D NULL; @@ -3601,7 +3601,7 @@ virFileFindHugeTLBFS(virHugeTLBFS **ret_fs, #else /* defined __linux__ */ int virFileIsSharedFSType(const char *path G_GNUC_UNUSED, - int fstypes G_GNUC_UNUSED) + unsigned int fstypes G_GNUC_UNUSED) { /* XXX implement me :-) */ return 0; diff --git a/src/util/virfile.h b/src/util/virfile.h index 4af1ad9136..8d6df034f8 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -224,7 +224,7 @@ enum { VIR_FILE_SHFS_ACFS =3D (1 << 9), }; -int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL= (1); +int virFileIsSharedFSType(const char *path, unsigned int fstypes) ATTRIBUT= E_NONNULL(1); int virFileIsSharedFS(const char *path) ATTRIBUTE_NONNULL(1); int virFileIsClusterFS(const char *path) ATTRIBUTE_NONNULL(1); int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1); --=20 2.37.1 From nobody Sun May 19 03:12:35 2024 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=1662384875; cv=none; d=zohomail.com; s=zohoarc; b=hzciiBHxpAgcHriGlAuN6J7Mli5Nz4Tu8Dto2tyL8eNhfDrzMo96F4XX8mv4m4Dct8XWkLzQCBahU8C+ty3GdvzyPMptvhCHP018lvF9fr2vlzmc5FZe9E0RUIhObLV2hDK4pQpGWK2FAQzOOoAyJA1WLQTGF+Y1sdasJvMkDK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662384875; 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=5oShIzysYHDgmnoKZ6+/R9OQDwrM7aT1IQfvwMkjRaA=; b=CsLyu8wjRE5H0txinUD+21TPkYsvhqbNUpVl3m/GLi0Rtee1PKullZsl9LoCoNzK/5mBCiWjSmFsbVBXzEwYcAHptccFWQpYWOST9XuGraRhlshG5vi6E7kKeRlkG1mkAJcIZ1EzdfulrpNLb+Gn5MNX5FwcpmALsX7wIldMDN0= 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 1662384875075910.1998796986896; Mon, 5 Sep 2022 06:34:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-330-QtlAV_u8MxqI0GchQswKIA-1; Mon, 05 Sep 2022 09:34:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB47885A58F; Mon, 5 Sep 2022 13:34:28 +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 B71522166B26; Mon, 5 Sep 2022 13:34:28 +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 A9FE61946A48; Mon, 5 Sep 2022 13:34:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 25B351946A47 for ; Mon, 5 Sep 2022 13:34:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 08E3140D283D; Mon, 5 Sep 2022 13:34:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1C0540D282E for ; Mon, 5 Sep 2022 13:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662384873; 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=5oShIzysYHDgmnoKZ6+/R9OQDwrM7aT1IQfvwMkjRaA=; b=LNWmx9kW+TdtRYNXUbvj6AN/kVdfGrFeSOXKUUoFTPrT7x9vfe4lCIrpjBknytlQ4hY7Az JOrUxOAU3ZjhlzMz8pLALWRahMolNkqPosG4SFaUIUT5EqyNaQndaBKmyYmub1Adv29jfY 9plQuxy86rnMzlRKzwJl2vDYvIKkQfA= X-MC-Unique: QtlAV_u8MxqI0GchQswKIA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/7] util: virFileIsSharedFSType: Annotate (some) shared filesystem names Date: Mon, 5 Sep 2022 15:34:16 +0200 Message-Id: <707110961a10a19a99fca496058343a9bbe12f26.1662384799.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.78 on 10.11.54.6 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: 1662384876083100002 Content-Type: text/plain; charset="utf-8" Expand some of the uncommon or unobvious filesystem names in a comment. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/virfile.h b/src/util/virfile.h index 8d6df034f8..c4d11ea21a 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -213,15 +213,15 @@ bool virFileIsRegular(const char *file) ATTRIBUTE_NON= NULL(1); enum { VIR_FILE_SHFS_NFS =3D (1 << 0), - VIR_FILE_SHFS_GFS2 =3D (1 << 1), - VIR_FILE_SHFS_OCFS =3D (1 << 2), - VIR_FILE_SHFS_AFS =3D (1 << 3), - VIR_FILE_SHFS_SMB =3D (1 << 4), - VIR_FILE_SHFS_CIFS =3D (1 << 5), + VIR_FILE_SHFS_GFS2 =3D (1 << 1), /* Global File System 2 */ + VIR_FILE_SHFS_OCFS =3D (1 << 2), /* Oracle Cluster FS (2) */ + VIR_FILE_SHFS_AFS =3D (1 << 3), /* Andrew File System */ + VIR_FILE_SHFS_SMB =3D (1 << 4), /* Server message block - windows shar= es */ + VIR_FILE_SHFS_CIFS =3D (1 << 5), /* Common Internet File System - wind= ows shares */ VIR_FILE_SHFS_CEPH =3D (1 << 6), - VIR_FILE_SHFS_GPFS =3D (1 << 7), - VIR_FILE_SHFS_QB =3D (1 << 8), - VIR_FILE_SHFS_ACFS =3D (1 << 9), + VIR_FILE_SHFS_GPFS =3D (1 << 7), /* General Parallel File System/IBM S= pectrum Scale */ + VIR_FILE_SHFS_QB =3D (1 << 8), /* Quobyte shared filesystem */ + VIR_FILE_SHFS_ACFS =3D (1 << 9), /* Oracle ASM Cluster File System */ }; int virFileIsSharedFSType(const char *path, unsigned int fstypes) ATTRIBUT= E_NONNULL(1); --=20 2.37.1 From nobody Sun May 19 03:12:35 2024 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=1662384876; cv=none; d=zohomail.com; s=zohoarc; b=ZllZasWfBoy/QvtC/aK1LfnX8FHSwrjeTsn/706MYFcuJaOQWE1zys5q166LaPsJvSwau7eIyjt1ZpwQ+RPXujt15BZ0etgat4qTGJe5FmMChIMIvrdXerKDEuENWxPClCDrIsppUp9sUwbIRSTB6Ldp4BPzE5/LBeW6Cvc/PSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662384876; 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=ytla2pQE2BHnDdYc/UWbipTm0uv/9zNY0FhMyxfmouk=; b=I9VQa9ajVqApoZaiqUOc6VFqiM6LJagZp69//2K5StkxRXL6iFf8qxW3LrCVesuVylMDLOegCZIfovLzSD7dLUJdpHahnsssEW3SS3guCS21PIS/r5g1HqITMrXbLpvEvDoFJEsEmxkf5Cdan2JyOE9a3yXpmyeBb1srS09Tixw= 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 1662384876633683.0247885509884; Mon, 5 Sep 2022 06:34:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-310-zEQ6wDnIOreq0nE39vJORg-1; Mon, 05 Sep 2022 09:34:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7999618E004F; Mon, 5 Sep 2022 13:34:29 +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 65BC32166B26; Mon, 5 Sep 2022 13:34:29 +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 584C0194B966; Mon, 5 Sep 2022 13:34:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1EDD91946A47 for ; Mon, 5 Sep 2022 13:34:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1183E40D2830; Mon, 5 Sep 2022 13:34:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FF1840D282E for ; Mon, 5 Sep 2022 13:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662384874; 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=ytla2pQE2BHnDdYc/UWbipTm0uv/9zNY0FhMyxfmouk=; b=BVNK1SzfoZW5+2B2kBmCbt2NPZ++uOKDCiF8aWWovm7LQnn7U+Rekl6D3IXiJA2ShBH9ps 610ORdfOfW7/8DcJwUAe7bH8HkIH8LxUZpJ4AOAAxWzlLDSDErXvmuYDMzzlnIyLjZXBz4 ag/BymXguNkz/N1LQmwD3ikGyrIPbZQ= X-MC-Unique: zEQ6wDnIOreq0nE39vJORg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/7] util: virFileIsSharedFixFUSE: Refactor cleanup Date: Mon, 5 Sep 2022 15:34:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.78 on 10.11.54.6 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: 1662384878146100001 Content-Type: text/plain; charset="utf-8" Automatically free memory of 'canonPath' so that the failure of 'setmntent' doesn't have to go to 'cleanup'. This allows us to remove the cleanup section and the 'ret' variable as the rest of the function can't fail. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 1def05b6c4..a8443acf8d 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3333,24 +3333,19 @@ virFileIsSharedFixFUSE(const char *path, char mntbuf[1024]; char *mntDir =3D NULL; char *mntType =3D NULL; - char *canonPath =3D NULL; + g_autofree char *canonPath =3D NULL; size_t maxMatching =3D 0; - int ret =3D -1; if (!(canonPath =3D virFileCanonicalizePath(path))) { - virReportSystemError(errno, - _("unable to canonicalize %s"), - path); + virReportSystemError(errno, _("unable to canonicalize %s"), path); return -1; } VIR_DEBUG("Path canonicalization: %s->%s", path, canonPath); if (!(f =3D setmntent(PROC_MOUNTS, "r"))) { - virReportSystemError(errno, - _("Unable to open %s"), - PROC_MOUNTS); - goto cleanup; + virReportSystemError(errno, _("Unable to open %s"), PROC_MOUNTS); + return -1; } while (getmntent_r(f, &mb, mntbuf, sizeof(mntbuf))) { @@ -3372,6 +3367,8 @@ virFileIsSharedFixFUSE(const char *path, } } + endmntent(f); + if (STREQ_NULLABLE(mntType, "fuse.glusterfs")) { VIR_DEBUG("Found gluster FUSE mountpoint=3D%s for path=3D%s. " "Fixing shared FS type", mntDir, canonPath); @@ -3382,13 +3379,9 @@ virFileIsSharedFixFUSE(const char *path, *f_type =3D QB_MAGIC; } - ret =3D 0; - cleanup: - VIR_FREE(canonPath); VIR_FREE(mntType); VIR_FREE(mntDir); - endmntent(f); - return ret; + return 0; } --=20 2.37.1 From nobody Sun May 19 03:12:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1662384880; cv=none; d=zohomail.com; s=zohoarc; b=A2WGRE/W/x7fFxTM+imOukfvcjc/ICrlzcJ95TBgiR+ixfghpC3J0Q8bKnpSw1cwQToWT1e0B9Vf1eqZ2chKbbCTaUAbo/8AmuZsbFzd5JpqmeTVzaAJx0H/g7elDW4ZVvj+SCoklvKWg9PtcJmZGfthYN+ZRUNc7qfGKRMORhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662384880; 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=cbSEyEjipCSM896pNHvWCr8t63ui2f+HenTyWRRkg7o=; b=aAN5jTQy00WeOnordcHK4YHKmf6i/3OeKJnC0fm36sJgAwODNTTEDMY3RMtcZMyJ/qwAH7CLtzfoYHFLAd2Rzgdg1YTblEl5Fw4kG3+gN9pNqmq/nMUFfnCgTrrvw5XQAyMFjElPxtqgFk1pZ4dWs4tnWm1wGaGcPnAAuTqE/kk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1662384880096893.6314546889994; Mon, 5 Sep 2022 06:34:40 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-1Yewjm08OJepgYDz9s4PJA-1; Mon, 05 Sep 2022 09:34:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 218028037AA; Mon, 5 Sep 2022 13:34:31 +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 0E3B9945DD; Mon, 5 Sep 2022 13:34:31 +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 E71A41946A48; Mon, 5 Sep 2022 13:34:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 586A7194B97A for ; Mon, 5 Sep 2022 13:34:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3F88440D2830; Mon, 5 Sep 2022 13:34:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6B9D40D282E for ; Mon, 5 Sep 2022 13:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662384879; 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=cbSEyEjipCSM896pNHvWCr8t63ui2f+HenTyWRRkg7o=; b=PRwFyVweb1nKtk1okrl8semhrPKXVNUxzrSK84YN3rLY9Pp3HvyKGzWDdTuKX7M81vakGW af355wxKG3N/doEUG3o7BzNdqOhhrtIbVUsM5YSpxsWYCcL2IXkwQv6/XwrkhFatW+EuMJ PbfRuJtUawsQeePaPf0TkX6JFoguem0= X-MC-Unique: 1Yewjm08OJepgYDz9s4PJA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/7] util: virfile: Rewrite matching of FUSE-based shared filesystems Date: Mon, 5 Sep 2022 15:34:18 +0200 Message-Id: <287b7c467335f7994f9bf5efc10f9a1590c4f9e4.1662384799.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.79 on 10.11.54.5 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: 1662384880809100002 Content-Type: text/plain; charset="utf-8" 'virFileIsSharedFixFUSE' was used to update the 'f_type' field for certain shared filesystem types. This patch renames it to 'virFileIsSharedFsFUSE' and makes it directly return whether the FUSE filesystem is shared or not and simplifies additions to the list of shared FUSE filesystems. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.c | 54 ++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index a8443acf8d..33a3ffe8f7 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3324,17 +3324,27 @@ virFileRemoveLastComponent(char *path) # define PROC_MOUNTS "/proc/mounts" + +struct virFileSharedFsData { + const char *mnttype; + unsigned int fstype; +}; + +static const struct virFileSharedFsData virFileSharedFsFUSE[] =3D { + { .mnttype =3D "fuse.glusterfs", .fstype =3D VIR_FILE_SHFS_GFS2 }, + { .mnttype =3D "fuse.quobyte", .fstype =3D VIR_FILE_SHFS_QB }, +}; + static int -virFileIsSharedFixFUSE(const char *path, - long long *f_type) +virFileIsSharedFsFUSE(const char *path, + unsigned int fstypes) { FILE *f =3D NULL; struct mntent mb; char mntbuf[1024]; - char *mntDir =3D NULL; - char *mntType =3D NULL; g_autofree char *canonPath =3D NULL; size_t maxMatching =3D 0; + bool isShared =3D false; if (!(canonPath =3D virFileCanonicalizePath(path))) { virReportSystemError(errno, _("unable to canonicalize %s"), path); @@ -3359,28 +3369,30 @@ virFileIsSharedFixFUSE(const char *path, continue; if (len > maxMatching) { + size_t i; + bool found =3D false; + + for (i =3D 0; i < G_N_ELEMENTS(virFileSharedFsFUSE); i++) { + if (STREQ_NULLABLE(mb.mnt_type, virFileSharedFsFUSE[i].mnt= type) && + (fstypes & virFileSharedFsFUSE[i].fstype) > 0) { + found =3D true; + break; + } + } + + VIR_DEBUG("Updating shared=3D'%d' for mountpoint '%s' type '%s= '", + found, p, mb.mnt_type); + + isShared =3D found; maxMatching =3D len; - VIR_FREE(mntType); - VIR_FREE(mntDir); - mntDir =3D g_strdup(mb.mnt_dir); - mntType =3D g_strdup(mb.mnt_type); } } endmntent(f); - if (STREQ_NULLABLE(mntType, "fuse.glusterfs")) { - VIR_DEBUG("Found gluster FUSE mountpoint=3D%s for path=3D%s. " - "Fixing shared FS type", mntDir, canonPath); - *f_type =3D GFS2_MAGIC; - } else if (STREQ_NULLABLE(mntType, "fuse.quobyte")) { - VIR_DEBUG("Found Quobyte FUSE mountpoint=3D%s for path=3D%s. " - "Fixing shared FS type", mntDir, canonPath); - *f_type =3D QB_MAGIC; - } + if (isShared) + return 1; - VIR_FREE(mntType); - VIR_FREE(mntDir); return 0; } @@ -3432,8 +3444,8 @@ virFileIsSharedFSType(const char *path, f_type =3D sb.f_type; if (f_type =3D=3D FUSE_SUPER_MAGIC) { - VIR_DEBUG("Found FUSE mount for path=3D%s. Trying to fix it", path= ); - virFileIsSharedFixFUSE(path, &f_type); + VIR_DEBUG("Found FUSE mount for path=3D%s", path); + return virFileIsSharedFsFUSE(path, fstypes); } VIR_DEBUG("Check if path %s with FS magic %lld is shared", --=20 2.37.1 From nobody Sun May 19 03:12:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1662384879; cv=none; d=zohomail.com; s=zohoarc; b=i0dGh4Sg+ckQv9YrCkGJjcsfPSLfaLCLdhw6WmoSMdPEN5yR63dkHKgTOU+Pz4+K4cYoZ78B99fKO255xu801W1l8G5TCclyhez3zMUTDFpgRPS4e3dwz3ieEUOXLqlHfKlt1reRAvw1BhHU+70e2mI1Vdevz6hyEc3vZGOWcxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662384879; 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=uZCQU2ul7Xl/v0ccOou6XTAXlQ9Tz2qS18I0ieFbjDU=; b=EBGaRBugtxihVOPzveoL66PFNvW3WDKoHeqQKseca9Kqc2qOf6USLX7fp/rGxy+FtVPpHJYV4+OkoitEWXpcQhY6Hq3AH9ddC+eDl2wUQedv806JgsoVH3t9L9j04aul+DoQDuUuAsl4HkJpjP5EJ4oB4YxTpM9bjiJgYSarAZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1662384879551430.1932888824514; Mon, 5 Sep 2022 06:34:39 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-iyBXS5eVM9yDoa5rIJEldg-1; Mon, 05 Sep 2022 09:34:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D10C08039D0; Mon, 5 Sep 2022 13:34:31 +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 BE2BC40CF8EF; Mon, 5 Sep 2022 13:34:31 +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 A3978194B97A; Mon, 5 Sep 2022 13:34:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9EAC61946A47 for ; Mon, 5 Sep 2022 13:34:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8146440D2830; Mon, 5 Sep 2022 13:34:30 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCBCA40D282E for ; Mon, 5 Sep 2022 13:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662384878; 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=uZCQU2ul7Xl/v0ccOou6XTAXlQ9Tz2qS18I0ieFbjDU=; b=MdgiQ7I8uSqjBcJ6YlRDbyeRkoj8Jy+4PyQRVy2sEfzLHvgo+yK8UkFPT5qdldgbrX+sLJ jk+3ur7M/SjGNL8HOsrzetGw0ndYlPLqrfJKPpP0WB7KaMZU59Le19XVC8+1VKKSLDg4kV 3u0XRIHTqG2K3HST4/GX3Ms7lc+90SY= X-MC-Unique: iyBXS5eVM9yDoa5rIJEldg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/7] util: virfile: Don't use VIR_FILE_SHFS_GFS2 for glusterfs Date: Mon, 5 Sep 2022 15:34:19 +0200 Message-Id: <1815f3891d518dca4f71c1c8dea14e8eae0f0a1d.1662384799.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.84 on 10.11.54.1 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: 1662384880803100001 Content-Type: text/plain; charset="utf-8" While the code works properly as no code path is specifically wanting to check for glusterfs, we should properly declare glusterfs as a separate from GFS2. Fixes: 478da65fb46 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.c | 8 +++++--- src/util/virfile.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 33a3ffe8f7..f5a61abd9f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3331,7 +3331,7 @@ struct virFileSharedFsData { }; static const struct virFileSharedFsData virFileSharedFsFUSE[] =3D { - { .mnttype =3D "fuse.glusterfs", .fstype =3D VIR_FILE_SHFS_GFS2 }, + { .mnttype =3D "fuse.glusterfs", .fstype =3D VIR_FILE_SHFS_GLUSTERFS }, { .mnttype =3D "fuse.quobyte", .fstype =3D VIR_FILE_SHFS_QB }, }; @@ -3668,7 +3668,8 @@ int virFileIsSharedFS(const char *path) VIR_FILE_SHFS_CEPH | VIR_FILE_SHFS_GPFS| VIR_FILE_SHFS_QB | - VIR_FILE_SHFS_ACFS); + VIR_FILE_SHFS_ACFS | + VIR_FILE_SHFS_GLUSTERFS); } @@ -3681,7 +3682,8 @@ virFileIsClusterFS(const char *path) return virFileIsSharedFSType(path, VIR_FILE_SHFS_GFS2 | VIR_FILE_SHFS_OCFS | - VIR_FILE_SHFS_CEPH); + VIR_FILE_SHFS_CEPH | + VIR_FILE_SHFS_GLUSTERFS); } diff --git a/src/util/virfile.h b/src/util/virfile.h index c4d11ea21a..f7a31d9f57 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -222,6 +222,7 @@ enum { VIR_FILE_SHFS_GPFS =3D (1 << 7), /* General Parallel File System/IBM S= pectrum Scale */ VIR_FILE_SHFS_QB =3D (1 << 8), /* Quobyte shared filesystem */ VIR_FILE_SHFS_ACFS =3D (1 << 9), /* Oracle ASM Cluster File System */ + VIR_FILE_SHFS_GLUSTERFS =3D (1 << 10), /* gluster's FUSE-based client = */ }; int virFileIsSharedFSType(const char *path, unsigned int fstypes) ATTRIBUT= E_NONNULL(1); --=20 2.37.1 From nobody Sun May 19 03:12:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1662385037; cv=none; d=zohomail.com; s=zohoarc; b=SF3sWWlZ4c0X23Ul4Tu+K7xECRjFycPyIoB3GW4sqLMNtlCSwUz/UWawr+QTf3DokY5/Q2UOhj2LLqd1FFbGCwaTAt+czVL0XOEQPcdmp4xFXA4fvOCwjJrTZtroU4tInVUkvEebB5pmuODyIjPAwo4/rqNdzt01ZkF8bBtcd90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662385037; 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=Jh7QBTgZnD4/5cKkzjjY4KG3qiw53qxW8U+0UIb/ogE=; b=NmSWHpDYaY1j2hNtBD79rOJNgFC2CUr771RvDUsBeyfcUcxv4rjBd3sIOeYnrpWToLbTujro4oBT5RN599RP/ke+7QTdpD7T4eiNs1cg3qu9fUrcElpOTQhRvHVTYkaxybr7MykcBGdsTfszBwRNJQDXylRCrjfrBlFTqZ/9W28= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1662385037386361.1903049396292; Mon, 5 Sep 2022 06:37:17 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-607-JbCMatvdPvWzANzusX2veg-1; Mon, 05 Sep 2022 09:34:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E90985A589; Mon, 5 Sep 2022 13:34:34 +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 0CB6514152E0; Mon, 5 Sep 2022 13:34:34 +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 E77F81946A48; Mon, 5 Sep 2022 13:34:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D4EDC194B97A for ; Mon, 5 Sep 2022 13:34:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BBB2840D2830; Mon, 5 Sep 2022 13:34:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0750540D282E for ; Mon, 5 Sep 2022 13:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662385036; 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=Jh7QBTgZnD4/5cKkzjjY4KG3qiw53qxW8U+0UIb/ogE=; b=KPNsyodOoGjqVwnqg2J76iRcZgUzFPt1XpFLetltd8+OQEVWj5c3m9QnMFnUdB4a2aHxvP rjo1F48olkVoJ19hwVG7jLcZ73de4WWeXHgb4azRnaNc/3+jqhYq7YBXg8C4g8+2y55DMi yXquToIArVpmDfVKKvMVCytnyI94FEA= X-MC-Unique: JbCMatvdPvWzANzusX2veg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/7] util: virfile: Drop QB_MAGIC constant Date: Mon, 5 Sep 2022 15:34:20 +0200 Message-Id: <0c1542ff9f105eec21542db53f02e3b13f8f7f68.1662384799.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.85 on 10.11.54.7 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: 1662385038855100001 Content-Type: text/plain; charset="utf-8" The filesystem type magic constant was added for the 'quobyte' shared filesystem in commit 451094bd153 but is present neither in the kernel sources nor in coreutils which we've historically used as source of information. Since the code dealing with FUSE-based filesystems doesn't need the constand we can remove it and the now-dead check for it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index f5a61abd9f..6302364797 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3316,9 +3316,6 @@ virFileRemoveLastComponent(char *path) # ifndef GPFS_SUPER_MAGIC # define GPFS_SUPER_MAGIC 0x47504653 # endif -# ifndef QB_MAGIC -# define QB_MAGIC 0x51626d6e -# endif # define VIR_ACFS_MAGIC 0x61636673 @@ -3476,9 +3473,6 @@ virFileIsSharedFSType(const char *path, if ((fstypes & VIR_FILE_SHFS_GPFS) && (f_type =3D=3D GPFS_SUPER_MAGIC)) return 1; - if ((fstypes & VIR_FILE_SHFS_QB) && - (f_type =3D=3D QB_MAGIC)) - return 1; if ((fstypes & VIR_FILE_SHFS_ACFS) && (f_type =3D=3D VIR_ACFS_MAGIC)) return 1; --=20 2.37.1 From nobody Sun May 19 03:12:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1662384978; cv=none; d=zohomail.com; s=zohoarc; b=Mk1+M/8lDCdVH8zgUq1xF3DPtNWQuC7DtyHgFYu+2nTdBdCtyILTdYGmuLuCPC8xSzdiwBpc1MjM4SvdcYclFGGNZafU5DQ80x+N3A4djBt9tSxiOzYY/CiqPtSPCWn0mruzpcNINunSHP17he8dz3PzIuTCpycHqTU4RsdgnYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662384978; 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=6w1w+lbpiOxMxy7ouT8VVL3UYzh82jnt5AGOfabXEZY=; b=Q6f1aga1NuGhvnie85qbTwiI02UnvUwhnxsxQLu3s3bFdm0XZVelk7LJ/tdg9UuDUf724/stESKfgu0yF60BSMRpohGgqllUkLnEYZJw4P2AhMfQ6tUCcs9fVeidM+4kGtiLDonnmR/kLigLm6D6nA4X+X42Stg8Yo3rfzMv3vM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1662384978982720.7702810549686; Mon, 5 Sep 2022 06:36:18 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-YDeY-wGGOMShHpGP_IVPsA-1; Mon, 05 Sep 2022 09:34:37 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A55ED85828B; Mon, 5 Sep 2022 13:34:34 +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 5A6C42166B2E; Mon, 5 Sep 2022 13:34:34 +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 30FDA194B97A; Mon, 5 Sep 2022 13:34:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 34AD81946A47 for ; Mon, 5 Sep 2022 13:34:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2882A40D2830; Mon, 5 Sep 2022 13:34:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 380F940D282E for ; Mon, 5 Sep 2022 13:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662384978; 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=6w1w+lbpiOxMxy7ouT8VVL3UYzh82jnt5AGOfabXEZY=; b=cgmZQdJVgiAGQXct5dgIfcsEXqCtBJGyK7waSkdFOYjk4HYBz063O2e+va9iB4EBNMjcw+ ehmsL8J7g/aYKpBwcZ6umh4cTzazPSyrlTzUc6WpwfJhFVt8mM/BPba3EpFfr4wd598VLZ BXLcLEJ91tLcdbrA1DxAQ9UOk1GJ6BI= X-MC-Unique: YDeY-wGGOMShHpGP_IVPsA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/7] util: virFileIsSharedFSType: Simplify shared fs type declarations Date: Mon, 5 Sep 2022 15:34:21 +0200 Message-Id: <3f8316da96d202123918f628c8e5d6c7393a6d41.1662384799.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 2.78 on 10.11.54.6 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: 1662384980628100001 Content-Type: text/plain; charset="utf-8" Use approach similar to virFileIsSharedFsFUSE to declaratively handle the filesystem magic numbers mapping to libvirt's fstypes. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.c | 48 +++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 6302364797..ec40c04b1f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3324,6 +3324,7 @@ virFileRemoveLastComponent(char *path) struct virFileSharedFsData { const char *mnttype; + unsigned int magic; unsigned int fstype; }; @@ -3394,6 +3395,19 @@ virFileIsSharedFsFUSE(const char *path, } +static const struct virFileSharedFsData virFileSharedFs[] =3D { + { .fstype =3D VIR_FILE_SHFS_NFS, .magic =3D NFS_SUPER_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_GFS2, .magic =3D GFS2_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_OCFS, .magic =3D OCFS2_SUPER_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_AFS, .magic =3D AFS_FS_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_SMB, .magic =3D SMB_SUPER_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_CIFS, .magic =3D CIFS_SUPER_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_CEPH, .magic =3D CEPH_SUPER_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_GPFS, .magic =3D GPFS_SUPER_MAGIC }, + { .fstype =3D VIR_FILE_SHFS_ACFS, .magic =3D VIR_ACFS_MAGIC }, +}; + + int virFileIsSharedFSType(const char *path, unsigned int fstypes) @@ -3403,6 +3417,7 @@ virFileIsSharedFSType(const char *path, struct statfs sb; int statfs_ret; long long f_type =3D 0; + size_t i; dirpath =3D g_strdup(path); @@ -3448,34 +3463,11 @@ virFileIsSharedFSType(const char *path, VIR_DEBUG("Check if path %s with FS magic %lld is shared", path, f_type); - if ((fstypes & VIR_FILE_SHFS_NFS) && - (f_type =3D=3D NFS_SUPER_MAGIC)) - return 1; - - if ((fstypes & VIR_FILE_SHFS_GFS2) && - (f_type =3D=3D GFS2_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_OCFS) && - (f_type =3D=3D OCFS2_SUPER_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_AFS) && - (f_type =3D=3D AFS_FS_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_SMB) && - (f_type =3D=3D SMB_SUPER_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_CIFS) && - (f_type =3D=3D CIFS_SUPER_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_CEPH) && - (f_type =3D=3D CEPH_SUPER_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_GPFS) && - (f_type =3D=3D GPFS_SUPER_MAGIC)) - return 1; - if ((fstypes & VIR_FILE_SHFS_ACFS) && - (f_type =3D=3D VIR_ACFS_MAGIC)) - return 1; + for (i =3D 0; i < G_N_ELEMENTS(virFileSharedFs); i++) { + if (f_type =3D=3D virFileSharedFs[i].magic && + (fstypes & virFileSharedFs[i].fstype) > 0) + return 1; + } return 0; } --=20 2.37.1