From nobody Mon May 13 02:58:08 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=1646643678; cv=none; d=zohomail.com; s=zohoarc; b=NwTsg3H2ZAcQfqBFxj2pJQ3Bgau9vg4SgTu0pbiTteg1LXYieR+fxk1f7A8zWnqzHy6peB+whIqJKKFuVNIDJqlmOVSfwZv/R4g+vFXu5H0MCj82PZkCa79sNZhgRmejOXXafjPpG+D1dfo/ZPVl32oV9gusdznFWlrHZRTPsJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643678; 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=GkNqGsoUMEKHznQKB7ySRFrwvI2Z6otkC9yr8N1q00M=; b=KZYfEcgJRE7khixgF9X5qxwzcgheotyaevUhsFagilajiQXlU//srjthz7mhP8UZWqymj9Q6IhDOrTZ2O2VwtOiWPhdKM47MAjZ4U+i6CUvcKPmaLPGoeSpy6K5aIf22oqsQv+m+3y5i/RrvQ7/8CWGlIo+U2qrgkQ5AtM+mHhs= 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 1646643678108410.20951462492826; Mon, 7 Mar 2022 01:01:18 -0800 (PST) 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-500-FlFjzJb9NHmNQO9NgryZbQ-1; Mon, 07 Mar 2022 04:01:15 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18AE48047D6; Mon, 7 Mar 2022 09:01:13 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04970401E38; Mon, 7 Mar 2022 09:01:13 +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 BB8191931BD5; Mon, 7 Mar 2022 09:01:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 21DC71931BD1 for ; Mon, 7 Mar 2022 09:01:11 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D69841F470; Mon, 7 Mar 2022 09:01:10 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D60C1F476 for ; Mon, 7 Mar 2022 09:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643677; 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=GkNqGsoUMEKHznQKB7ySRFrwvI2Z6otkC9yr8N1q00M=; b=aSyr+vp4kqyBouLOcTta1led4RrmHsJs6yEcbmGRj+DE3kwBHIYg8t2PBm3QTcQC4dL03T FrHcgn7KyYdyUmVdCTaCf73VVf2883nxa839DyC8r7oTIPDHsssQ+gG1iMaTKmRGDfCHWk 4juj99Ksynbtbt48iPNMoNwAiXengqU= X-MC-Unique: FlFjzJb9NHmNQO9NgryZbQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 01/17] lxc_fuse: Hide struct virLXCFuse Date: Mon, 7 Mar 2022 10:00:51 +0100 Message-Id: <5fab602761674c5a996249331ffb2a6717b67987.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643679684100001 Content-Type: text/plain; charset="utf-8" This structure is not used outside of lxc_fuse.c. There is no need to define it in the header file. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 9 +++++++++ src/lxc/lxc_fuse.h | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index e75a533c70..7b95629955 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -37,6 +37,15 @@ =20 #if WITH_FUSE =20 +struct virLXCFuse { + virDomainDef *def; + virThread thread; + char *mountpoint; + struct fuse *fuse; + struct fuse_chan *ch; + virMutex lock; +}; + static const char *fuse_meminfo_path =3D "/meminfo"; =20 static int lxcProcGetattr(const char *path, struct stat *stbuf) diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h index 54a0a74155..34a59667d4 100644 --- a/src/lxc/lxc_fuse.h +++ b/src/lxc/lxc_fuse.h @@ -41,14 +41,6 @@ struct virLXCMeminfo { unsigned long long swapusage; }; =20 -struct virLXCFuse { - virDomainDef *def; - virThread thread; - char *mountpoint; - struct fuse *fuse; - struct fuse_chan *ch; - virMutex lock; -}; typedef struct virLXCFuse virLXCFuse; =20 int lxcSetupFuse(struct virLXCFuse **f, virDomainDef *def); --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643678; cv=none; d=zohomail.com; s=zohoarc; b=cJCoIvub9HSlfPhdYUHuXxBOTGncLW3NSfBG5Fx3i/xQ6MUKXdu3LAd0tWAjIwEudzar1iMBZz/DUhKUJLfeGA+FKNFcalEXrVAiLGJLqzpAsQToUvwdQgbdrn5g9hOHG2pUvMQFoKHwnIozmJG8qmDZM1bvwfTlovSrSUovldY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643678; 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=HrZLxRkf9kCXAioKOswwYMDSMPZIbUWZdb64yeF54eQ=; b=ETJ6ZqtER1zidEdqno0Fu4mCDAk6WsAWF4ZOTaMdsVfSzKp6hzOc6zxp1BmcFmrB6EElRBPXsiMXf0bskWzHHQScO1M9TlhSY08AVoRsgSr9RjMS3fkfZHFgeN9kUQfioW7pAUDsWTamQ1b0f0jT/21xERUIk6oyQoa33jGQ+uw= 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 1646643678803307.85233219103804; Mon, 7 Mar 2022 01:01:18 -0800 (PST) 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-663-PBYO1XdgOyyUnu45HrQGjA-1; Mon, 07 Mar 2022 04:01:15 -0500 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 9773783396A; Mon, 7 Mar 2022 09:01:13 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AF71145FBAE; Mon, 7 Mar 2022 09:01:13 +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 16FBE1931BFE; Mon, 7 Mar 2022 09:01:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DC92A194F4B4 for ; Mon, 7 Mar 2022 09:01:11 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AC8031FD88; Mon, 7 Mar 2022 09:01:11 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32FAB1F473 for ; Mon, 7 Mar 2022 09:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643678; 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=HrZLxRkf9kCXAioKOswwYMDSMPZIbUWZdb64yeF54eQ=; b=QxJWrnm7z42QaecTmVBmmDuafkWf90T/m1xlAcvakncQMVluatSoqMI9y+N77mgRNskM7S j8uF1l+wKdoWLXhlBr05h+Aa3DaEBQY6QmErIWmBGtFATgtl8xvTfZapG2KsCtzZVkOCy6 oKGhwdkBL87tp9YbGiWZYqQ1jRuESOM= X-MC-Unique: PBYO1XdgOyyUnu45HrQGjA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 02/17] lxc_fuse: Move virLXCMeminfo struct into lxc_cgroup.h Date: Mon, 7 Mar 2022 10:00:52 +0100 Message-Id: <81e7f03906b957cf5fe6721697d2edfa517de0df.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643690718100001 Content-Type: text/plain; charset="utf-8" The function that fills virLXCMeminfo struct (virLXCCgroupGetMeminfo()) lives in lxc_cgroup.h. Move the struct there too. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_cgroup.h | 13 +++++++++++++ src/lxc/lxc_fuse.h | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lxc/lxc_cgroup.h b/src/lxc/lxc_cgroup.h index 2b323371f9..bebdc3ff96 100644 --- a/src/lxc/lxc_cgroup.h +++ b/src/lxc/lxc_cgroup.h @@ -35,6 +35,19 @@ int virLXCCgroupSetup(virDomainDef *def, virCgroup *cgroup, virBitmap *nodemask); =20 +struct virLXCMeminfo { + unsigned long long memtotal; + unsigned long long memusage; + unsigned long long cached; + unsigned long long active_anon; + unsigned long long inactive_anon; + unsigned long long active_file; + unsigned long long inactive_file; + unsigned long long unevictable; + unsigned long long swaptotal; + unsigned long long swapusage; +}; + int virLXCCgroupGetMeminfo(struct virLXCMeminfo *meminfo); =20 int diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h index 34a59667d4..7052391a7b 100644 --- a/src/lxc/lxc_fuse.h +++ b/src/lxc/lxc_fuse.h @@ -28,19 +28,6 @@ =20 #include "lxc_conf.h" =20 -struct virLXCMeminfo { - unsigned long long memtotal; - unsigned long long memusage; - unsigned long long cached; - unsigned long long active_anon; - unsigned long long inactive_anon; - unsigned long long active_file; - unsigned long long inactive_file; - unsigned long long unevictable; - unsigned long long swaptotal; - unsigned long long swapusage; -}; - typedef struct virLXCFuse virLXCFuse; =20 int lxcSetupFuse(struct virLXCFuse **f, virDomainDef *def); --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643681; cv=none; d=zohomail.com; s=zohoarc; b=kSJWquWbXKvU6opTV9NKsZ+ii89zNzL8Hy/CbaitLoeF4u6xWFJaseNWakqWzuJW8HvKjbbn29W5czNeZCGvQlLIS29LQgKTMhUCKCdct5ChMO+UMc4S7X+dlqVgmSaSMnLY+au1dfwP3uOl7RBdKGgob6k6tnGAXWcHb1hVo0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643681; 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=QG2YO9PTMy3kpUlmmljV/Z6ApygDcgaGStrOa6erAro=; b=e2PUV/qnyXkDFu6xW1agjwaQt4nHraxuF5lv8qar9VuuXVjP7HmMQ/E8ok0tghC2KODrB91HxH6MOr/Mqk+R2XRczUiR2dsSztbQxcoNeooNZTb7YLXP2GJIKgHetSRk2hD9lQLqrAcY6msAiC07ke0ZEJSOLFSEmnMZkO1xhvI= 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 164664368108653.53432111604832; Mon, 7 Mar 2022 01:01:21 -0800 (PST) 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-615-qyhpFhkxMJaOYhDVt8RQ0Q-1; Mon, 07 Mar 2022 04:01:17 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 031A32999B24; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEC944750AE; Mon, 7 Mar 2022 09:01:14 +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 BA19F1931BDD; Mon, 7 Mar 2022 09:01:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BFF331931BD1 for ; Mon, 7 Mar 2022 09:01:12 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8273E1FD88; Mon, 7 Mar 2022 09:01:12 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08C981F470 for ; Mon, 7 Mar 2022 09:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643680; 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=QG2YO9PTMy3kpUlmmljV/Z6ApygDcgaGStrOa6erAro=; b=EPgMQH+udcuQamaDfk/bj9RVyuH+hgmvNJEBOKEDk9mX0wdxmzl5ytE/f5LlHZn1pmoBbE RK+0ujeEN7k1vGhqSYAV2Y5PrUz0O8X53TNzk/7HzKY7vuOzAvgnZ5G6I4BuQ5ThO0KacM Fog6n7I2sN/U/AnJrOMOk0yeVtnIDSA= X-MC-Unique: qyhpFhkxMJaOYhDVt8RQ0Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 03/17] lxc_fuse.h: Don't include lxc_conf.h Date: Mon, 7 Mar 2022 10:00:53 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643681673100005 Content-Type: text/plain; charset="utf-8" Nothing in the lxc_fuse.h header file warrants inclusion of lxc_conf.h. If anything, virconftypes.h must be included because of virDomainDef required by lxcSetupFuse(). It's actually lxc_fuse.c that requires some macros from lxc_fuse.h (e.g. LXC_STATE_DIR). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 1 + src/lxc/lxc_fuse.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 7b95629955..0550ff5ab4 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -27,6 +27,7 @@ =20 #include "lxc_fuse.h" #include "lxc_cgroup.h" +#include "lxc_conf.h" #include "virerror.h" #include "virfile.h" #include "virbuffer.h" diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h index 7052391a7b..195e1e431a 100644 --- a/src/lxc/lxc_fuse.h +++ b/src/lxc/lxc_fuse.h @@ -26,7 +26,7 @@ # include #endif =20 -#include "lxc_conf.h" +#include "virconftypes.h" =20 typedef struct virLXCFuse virLXCFuse; =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643683; cv=none; d=zohomail.com; s=zohoarc; b=OAvC9FK04ZGAGrkPBMBqcLWun2qIXQiWHKpZUPxMyGo8COpSFznGaI20BmWvChGbAcTSw+6tApQ18KN0YDI7u6WDZu1zgld1N7Y7kOhZd7BFOUVEIf2KHAbsFtEfs/ZGHRD+tsT3knX8ZvYjL54XLCjbdr908V0h2Zs1iWZxtpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643683; 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=CqMmicsMNMCAjQ31UISu0KBHJx+gTKK4ZFCBcQkMWDQ=; b=JLrGN6UcjOFsSRfG1sucDcfoNnlO29QUcTyyAYZwO6GqnlvILu7fejXaCMrGe/xorP6YqisUhzpoSfAkKdiaOH9qlgTaFPppcGagVS8yG70YTHyI02mdj1kK/hCQtfm5dNZmdaVlD/TNfG4HgvWZ1AzO2LmedQyQvIYA/EPyjT4= 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 1646643683885646.0031630814764; Mon, 7 Mar 2022 01:01:23 -0800 (PST) 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-392-mQD9567ANoKC6zZD_Lf-vw-1; Mon, 07 Mar 2022 04:01:18 -0500 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 9FA70833973; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81490145FBB1; Mon, 7 Mar 2022 09:01:15 +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 13E151931BFE; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 99F541931BD1 for ; Mon, 7 Mar 2022 09:01:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5A4511F476; Mon, 7 Mar 2022 09:01:13 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3C001F473 for ; Mon, 7 Mar 2022 09:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643682; 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=CqMmicsMNMCAjQ31UISu0KBHJx+gTKK4ZFCBcQkMWDQ=; b=aFz21IeZTQgIePbWnbTQZENho2hROhZ57PcP9UZnxswP8gJcIM4lFe58QIirnIt63VzWmg gNNxwuLG007vMv5ADOiwdh9+dIR4hc0AREa45GEnuGC9jmWMSMbXPHHxANpPX2n/QRPXCr gjlZZfT47SOf0CTb9ZaOa/J+p/u9BMg= X-MC-Unique: mQD9567ANoKC6zZD_Lf-vw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 04/17] lxc_fuse: Move #include Date: Mon, 7 Mar 2022 10:00:54 +0100 Message-Id: <9aa68f824d5baf80cd9c7c4dbf2c5c7d59439107.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643685702100003 Content-Type: text/plain; charset="utf-8" There is no need to include the fuse.h from the header file. Move the include into the lxc_fuse.c then. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 5 +++++ src/lxc/lxc_fuse.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 0550ff5ab4..3732f2e245 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -25,6 +25,11 @@ #include #include =20 +#if WITH_FUSE +# define FUSE_USE_VERSION 26 +# include +#endif + #include "lxc_fuse.h" #include "lxc_cgroup.h" #include "lxc_conf.h" diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h index 195e1e431a..4065bff7ce 100644 --- a/src/lxc/lxc_fuse.h +++ b/src/lxc/lxc_fuse.h @@ -20,11 +20,6 @@ =20 #pragma once =20 -#define FUSE_USE_VERSION 26 - -#if WITH_FUSE -# include -#endif =20 #include "virconftypes.h" =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643683; cv=none; d=zohomail.com; s=zohoarc; b=oK7MKrcMP/Kd+WakKDOvZlPvvkUwu5MroRfzAyMjw0lgxKIUBvT9EhNhAi4ukjfiNPvvCku7JitJxxFa1Au+tk2KQsnWqClFIhVl94AZeHL8pCCkUyvfYP2N7Wfp3blX9rmzuKXNprIE9gJ6JyEjLZeA2rvEBxh2mstMQ0qksvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643683; 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=8HsznCz1jIBnkXUg2KHjiXkf5TUQ/YLgqtDmhzjwhFA=; b=H8J86JKuFcp5N8kCShuWVCMdfAZ3DCbDSV0OlBxKqHt/JXLq8H0LZSJDet1JYO++u/GGCIgF/uDbNFQ54uZLitgwzoHaekqEQa6Ty7gjIv2D0O2cv/STDYZn4zmAnmW61wAnA68Zs4FGKy/ImqpnB7IV71lXQ14aP8PpTX6EwuI= 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 1646643683678259.9038114418739; Mon, 7 Mar 2022 01:01:23 -0800 (PST) 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-534-YEFv2BvSNe6wF6GMneow-A-1; Mon, 07 Mar 2022 04:01:19 -0500 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 ACB25811E78; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 961BB145FBA3; Mon, 7 Mar 2022 09:01:16 +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 559321931BD7; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5F27D1931BD1 for ; Mon, 7 Mar 2022 09:01:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 31CE71FD3D; Mon, 7 Mar 2022 09:01:14 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC5681F470 for ; Mon, 7 Mar 2022 09:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643682; 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=8HsznCz1jIBnkXUg2KHjiXkf5TUQ/YLgqtDmhzjwhFA=; b=hVnuIcFknkNmCVaNmyaPw+5GBGzIHzgcj5tElQZVtvB4Yh7+j2N3kHlU2CCpAMmTs2FZWB k420EIDlb+Msxdy9j/ASERuZLW2WJ87RlKg9hon4b/N7MdtlQnSenxxmSGWFvpBY0L62dS 0DfyYuiL/vOIwzFWUPtQqUgXSNwCTls= X-MC-Unique: YEFv2BvSNe6wF6GMneow-A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 05/17] lxc_fuse: Drop some G_GNUC_UNUSED attributes Date: Mon, 7 Mar 2022 10:00:55 +0100 Message-Id: <677c5f5f7bcba93c557e86ca7fbd6661fe7f5af5.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643685725100004 Content-Type: text/plain; charset="utf-8" There are few arguments that are marked as G_GNUC_UNUSED even though they are clearly used within their respective functions. Drop the annotation in such cases. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 3732f2e245..6c61cbdf02 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -103,8 +103,8 @@ static int lxcProcReaddir(const char *path, void *buf, return 0; } =20 -static int lxcProcOpen(const char *path G_GNUC_UNUSED, - struct fuse_file_info *fi G_GNUC_UNUSED) +static int lxcProcOpen(const char *path, + struct fuse_file_info *fi) { if (STRNEQ(path, fuse_meminfo_path)) return -ENOENT; @@ -242,10 +242,10 @@ static int lxcProcReadMeminfo(char *hostpath, virDoma= inDef *def, return res; } =20 -static int lxcProcRead(const char *path G_GNUC_UNUSED, - char *buf G_GNUC_UNUSED, - size_t size G_GNUC_UNUSED, - off_t offset G_GNUC_UNUSED, +static int lxcProcRead(const char *path, + char *buf, + size_t size, + off_t offset, struct fuse_file_info *fi G_GNUC_UNUSED) { int res =3D -ENOENT; --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643684; cv=none; d=zohomail.com; s=zohoarc; b=mEWuLTtzZro3aMliB8LLFGC+WeHWDn1grzrm5v55WMvzDY0LxkLXIn3RIVJx9vofhErZELrPrzgIRgPCr3Ap5/8gvjxIYYYTP3tCMd+63mM6Ecgcc5Yl6BbbsVtwnYV6dboEZqKD1NCvg1E9s5TdCNve8IJdzxxF1VmaCwCUJI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643684; 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=XvkWGMUUL/mEILf/sRYOZA+omNQaR8dX/nwuzpkd1nY=; b=MsFqApwBssWLw7y1TxFQGyImzqBbPXv8V2aWDhXJuT07GksOdPE0oHOQefoB0g48EJR1EK9/WOLjmEWw+wxnRhGwy+T4ZLFiwhnikCkoKefITBFOz06U/xV97z60ppAWk9aUymuHUqmN+LOTd6yMND6ptztpdPbggwceBQv6q5Y= 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 1646643684979481.3307401887987; Mon, 7 Mar 2022 01:01:24 -0800 (PST) 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-408-H2nyUls5OJGtqGULIMiapg-1; Mon, 07 Mar 2022 04:01:19 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA7932999B21; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 968BEC0809D; Mon, 7 Mar 2022 09:01:16 +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 5CF701931BF4; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 515181931BD1 for ; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0F1C91F470; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82E091FD3D for ; Mon, 7 Mar 2022 09:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643684; 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=XvkWGMUUL/mEILf/sRYOZA+omNQaR8dX/nwuzpkd1nY=; b=V1D9RsiN1rc8DW32WZh0DMyQWlwD7A1yGcC1f0MyFEpe8HiomV4lzT5hcmtcSFaw84gYV+ NuLpWIFBT3/QszFGJ6L5sdsRVkHXdlC94B3YRpHsm9b0GHZEO3gjK9PV4KIYm3a+vKia1Y burPu/oylyyffJe539OCzBIgy1D/WAU= X-MC-Unique: H2nyUls5OJGtqGULIMiapg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 06/17] lxc_fuse.c: Modernize function declarations Date: Mon, 7 Mar 2022 10:00:56 +0100 Message-Id: <8f60703df6bda13977ea9ef24c2236850e37c786.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643685765100005 Content-Type: text/plain; charset="utf-8" Our style of writing function declarations has changed since the time the file was introduced. Fix the whole file. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 71 ++++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 6c61cbdf02..b6b653e8cd 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -54,7 +54,9 @@ struct virLXCFuse { =20 static const char *fuse_meminfo_path =3D "/meminfo"; =20 -static int lxcProcGetattr(const char *path, struct stat *stbuf) +static int +lxcProcGetattr(const char *path, + struct stat *stbuf) { g_autofree char *mempath =3D NULL; struct stat sb; @@ -88,10 +90,12 @@ static int lxcProcGetattr(const char *path, struct stat= *stbuf) return 0; } =20 -static int lxcProcReaddir(const char *path, void *buf, - fuse_fill_dir_t filler, - off_t offset G_GNUC_UNUSED, - struct fuse_file_info *fi G_GNUC_UNUSED) +static int +lxcProcReaddir(const char *path, + void *buf, + fuse_fill_dir_t filler, + off_t offset G_GNUC_UNUSED, + struct fuse_file_info *fi G_GNUC_UNUSED) { if (STRNEQ(path, "/")) return -ENOENT; @@ -103,8 +107,9 @@ static int lxcProcReaddir(const char *path, void *buf, return 0; } =20 -static int lxcProcOpen(const char *path, - struct fuse_file_info *fi) +static int +lxcProcOpen(const char *path, + struct fuse_file_info *fi) { if (STRNEQ(path, fuse_meminfo_path)) return -ENOENT; @@ -115,7 +120,11 @@ static int lxcProcOpen(const char *path, return 0; } =20 -static int lxcProcHostRead(char *path, char *buf, size_t size, off_t offse= t) +static int +lxcProcHostRead(char *path, + char *buf, + size_t size, + off_t offset) { int fd; int res; @@ -131,8 +140,12 @@ static int lxcProcHostRead(char *path, char *buf, size= _t size, off_t offset) return res; } =20 -static int lxcProcReadMeminfo(char *hostpath, virDomainDef *def, - char *buf, size_t size, off_t offset) +static int +lxcProcReadMeminfo(char *hostpath, + virDomainDef *def, + char *buf, + size_t size, + off_t offset) { int res; FILE *fd =3D NULL; @@ -242,11 +255,12 @@ static int lxcProcReadMeminfo(char *hostpath, virDoma= inDef *def, return res; } =20 -static int lxcProcRead(const char *path, - char *buf, - size_t size, - off_t offset, - struct fuse_file_info *fi G_GNUC_UNUSED) +static int +lxcProcRead(const char *path, + char *buf, + size_t size, + off_t offset, + struct fuse_file_info *fi G_GNUC_UNUSED) { int res =3D -ENOENT; g_autofree char *hostpath =3D NULL; @@ -273,7 +287,8 @@ static struct fuse_operations lxcProcOper =3D { .read =3D lxcProcRead, }; =20 -static void lxcFuseDestroy(struct virLXCFuse *fuse) +static void +lxcFuseDestroy(struct virLXCFuse *fuse) { VIR_LOCK_GUARD lock =3D virLockGuardLock(&fuse->lock); =20 @@ -281,7 +296,8 @@ static void lxcFuseDestroy(struct virLXCFuse *fuse) g_clear_pointer(&fuse->fuse, fuse_destroy); } =20 -static void lxcFuseRun(void *opaque) +static void +lxcFuseRun(void *opaque) { struct virLXCFuse *fuse =3D opaque; =20 @@ -292,7 +308,9 @@ static void lxcFuseRun(void *opaque) lxcFuseDestroy(fuse); } =20 -int lxcSetupFuse(struct virLXCFuse **f, virDomainDef *def) +int +lxcSetupFuse(struct virLXCFuse **f, + virDomainDef *def) { int ret =3D -1; struct fuse_args args =3D FUSE_ARGS_INIT(0, NULL); @@ -342,7 +360,8 @@ int lxcSetupFuse(struct virLXCFuse **f, virDomainDef *d= ef) goto cleanup; } =20 -int lxcStartFuse(struct virLXCFuse *fuse) +int +lxcStartFuse(struct virLXCFuse *fuse) { if (virThreadCreateFull(&fuse->thread, false, lxcFuseRun, "lxc-fuse", false, (void *)fuse) < 0) { @@ -353,7 +372,8 @@ int lxcStartFuse(struct virLXCFuse *fuse) return 0; } =20 -void lxcFreeFuse(struct virLXCFuse **f) +void +lxcFreeFuse(struct virLXCFuse **f) { struct virLXCFuse *fuse =3D *f; /* lxcFuseRun thread create success */ @@ -370,18 +390,21 @@ void lxcFreeFuse(struct virLXCFuse **f) } } #else -int lxcSetupFuse(struct virLXCFuse **f G_GNUC_UNUSED, - virDomainDef *def G_GNUC_UNUSED) +int +lxcSetupFuse(struct virLXCFuse **f G_GNUC_UNUSED, + virDomainDef *def G_GNUC_UNUSED) { return 0; } =20 -int lxcStartFuse(struct virLXCFuse *f G_GNUC_UNUSED) +int +lxcStartFuse(struct virLXCFuse *f G_GNUC_UNUSED) { return 0; } =20 -void lxcFreeFuse(struct virLXCFuse **f G_GNUC_UNUSED) +void +lxcFreeFuse(struct virLXCFuse **f G_GNUC_UNUSED) { } #endif --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643685; cv=none; d=zohomail.com; s=zohoarc; b=f9ctpvRr+rpx3m+r8O6aJ6HTRiKJbg+CfSpN3p/j4PPNgWImGqDpco+qSkMIRGDniiGkQEHIogS+6txbwwlxvjjoXwS4WVwQGFJ4lG2ww73c5YhVuFPD1VQG6qJBdPz+Ho3rv/TFtfcpZdi13sIPqxlRHdJPumkc/nItVFEFOjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643685; 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=6b58A/FQA6TIpkr/2Ud3WTi0td6NnTVmAmKlhCiAJ1I=; b=j8O+tPYn/ZPcf3rVdjzWjTvQQBM48vgFMJsYYn1g9XZUtegy4MTQMcPg3RAKepVutE0LE7/c3DJ11+O/2mMomL4kTiztrJpIC5iAdR0GY5KZFiQjtMKqrpFp4b/+gpX/g0Vc/kuyPmkYrgGYhX0MxLvMcf3FCOm7cP2JKE84/aU= 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 1646643685669571.5096926020101; Mon, 7 Mar 2022 01:01:25 -0800 (PST) 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-259-uctjnOgxMzaX47tYpzFsMQ-1; Mon, 07 Mar 2022 04:01:20 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03F1E3C11C63; Mon, 7 Mar 2022 09:01:18 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E135356D18E; Mon, 7 Mar 2022 09:01:17 +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 C056A1931BDE; Mon, 7 Mar 2022 09:01:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E96D1931BD5 for ; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D488F1F473; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58F8E1FD88 for ; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643684; 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=6b58A/FQA6TIpkr/2Ud3WTi0td6NnTVmAmKlhCiAJ1I=; b=BzzLKFtMRsaYkJrMBs8IJkfLLL/pb8Z1EXiV5iCMwwYPd9WpEEv9V8Qci2ZiQETKYbtd+Q k/GAJK4pDVe83TXF7rJ80LeP9LklMqWZjjUNtES+BW1DFqgy4522hD8g3E2o8MImP/m3aO SOIhwP8pMePlmImDsCjMXFOP63innmY= X-MC-Unique: uctjnOgxMzaX47tYpzFsMQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 07/17] lxc_fuse: Prefer O_ACCMODE instead of & 3 Date: Mon, 7 Mar 2022 10:00:57 +0100 Message-Id: <8d8c4afa1df1d688eb7f75e239ac1fda60e2ca24.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643687698100009 Content-Type: text/plain; charset="utf-8" In lxcProcOpen() we want to check whether the /proc/memfile is being opened only for read. For that we check the fi->flags which correspond to flags open() call. Instead of explicitly masking the last two bits use O_ACCMODE constant, which is deemed to be more portable. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b6b653e8cd..683d01525f 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -114,7 +114,7 @@ lxcProcOpen(const char *path, if (STRNEQ(path, fuse_meminfo_path)) return -ENOENT; =20 - if ((fi->flags & 3) !=3D O_RDONLY) + if ((fi->flags & O_ACCMODE) !=3D O_RDONLY) return -EACCES; =20 return 0; --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643726; cv=none; d=zohomail.com; s=zohoarc; b=mUP+1q4vzrMqKKoBxIk357I78yT+ZZ2wLzJPimZe8vQyI+5h0N5c3g59LgpnhG+98Pk5hbTqSJ+13kTv98NGTF+fG6UUafPfPVmUV7TWnuowMnpOnI4n/3voGdV8e7/LQEKMTcjq2tZKtBJO00Nx2k1XPbUUxSo+RkY5A6RWLwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643726; 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=sn3ARB0jfteuwXxisn2lJFdnuelKsCoqPbgaUekdEz0=; b=IYDnU8iIH0cqITSRVJIDZ+XFChMCMpUdOwl0EpQppndexuobcPwH3/fHI5lCxb3QJ6ovaIQHsAuUuUUtM9Qd0OSPLVGFhjj6/5psygnn8rrYp9VATK9p0j9KLeMYFsTtC5z1AKgbfSyfKjy89bUP6lfQurKtQrJ2WSlg7LKKLrM= 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 1646643726393793.5585666448196; Mon, 7 Mar 2022 01:02:06 -0800 (PST) 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-224-kIapZWJePl-Owfv8f-BcuA-1; Mon, 07 Mar 2022 04:01:26 -0500 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 671832999B2B; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50324145FBA3; Mon, 7 Mar 2022 09:01:20 +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 07F381931BFA; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E66F21931BDE for ; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A869A1F470; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EE711F476 for ; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643726; 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=sn3ARB0jfteuwXxisn2lJFdnuelKsCoqPbgaUekdEz0=; b=TQaVjRbeLG07+W7mdQgsup2VFLLhacMD58fC0UB2GYV0z3XNHSRNBr27qoD6HMVRt8fQ90 TuSe8LCmU9w2GW2HgHLzB1hdhoPSfJxBIzxtXheG+fFWWcIvrWsiyd9dsQhqWVslIUfo6H FLjScDJBvID56kfPM8NHNyXCezc0BgI= X-MC-Unique: kIapZWJePl-Owfv8f-BcuA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 08/17] lxcSetupFuse: Cleanup error paths Date: Mon, 7 Mar 2022 10:00:58 +0100 Message-Id: <5072c9a300e68cc550b34f0d83aed321e95431fb.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643727996100003 Content-Type: text/plain; charset="utf-8" In the lxcSetupFuse() function there are multiple cleanup labels, but with a bit of rewrite they can be joined into one 'error' label. And while at it, set the @f argument only in the successful path (currently is set in error case too). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 683d01525f..274702736f 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -314,19 +314,19 @@ lxcSetupFuse(struct virLXCFuse **f, { int ret =3D -1; struct fuse_args args =3D FUSE_ARGS_INIT(0, NULL); - struct virLXCFuse *fuse =3D g_new0(virLXCFuse, 1); + g_autofree struct virLXCFuse *fuse =3D g_new0(virLXCFuse, 1); =20 fuse->def =3D def; =20 if (virMutexInit(&fuse->lock) < 0) - goto cleanup2; + return -1; =20 fuse->mountpoint =3D g_strdup_printf("%s/%s.fuse/", LXC_STATE_DIR, def= ->name); =20 if (g_mkdir_with_parents(fuse->mountpoint, 0777) < 0) { virReportSystemError(errno, _("Cannot create %s"), fuse->mountpoint); - goto cleanup1; + goto error; } =20 /* process name is libvirt_lxc */ @@ -334,29 +334,29 @@ lxcSetupFuse(struct virLXCFuse **f, fuse_opt_add_arg(&args, "-odirect_io") =3D=3D -1 || fuse_opt_add_arg(&args, "-oallow_other") =3D=3D -1 || fuse_opt_add_arg(&args, "-ofsname=3Dlibvirt") =3D=3D -1) - goto cleanup1; + goto error; =20 fuse->ch =3D fuse_mount(fuse->mountpoint, &args); if (fuse->ch =3D=3D NULL) - goto cleanup1; + goto error; =20 fuse->fuse =3D fuse_new(fuse->ch, &args, &lxcProcOper, sizeof(lxcProcOper), fuse->def); if (fuse->fuse =3D=3D NULL) { - fuse_unmount(fuse->mountpoint, fuse->ch); - goto cleanup1; + goto error; } =20 + *f =3D g_steal_pointer(&fuse); ret =3D 0; cleanup: fuse_opt_free_args(&args); - *f =3D fuse; return ret; - cleanup1: + + error: + if (fuse->ch) + fuse_unmount(fuse->mountpoint, fuse->ch); g_free(fuse->mountpoint); virMutexDestroy(&fuse->lock); - cleanup2: - g_free(fuse); goto cleanup; } =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643692; cv=none; d=zohomail.com; s=zohoarc; b=Oq1HJGiWHtz+630NrNhzbWXbCkK53+rRQVk+AFEPF42qDQyR/JHx+e3UENacpXl13sZx8o4fyCh97lkeO60ItVAkov2TKKWq1nuVE/XxXjnaDOyd4pkCIoHxaOva5GzcNPm9gF5wUy1qFdQJLXBTMSJPic3kJK9r31eH1fkzNJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643692; 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=bxWXo7C7N5UL8nGhUH0SYlVUsoV5NzI5Cf+ZS4ofcSU=; b=UyKFhdzs1mSUXMet04GcAY0VyutHAuVsKxmvJob4hsl9HkX5RF1RlmU+qEoRH3nYqRJMgVxd5robsGEhDykBTA7WojIyKht3F7/w2vFQ2NEa+ccGlAkGBRmBwS3Jw6o9+yKj9xURWc5FsexFPFdBrshHpjVc+o1kXOVRE2ZY6ZE= 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 1646643692147112.95062219437693; Mon, 7 Mar 2022 01:01:32 -0800 (PST) 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-602-dQf49eIsO0i8843jC5ynTw-1; Mon, 07 Mar 2022 04:01:23 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0CC091C07826; Mon, 7 Mar 2022 09:01:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC106C07F51; Mon, 7 Mar 2022 09:01:18 +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 BB6431931BD7; Mon, 7 Mar 2022 09:01:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ACE871931BD5 for ; Mon, 7 Mar 2022 09:01:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7F9681F473; Mon, 7 Mar 2022 09:01:17 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 056101F470 for ; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643692; 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=bxWXo7C7N5UL8nGhUH0SYlVUsoV5NzI5Cf+ZS4ofcSU=; b=jUzQ0AW985cwSsNPrNNEN2WKeThJvhNUuzplnAfJDo32OjQn5ZE1CmMijA3GgFGadXzATs d9rasfsDJhRSvivvHAqoayv28MxqxaZnsQhAmfKajIWgVlqScxP4YGMHexlgQyd5c393ZQ knxS/LkJS+E2n256QnY/LMPDM1Z8DAM= X-MC-Unique: dQf49eIsO0i8843jC5ynTw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 09/17] lxcProcReadMeminfo: Rename @fd to @fp Date: Mon, 7 Mar 2022 10:00:59 +0100 Message-Id: <28498ec76b6f469a823eea71c34b47574665a079.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643693783100005 Content-Type: text/plain; charset="utf-8" In lxcProcReadMeminfo() there's a variable named @fd which would suggest it's type of int, but in fact it's type of FILE *. Rename it to @fp to avoid confusion. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 274702736f..9eff188d5f 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -148,7 +148,7 @@ lxcProcReadMeminfo(char *hostpath, off_t offset) { int res; - FILE *fd =3D NULL; + FILE *fp =3D NULL; g_autofree char *line =3D NULL; size_t n; struct virLXCMeminfo meminfo; @@ -160,21 +160,21 @@ lxcProcReadMeminfo(char *hostpath, return -errno; } =20 - fd =3D fopen(hostpath, "r"); - if (fd =3D=3D NULL) { + fp =3D fopen(hostpath, "r"); + if (fp =3D=3D NULL) { virReportSystemError(errno, _("Cannot open %s"), hostpath); res =3D -errno; goto cleanup; } =20 - if (fseek(fd, offset, SEEK_SET) < 0) { + if (fseek(fp, offset, SEEK_SET) < 0) { virReportSystemError(errno, "%s", _("fseek failed")); res =3D -errno; goto cleanup; } =20 res =3D -1; - while (getline(&line, &n, fd) > 0) { + while (getline(&line, &n, fp) > 0) { char *ptr =3D strchr(line, ':'); if (!ptr) continue; @@ -251,7 +251,7 @@ lxcProcReadMeminfo(char *hostpath, memcpy(buf, virBufferCurrentContent(new_meminfo), res); =20 cleanup: - VIR_FORCE_FCLOSE(fd); + VIR_FORCE_FCLOSE(fp); return res; } =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643690; cv=none; d=zohomail.com; s=zohoarc; b=WWfIW3+nENXhhW1A96MG/GLwVGH10By1bx09ZEOj48qVQUOaHANzhwLttNpl2bLDLskBR/cQKIyazQMHa4E/B5Xac2hbPyWwFiHnd5j3Ppjr/MbAZEbyHlTCZUlS/Ja7xShb27u1R7+ak1E2ESlLcF3xQEWENcdRjaPT3SExPX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643690; 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=sUTz09VaaByxZbhAWBbdMM5zgDPCnVBGAj3h6d7DITM=; b=ZKD6tumXmpLnptdnFLr7ytqd8dNn0XwYXCHfgYvOquqHGYIYrRYUtouR43VJh6suYwGCmEYQhNwkFODluhRPg8DBkhVTTsZmQNiy4k2DIzYeySKQSSxbKC9z/ey1Z0txbcQuMa5N/3yX9A+qSUE+nd2zVlSCtZcSlwsTZxGYWEU= 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 164664369024898.95943438111362; Mon, 7 Mar 2022 01:01:30 -0800 (PST) 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-488-EgzskPuNOeuRB2U1yCaprQ-1; Mon, 07 Mar 2022 04:01:24 -0500 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 E02711066697; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C24D8145FBB4; Mon, 7 Mar 2022 09:01:20 +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 5AB49193058F; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 83BF41931BD1 for ; Mon, 7 Mar 2022 09:01:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5410A1F470; Mon, 7 Mar 2022 09:01:18 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE9FE1F473 for ; Mon, 7 Mar 2022 09:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643689; 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=sUTz09VaaByxZbhAWBbdMM5zgDPCnVBGAj3h6d7DITM=; b=ii2APyAYEmPNz2mOAt0wAOqgnp2dMF5FbFndFCpj8lWUhZ6nVYg1Vncra/x9gppoo52Krw hQRGrWDHCqmBt3k6e6Fsjs4tGG80UPAeayQeJ8v71OaE4Kk+bqK7rX0zLmhd0oiv8jd2hb Zb+EDjg+4X34tUWV8BsVz6jJWKDezLA= X-MC-Unique: EgzskPuNOeuRB2U1yCaprQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 10/17] lxc_fuse: Use automatic file closing Date: Mon, 7 Mar 2022 10:01:00 +0100 Message-Id: <447a7af4a3737a0e767e8dcee74e63487db4ee94.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643691730100003 Content-Type: text/plain; charset="utf-8" There are two functions (lxcProcHostRead() and lxcProcReadMeminfo()) that could benefit from automatic file closing. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 9eff188d5f..1dedbc4069 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -126,7 +126,7 @@ lxcProcHostRead(char *path, size_t size, off_t offset) { - int fd; + VIR_AUTOCLOSE fd =3D -1; int res; =20 fd =3D open(path, O_RDONLY); @@ -136,7 +136,6 @@ lxcProcHostRead(char *path, if ((res =3D pread(fd, buf, size, offset)) < 0) res =3D -errno; =20 - VIR_FORCE_CLOSE(fd); return res; } =20 @@ -148,7 +147,7 @@ lxcProcReadMeminfo(char *hostpath, off_t offset) { int res; - FILE *fp =3D NULL; + g_autoptr(FILE) fp =3D NULL; g_autofree char *line =3D NULL; size_t n; struct virLXCMeminfo meminfo; @@ -251,7 +250,6 @@ lxcProcReadMeminfo(char *hostpath, memcpy(buf, virBufferCurrentContent(new_meminfo), res); =20 cleanup: - VIR_FORCE_FCLOSE(fp); return res; } =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643728; cv=none; d=zohomail.com; s=zohoarc; b=OdwMFW9T/7jwt6/WhLt05buGKK/cXRKMF9xRuhfuXoSFshetxpJe5pf2aQBr+9F7rnmvWRZGU2qIRAr9+9oFv05TJaFTTmddfEiEzIPpc1TsXXrfPme3JzffEKrpbpoU7bbkBcg65cqnSYByVWIlNw+m8tIpuja9azQknbRAKZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643728; 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=vLb8OHdjjHWuohpuqeX8h25sIpweDkkArmRlcXLHC80=; b=HSyrHCGfzQimwAXcItHrqO18/RtPaPGmWmUC/h9qPqJABF+wsz6tXUdJwIomZt2IzFVjBBXZqHe5vnFAFdRCVBHBMiaeq3yQB0191EZ1FPl7yq20Bnv2xKH+gKpTBuOAm6dPtujXEAX8VxIsoG8V2IjGWXCOgbu+9HYjg++1hY4= 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 1646643728600818.9228274249525; Mon, 7 Mar 2022 01:02:08 -0800 (PST) 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-435-Rm1uCMLHMcq71FHJtmgszg-1; Mon, 07 Mar 2022 04:01:25 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3837858EEC; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A43FAC080A0; Mon, 7 Mar 2022 09:01:20 +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 3EADA1930588; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 59F391931BD7 for ; Mon, 7 Mar 2022 09:01:19 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2A5791F473; Mon, 7 Mar 2022 09:01:19 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id A48E31F470 for ; Mon, 7 Mar 2022 09:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643727; 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=vLb8OHdjjHWuohpuqeX8h25sIpweDkkArmRlcXLHC80=; b=VWxfAec9b7QBpoeLDqiM4H1H4J/19LXfpTMZ6qqlet5k/G6xH3cYpKlvqrX59NjzYKEi6/ Qs1YKnl8XOMKpq6qKoQotvLikvHfzQ6oBdYVGwFTlZQrxV4m/1oSWH+yaSzajl7zFpqE2e wUQmxrldkQ1SVPT5TFVtFIEi/pANxIA= X-MC-Unique: Rm1uCMLHMcq71FHJtmgszg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 11/17] lxcProcReadMeminfo: Drop needless label Date: Mon, 7 Mar 2022 10:01:01 +0100 Message-Id: <3b46512c11202bed77ba9652ac740a529c099502.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643730021100005 Content-Type: text/plain; charset="utf-8" After previous cleanups, the cleanup label is no longer needed and can be removed. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 1dedbc4069..7c435803e9 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -162,14 +162,12 @@ lxcProcReadMeminfo(char *hostpath, fp =3D fopen(hostpath, "r"); if (fp =3D=3D NULL) { virReportSystemError(errno, _("Cannot open %s"), hostpath); - res =3D -errno; - goto cleanup; + return -errno; } =20 if (fseek(fp, offset, SEEK_SET) < 0) { virReportSystemError(errno, "%s", _("fseek failed")); - res =3D -errno; - goto cleanup; + return -errno; } =20 res =3D -1; @@ -249,7 +247,6 @@ lxcProcReadMeminfo(char *hostpath, res =3D size; memcpy(buf, virBufferCurrentContent(new_meminfo), res); =20 - cleanup: return res; } =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643725; cv=none; d=zohomail.com; s=zohoarc; b=eHM7jwbfbAzFXuMjaPtqg1kKi1dTDQmo6WqkwPOq3ZnvwZaTtkbPKv87PyjOcx3yG1fnEyi4KzU4VGU1QTImjYdemsOV5C4p30BX4dt/BNwTSAr9o6q18n98kxV6MBnQ7SI70FXhyhJYF/Sm7Dpi8xhWgjfigWDIKDfVx8IG5+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643725; 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=rntk2ZMIN1e+4GlIVDNAfmGOHdGoss+TgzF+zcgUz6c=; b=n5pCudcjzBpBu/KHof8reRIs1jjzR6MDeNHaO2LWgxRsHwkH/t5N/X9PEtAxwckzpFmL+NCwZotXluZZQ1CCTOp0YQYFM9KZ/x0oX5pyzous1mRTM9Yqwa0Ea3U29yn64/9sRDmgHha+b/6jNdKOYjXkJhuiuXjK9jOS1/EEsms= 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 1646643725683274.82522042420953; Mon, 7 Mar 2022 01:02:05 -0800 (PST) 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-516-oBHzrSI3NruwbaYJlTVGOg-1; Mon, 07 Mar 2022 04:01:28 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F90C3803531; Mon, 7 Mar 2022 09:01:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE487C0809D; Mon, 7 Mar 2022 09:01:21 +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 C8C0F1931BDD; Mon, 7 Mar 2022 09:01:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 44F30193058A for ; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 001211F473; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AE751F470 for ; Mon, 7 Mar 2022 09:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643724; 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=rntk2ZMIN1e+4GlIVDNAfmGOHdGoss+TgzF+zcgUz6c=; b=I4234j+2O+Ud+wMfRw6F8PdCv94Tyd/YroM+NEnajZ/pzuEHBaCAzP1lmR/OBaLWYDqLKw E+m4+KypqpWVZSd4AhtyGA9l+h/tCea8OCtlNJgX8vO8kLLsWwmCRwR8YgziV5dpcOAyUR sR/t5VKhvjb0XNiakijJ+SH3zBHP7G8= X-MC-Unique: oBHzrSI3NruwbaYJlTVGOg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 12/17] lxcProcReadMeminfo: Drop @new_meminfo variable Date: Mon, 7 Mar 2022 10:01:02 +0100 Message-Id: <38c633d595d6e01f5a826bb0c7501ec89865c72e.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643725986100001 Content-Type: text/plain; charset="utf-8" In the lxcProcReadMeminfo() function we have @buffer variable which is statically allocated and then @new_meminfo which is just a pointer to the @buffer. This is needless, the @buffer can be accessed directly. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 7c435803e9..537e16c380 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -152,7 +152,6 @@ lxcProcReadMeminfo(char *hostpath, size_t n; struct virLXCMeminfo meminfo; g_auto(virBuffer) buffer =3D VIR_BUFFER_INITIALIZER; - virBuffer *new_meminfo =3D &buffer; =20 if (virLXCCgroupGetMeminfo(&meminfo) < 0) { virErrorSetErrnoFromLastError(); @@ -180,12 +179,12 @@ lxcProcReadMeminfo(char *hostpath, if (STREQ(line, "MemTotal") && (virMemoryLimitIsSet(def->mem.hard_limit) || virDomainDefGetMemoryTotal(def))) { - virBufferAsprintf(new_meminfo, "MemTotal: %8llu kB\n", + virBufferAsprintf(&buffer, "MemTotal: %8llu kB\n", meminfo.memtotal); } else if (STREQ(line, "MemFree") && (virMemoryLimitIsSet(def->mem.hard_limit) || virDomainDefGetMemoryTotal(def))) { - virBufferAsprintf(new_meminfo, "MemFree: %8llu kB\n", + virBufferAsprintf(&buffer, "MemFree: %8llu kB\n", (meminfo.memtotal - meminfo.memusage)); } else if (STREQ(line, "MemAvailable") && (virMemoryLimitIsSet(def->mem.hard_limit) || @@ -193,59 +192,59 @@ lxcProcReadMeminfo(char *hostpath, /* MemAvailable is actually MemFree + SRReclaimable + some other bits, but MemFree is the closest approximation we have */ - virBufferAsprintf(new_meminfo, "MemAvailable: %8llu kB\n", + virBufferAsprintf(&buffer, "MemAvailable: %8llu kB\n", (meminfo.memtotal - meminfo.memusage)); } else if (STREQ(line, "Buffers")) { - virBufferAsprintf(new_meminfo, "Buffers: %8d kB\n", 0); + virBufferAsprintf(&buffer, "Buffers: %8d kB\n", 0); } else if (STREQ(line, "Cached")) { - virBufferAsprintf(new_meminfo, "Cached: %8llu kB\n", + virBufferAsprintf(&buffer, "Cached: %8llu kB\n", meminfo.cached); } else if (STREQ(line, "Active")) { - virBufferAsprintf(new_meminfo, "Active: %8llu kB\n", + virBufferAsprintf(&buffer, "Active: %8llu kB\n", (meminfo.active_anon + meminfo.active_file)); } else if (STREQ(line, "Inactive")) { - virBufferAsprintf(new_meminfo, "Inactive: %8llu kB\n", + virBufferAsprintf(&buffer, "Inactive: %8llu kB\n", (meminfo.inactive_anon + meminfo.inactive_fi= le)); } else if (STREQ(line, "Active(anon)")) { - virBufferAsprintf(new_meminfo, "Active(anon): %8llu kB\n", + virBufferAsprintf(&buffer, "Active(anon): %8llu kB\n", meminfo.active_anon); } else if (STREQ(line, "Inactive(anon)")) { - virBufferAsprintf(new_meminfo, "Inactive(anon): %8llu kB\n", + virBufferAsprintf(&buffer, "Inactive(anon): %8llu kB\n", meminfo.inactive_anon); } else if (STREQ(line, "Active(file)")) { - virBufferAsprintf(new_meminfo, "Active(file): %8llu kB\n", + virBufferAsprintf(&buffer, "Active(file): %8llu kB\n", meminfo.active_file); } else if (STREQ(line, "Inactive(file)")) { - virBufferAsprintf(new_meminfo, "Inactive(file): %8llu kB\n", + virBufferAsprintf(&buffer, "Inactive(file): %8llu kB\n", meminfo.inactive_file); } else if (STREQ(line, "Unevictable")) { - virBufferAsprintf(new_meminfo, "Unevictable: %8llu kB\n", + virBufferAsprintf(&buffer, "Unevictable: %8llu kB\n", meminfo.unevictable); } else if (STREQ(line, "SwapTotal") && virMemoryLimitIsSet(def->mem.swap_hard_limit)) { - virBufferAsprintf(new_meminfo, "SwapTotal: %8llu kB\n", + virBufferAsprintf(&buffer, "SwapTotal: %8llu kB\n", (meminfo.swaptotal - meminfo.memtotal)); } else if (STREQ(line, "SwapFree") && virMemoryLimitIsSet(def->mem.swap_hard_limit)) { - virBufferAsprintf(new_meminfo, "SwapFree: %8llu kB\n", + virBufferAsprintf(&buffer, "SwapFree: %8llu kB\n", (meminfo.swaptotal - meminfo.memtotal - meminfo.swapusage + meminfo.memusage)); } else if (STREQ(line, "Slab")) { - virBufferAsprintf(new_meminfo, "Slab: %8d kB\n", 0); + virBufferAsprintf(&buffer, "Slab: %8d kB\n", 0); } else if (STREQ(line, "SReclaimable")) { - virBufferAsprintf(new_meminfo, "SReclaimable: %8d kB\n", 0); + virBufferAsprintf(&buffer, "SReclaimable: %8d kB\n", 0); } else if (STREQ(line, "SUnreclaim")) { - virBufferAsprintf(new_meminfo, "SUnreclaim: %8d kB\n", 0); + virBufferAsprintf(&buffer, "SUnreclaim: %8d kB\n", 0); } else { *ptr =3D ':'; - virBufferAdd(new_meminfo, line, -1); + virBufferAdd(&buffer, line, -1); } =20 } - res =3D strlen(virBufferCurrentContent(new_meminfo)); + res =3D strlen(virBufferCurrentContent(&buffer)); if (res > size) res =3D size; - memcpy(buf, virBufferCurrentContent(new_meminfo), res); + memcpy(buf, virBufferCurrentContent(&buffer), res); =20 return res; } --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643692; cv=none; d=zohomail.com; s=zohoarc; b=HX8Y9fRErSeizR7AqPhnut8P5gX7ObOrOWy3I9ewh2/Zb0bYPWhxxOWpu4h4p8zWDwyq5+FPYfgiXEilnuqg0imEC0YXjHbIRRPLaGrl5cjjjXN+sYkegnYjzFjm40r7ZzSc74Dz2iNtRojKdhD43xo6csIvF58BX4suzSD0omQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643692; 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=2+6nz97Kqi3u68LU2V1d0pvs/sZ/OPX+XzPaJjM69Eg=; b=GKXbUa7viIO1bvHEQj2qyy7qdi3xo57OBV8cq2K9SPzduxmwAscFg0D+Crgmlp/SZ2poxLgPS4uIHjLKyqn14vmWxSekxNYGcDOsRDNCyKNKXRc5GRU4nDJPFHBZ11DgcABPlvdTmMxvFUWBM8Gx6J0XDqTwmMtSijnNSlUDl0U= 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 1646643692638905.4957354226628; Mon, 7 Mar 2022 01:01:32 -0800 (PST) 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-522-VdD_LrV3Ow6dCXgfh0qkXQ-1; Mon, 07 Mar 2022 04:01:29 -0500 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 425973806703; Mon, 7 Mar 2022 09:01:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AE42145FBA0; Mon, 7 Mar 2022 09:01:23 +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 C08431931BD7; Mon, 7 Mar 2022 09:01:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 151A81931BDD for ; Mon, 7 Mar 2022 09:01:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id CA8581F476; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 506F61F470 for ; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643691; 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=2+6nz97Kqi3u68LU2V1d0pvs/sZ/OPX+XzPaJjM69Eg=; b=VVQ19ZnlXLkK+kuJMSDGJ3pvJkFD1yXj4sL8BKIskFZz4L2qZA08BGJ0UMD+kdjLYHOb/+ xMDUtdnX+TB6gNDJu/3g0ocFwcWY+qRcurmRtsxSxXljLfefQHlAWkbSLmmee6n0iE1oMl bN0d1VpSXO2EIQcoSPXaldF5sZ1CeJU= X-MC-Unique: VdD_LrV3Ow6dCXgfh0qkXQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 13/17] lxcProcReadMeminfo: Fix case when @offset != 0 Date: Mon, 7 Mar 2022 10:01:03 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643693806100006 Content-Type: text/plain; charset="utf-8" The idea behind lxcProcReadMeminfo() is that we read the host's /proc/meminfo and copy it line by line producing the content for container, changing only those lines we need. Thus, when a process inside container opens the file and lseek()-s to a different position (or reads the content in small chunks), we mirror the seek in host's /proc/meminfo. But this doesn't work really. We are not guaranteed to end up aligned on the beginning of new line. It's better if we construct the new content and then mimic seeking in it. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 537e16c380..b068d21cf4 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -152,6 +152,7 @@ lxcProcReadMeminfo(char *hostpath, size_t n; struct virLXCMeminfo meminfo; g_auto(virBuffer) buffer =3D VIR_BUFFER_INITIALIZER; + const char *new_meminfo =3D NULL; =20 if (virLXCCgroupGetMeminfo(&meminfo) < 0) { virErrorSetErrnoFromLastError(); @@ -164,11 +165,6 @@ lxcProcReadMeminfo(char *hostpath, return -errno; } =20 - if (fseek(fp, offset, SEEK_SET) < 0) { - virReportSystemError(errno, "%s", _("fseek failed")); - return -errno; - } - res =3D -1; while (getline(&line, &n, fp) > 0) { char *ptr =3D strchr(line, ':'); @@ -241,10 +237,18 @@ lxcProcReadMeminfo(char *hostpath, } =20 } - res =3D strlen(virBufferCurrentContent(&buffer)); + + new_meminfo =3D virBufferCurrentContent(&buffer); + res =3D virBufferUse(&buffer); + + if (offset > res) + return 0; + + res -=3D offset; + if (res > size) res =3D size; - memcpy(buf, virBufferCurrentContent(&buffer), res); + memcpy(buf, new_meminfo + offset, res); =20 return res; } --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643733; cv=none; d=zohomail.com; s=zohoarc; b=l8aylgcv844RgdK3iPHILU8edoLr9ysXnb1Ul8854YNOa0yloFV1OnDDhR7LLsN185TkcNyndOJEsgvGuHduyVMHLAhrSBgRGiPwn59Z51Zygil0QHFIHQOQtEu1HrJLzAWZV4c11NJL4IuaXqO0QC78YGgff31HRWzlkULwepM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643733; 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=j5gXxV0Jrolfb52KEe1k5nQJK0UtVTytD7cRVNYFLKU=; b=NzLakAVKL2ydGSNDvpQMpSD9K2wo656SLdAna9Ljddoe6DBweoOfuTkTtvRyGsXS9/kb546H9T8DTrZNA3t8+pQVqEX5b7k0AzCfBoxjAdYYBY0Syzq4mvPmSWdIaOf3Ct1buawyGLEsop38XL8u6lb8i4nwPM9IU50d5nQcudI= 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 1646643733678362.9302925925532; Mon, 7 Mar 2022 01:02:13 -0800 (PST) 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-8-oJUICJXwNKqk6OxPWTUOIA-1; Mon, 07 Mar 2022 04:01:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BCF072A59562; Mon, 7 Mar 2022 09:01:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BC77C0809D; Mon, 7 Mar 2022 09:01:23 +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 3A990193058B; Mon, 7 Mar 2022 09:01:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CD7E81931BFA for ; Mon, 7 Mar 2022 09:01:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A0E811F473; Mon, 7 Mar 2022 09:01:21 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 273981F470 for ; Mon, 7 Mar 2022 09:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643733; 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=j5gXxV0Jrolfb52KEe1k5nQJK0UtVTytD7cRVNYFLKU=; b=MDL7YY9U750Ga2Ky7DCN9dlr1qty6MAueWVNNuexJ53ASl6t6oE+bV9QbhQmOja61H15Wc kVt/LWcXwJpUocgK5mcDuhlOQu8W5DH5lOqtUAOkH8fkZPmf49CU6nySD83BUlj2L55fdj /cZvb2Fzo4KigSLQ7X0lLkjRj6RcboM= X-MC-Unique: oJUICJXwNKqk6OxPWTUOIA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 14/17] lxc_fuse: Prefer fuse_file_info::direct_io over mount option Date: Mon, 7 Mar 2022 10:01:04 +0100 Message-Id: <0d315f72736ecec18051971933f52fbea60f1b1d.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643751091100001 Content-Type: text/plain; charset="utf-8" When mounting a FUSE it is possible to bypass kernel cache by specifying -odirect_io mount option. This is what we currently do. However, FUSEv3 has a different approach - the open callback (lxcProcOpen() in our case) can set direct_io member of fuse_file_info struct. This results in the same behaviour, but also works with both FUSEv1 and FUSEv3. The latter does not have the mount option and uses per file approach. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b068d21cf4..73d3ab1015 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -117,6 +117,7 @@ lxcProcOpen(const char *path, if ((fi->flags & O_ACCMODE) !=3D O_RDONLY) return -EACCES; =20 + fi->direct_io =3D 1; return 0; } =20 @@ -329,7 +330,6 @@ lxcSetupFuse(struct virLXCFuse **f, =20 /* process name is libvirt_lxc */ if (fuse_opt_add_arg(&args, "libvirt_lxc") =3D=3D -1 || - fuse_opt_add_arg(&args, "-odirect_io") =3D=3D -1 || fuse_opt_add_arg(&args, "-oallow_other") =3D=3D -1 || fuse_opt_add_arg(&args, "-ofsname=3Dlibvirt") =3D=3D -1) goto error; --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643734; cv=none; d=zohomail.com; s=zohoarc; b=FOd9nrE2H8ax6cPNxwOqhi/7uEXnfPMdhgLhYdMKeLbCYV6DZdF93A64LHtYcd7xZZezdZ8cIu0SaeMqvBozKQcS6+0kutQnDz6qSCOrek3vSpZvJStJ0kKo2umn992QqH9f7UtZbHJuDMiWNadsWTrZyhPlEp1alQpSOXG1+RA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643734; 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=rNqWR2P7Pa3AkPY4/kMfYu8GdSa7K/YK40GQLzWChzY=; b=mG0KUGJtlKOWW3Kgx8vvCZGSQa5lSx9wJ4XW3c20gq0tQV5R0APIZm1Mhu8sNzEoIWvjCEFXqqTT5bB94k5WgKimDcWDe6gfFPYEBB0lGu7PFnOZRlCHe/xLX5ybv8Q9/ZpSBKZrQXIpvHWraSR+bPPRizH2nTuNFHeNLu9c9lo= 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 1646643734580419.79104194312424; Mon, 7 Mar 2022 01:02:14 -0800 (PST) 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-184-okvoy0voPpGUOt6zfr4ynw-1; Mon, 07 Mar 2022 04:01:29 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9A05802815; Mon, 7 Mar 2022 09:01:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6B8356D18E; Mon, 7 Mar 2022 09:01:24 +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 A6D6E1931BD5; Mon, 7 Mar 2022 09:01:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AD1621931BFC for ; Mon, 7 Mar 2022 09:01:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 76C1D1F470; Mon, 7 Mar 2022 09:01:22 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id F103D1F473 for ; Mon, 7 Mar 2022 09:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643733; 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=rNqWR2P7Pa3AkPY4/kMfYu8GdSa7K/YK40GQLzWChzY=; b=O63/D66ns6MlMtu36kPQ78h+HOnrR9YfX1/XMw8Pft7UNJ/l+2P/WhPr1pJGNaJ+AJ8bBl 966PqYwdi7YGvSYpIDdLeiSxG8849AGcHzjVxbp3/SWIMiqIKvjDQ7Ya8SNG7qtTeHKuFX hSasqC4UKwk4SjiCv2ruNX81BzIxxe8= X-MC-Unique: okvoy0voPpGUOt6zfr4ynw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 15/17] lxc_fuse: Tell FUSE that /proc/meminfo is nonseekable Date: Mon, 7 Mar 2022 10:01:05 +0100 Message-Id: <6051c11a1a4506d43bccfcd9fbafc53ec2e9d782.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643736029100001 Content-Type: text/plain; charset="utf-8" If an app within a container wishes to read from /proc/meminfo from a different position than the beginning of the file, we can have FUSE keep track of all the lseek()-s and reflect them in @offset argument of read callback (lxcProcRead()). This is done by setting fuse_file_info::nonseekable. If we don't do this, then FUSE reports errors back the app that does lseek(). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 73d3ab1015..181b05b605 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -118,6 +118,7 @@ lxcProcOpen(const char *path, return -EACCES; =20 fi->direct_io =3D 1; + fi->nonseekable =3D 1; return 0; } =20 --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643693; cv=none; d=zohomail.com; s=zohoarc; b=jbF3PQhqqXnHajVTr/FktFNNZti/wzO5qTJOXq8e9LlDsaoT6YjMXCYgFxpBVzM0ygh5/mUcnJqd318p0SppHz/b1fkcLHjX4GLVNThhBu0kO5l0qg6Zjce82rfIkTgYx6FpHUYNClUvp5ERijd8YvtggcJNN4LZQMdtxyCtXQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643693; 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=7bNLPk5R3lmSfg6oFuLzTUKWEWuQKOWJ271Gn7su1ok=; b=QPyjgtkS1q/8Nx0Ez9ohV9VSiRGAJVM0Kp+sl1huFGNCfYLV+opSjIgCjRTYhDkjQvXvZBr5v5vn2d76nOqzVvo0FtOBvr/D1WAWaG17+NN8IUyIv9Uxybjc5HqYynbpHQHzLMc9v2nvCVxEDESWdhUfeqGirK16OH8OAZxy+6c= 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 1646643693694903.176545854953; Mon, 7 Mar 2022 01:01:33 -0800 (PST) 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-231-5lI8Kpt_OmKfqCziTbvvog-1; Mon, 07 Mar 2022 04:01:29 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AAF3983395B; Mon, 7 Mar 2022 09:01:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97218401E40; Mon, 7 Mar 2022 09:01:24 +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 421601931BDD; Mon, 7 Mar 2022 09:01:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D3AB1931BF4 for ; Mon, 7 Mar 2022 09:01:23 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5007A1F473; Mon, 7 Mar 2022 09:01:23 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6FBD1F470 for ; Mon, 7 Mar 2022 09:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643692; 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=7bNLPk5R3lmSfg6oFuLzTUKWEWuQKOWJ271Gn7su1ok=; b=QO2RD1bccar3T31SWtxHgJFljvqdsTgK581/eBlxUYzk+PJtx3HVQmpF9WZ6qsHSVXEsT3 Da7v1V2PiQNRoYStplafNmYZmkygpFA3x13XX6szeqtOt9qCa9El8iwbfaMJ+ntJjAYsIb WO7l6JDFuiaFfAUGZBzCe+h9xvv++Ho= X-MC-Unique: 5lI8Kpt_OmKfqCziTbvvog-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 16/17] lxc_fuse: Implement support for FUSE3 Date: Mon, 7 Mar 2022 10:01:06 +0100 Message-Id: <48c7cdbc723b6b816525a09e16a3f95c4b1b32e2.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643695872100009 Content-Type: text/plain; charset="utf-8" Plenty of projects switch from FUSE to FUSE3. This commit enables libvirt to compile with newer fuse-3.1 which allows users to have just one fuse package on their systems, allows us to set O_CLOEXEC on the fuse session FD. In general, FUSE3 offers more features, but apparently we don't need them right now. There is a rewrite guide at [1] but I've took most inspiration from sshfs [2]. 1: https://github.com/libfuse/libfuse/releases/tag/fuse-3.0.0 2: https://github.com/libfuse/sshfs Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_fuse.c | 73 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 181b05b605..802b2f5a1b 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -28,6 +28,9 @@ #if WITH_FUSE # define FUSE_USE_VERSION 26 # include +# if FUSE_USE_VERSION >=3D 31 +# include +# endif #endif =20 #include "lxc_fuse.h" @@ -48,15 +51,19 @@ struct virLXCFuse { virThread thread; char *mountpoint; struct fuse *fuse; +# if FUSE_USE_VERSION < 31 struct fuse_chan *ch; +# else + struct fuse_session *sess; +# endif virMutex lock; }; =20 static const char *fuse_meminfo_path =3D "/meminfo"; =20 static int -lxcProcGetattr(const char *path, - struct stat *stbuf) +lxcProcGetattrImpl(const char *path, + struct stat *stbuf) { g_autofree char *mempath =3D NULL; struct stat sb; @@ -90,6 +97,40 @@ lxcProcGetattr(const char *path, return 0; } =20 +# if FUSE_USE_VERSION >=3D 31 +static int +lxcProcGetattr(const char *path, + struct stat *stbuf, + struct fuse_file_info *fi G_GNUC_UNUSED) +{ + return lxcProcGetattrImpl(path, stbuf); +} +# else +static int lxcProcGetattr(const char *path, struct stat *stbuf) +{ + return lxcProcGetattrImpl(path, stbuf); +} +# endif + +# if FUSE_USE_VERSION >=3D 31 +static int +lxcProcReaddir(const char *path, + void *buf, + fuse_fill_dir_t filler, + off_t offset G_GNUC_UNUSED, + struct fuse_file_info *fi G_GNUC_UNUSED, + enum fuse_readdir_flags unused_flags G_GNUC_UNUSED) +{ + if (STRNEQ(path, "/")) + return -ENOENT; + + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); + filler(buf, fuse_meminfo_path + 1, NULL, 0, 0); + + return 0; +} +# else static int lxcProcReaddir(const char *path, void *buf, @@ -106,6 +147,7 @@ lxcProcReaddir(const char *path, =20 return 0; } +# endif =20 static int lxcProcOpen(const char *path, @@ -292,7 +334,11 @@ lxcFuseDestroy(struct virLXCFuse *fuse) { VIR_LOCK_GUARD lock =3D virLockGuardLock(&fuse->lock); =20 +# if FUSE_USE_VERSION >=3D 31 + fuse_unmount(fuse->fuse); +# else fuse_unmount(fuse->mountpoint, fuse->ch); +# endif g_clear_pointer(&fuse->fuse, fuse_destroy); } =20 @@ -335,6 +381,23 @@ lxcSetupFuse(struct virLXCFuse **f, fuse_opt_add_arg(&args, "-ofsname=3Dlibvirt") =3D=3D -1) goto error; =20 +# if FUSE_USE_VERSION >=3D 31 + fuse->fuse =3D fuse_new(&args, &lxcProcOper, sizeof(lxcProcOper), fuse= ->def); + if (fuse->fuse =3D=3D NULL) + goto error; + + if (fuse_mount(fuse->fuse, fuse->mountpoint) < 0) + goto error; + + fuse->sess =3D fuse_get_session(fuse->fuse); + + if (virSetInherit(fuse_session_fd(fuse->sess), false) < 0) { + virReportSystemError(errno, "%s", + _("Cannot disable close-on-exec flag")); + goto error; + } + +# else fuse->ch =3D fuse_mount(fuse->mountpoint, &args); if (fuse->ch =3D=3D NULL) goto error; @@ -344,6 +407,7 @@ lxcSetupFuse(struct virLXCFuse **f, if (fuse->fuse =3D=3D NULL) { goto error; } +# endif =20 *f =3D g_steal_pointer(&fuse); ret =3D 0; @@ -352,8 +416,13 @@ lxcSetupFuse(struct virLXCFuse **f, return ret; =20 error: +# if FUSE_USE_VERSION < 31 if (fuse->ch) fuse_unmount(fuse->mountpoint, fuse->ch); +# else + fuse_unmount(fuse->fuse); + fuse_destroy(fuse->fuse); +# endif g_free(fuse->mountpoint); virMutexDestroy(&fuse->lock); goto cleanup; --=20 2.34.1 From nobody Mon May 13 02:58:08 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=1646643735; cv=none; d=zohomail.com; s=zohoarc; b=QQg3kxfft4dLpwqaAn+vlkmQu26SqoE5FE4MgBF6JlWpgQwZGOXMqJhyAScRDVdFNmc+W6DSL3tYNIhaNfs4YdZaxEZBApvvoFTxthjyuW6tj0tTbgX7H4qb/lobhkdX8AQxQwP7pbItsyfPosrMWeshs3IJrXgTFnSyGnOtBC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643735; 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=QJEx1e0vLhnKh7TwIfgeCnUEgqmZFOa8RgYMQUgghRQ=; b=iSwMUPJNnGMVhcqQV7D0ZInS4SW5bl3zHtTazEyAV0+HmuTP4Cf6qctXPBqKTzD3pE5eL8N3FELHvAGKnPHGVunTw1tjihgF2tM36o4CXs43ep+kvYAv3oLMICtEZOob2d9c2uYdw65bWGotpNxE08bJJEir6mrOsfVhkF1UDOM= 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 164664373576188.58673074400872; Mon, 7 Mar 2022 01:02:15 -0800 (PST) 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-467-lkIIXIm1OyGvsbE5AUaQTQ-1; Mon, 07 Mar 2022 04:01:31 -0500 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 8737D2A5955A; Mon, 7 Mar 2022 09:01:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71ACF400E43E; Mon, 7 Mar 2022 09:01: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 312E41931BDD; Mon, 7 Mar 2022 09:01:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 689701930587 for ; Mon, 7 Mar 2022 09:01:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2851F21ECB; Mon, 7 Mar 2022 09:01:24 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id A20E61F470 for ; Mon, 7 Mar 2022 09:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643734; 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=QJEx1e0vLhnKh7TwIfgeCnUEgqmZFOa8RgYMQUgghRQ=; b=WomjfI6qzogTONCxHIA9UWmDCUTjKZROvZqVLIrO+SXUbSA2oZD54/E9I6l2/mJvx6P1PF vTzqX8PGaurfcY0ehoXGO1Sg2msguGWcLcCe9bnV9Vwj4wsfcwIzqfzfvteii3x/EJDOXY EvKgWRN3SAtbD4FqPmvbDczPkzzCC5E= X-MC-Unique: lkIIXIm1OyGvsbE5AUaQTQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 17/17] meson: Detect newer fuse Date: Mon, 7 Mar 2022 10:01:07 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646643736084100002 Content-Type: text/plain; charset="utf-8" Now that we have support for fuse-3 we can detect it during the configure phase. Even better, we can detect fuse-3 first and fallback to old fuse only if the newer version doesn't exist. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- meson.build | 12 +++++++++--- src/lxc/lxc_fuse.c | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 519a928c9a..f6259e59a4 100644 --- a/meson.build +++ b/meson.build @@ -947,10 +947,16 @@ if dlopen_dep.found() conf.set('WITH_DLFCN_H', 1) endif =20 -fuse_version =3D '2.8.6' -fuse_dep =3D dependency('fuse', version: '>=3D' + fuse_version, required: = get_option('fuse')) +fuse_version =3D '3.1.0' +fuse_dep =3D dependency('fuse3', version: '>=3D' + fuse_version, required:= false) if fuse_dep.found() - conf.set('WITH_FUSE', 1) + conf.set('WITH_FUSE', 3) +else + fuse_version =3D '2.8.6' + fuse_dep =3D dependency('fuse', version: '>=3D' + fuse_version, required= : get_option('fuse')) + if fuse_dep.found() + conf.set('WITH_FUSE', 1) + endif endif =20 glib_version =3D '2.56.0' diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 802b2f5a1b..5e48206c39 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -26,7 +26,11 @@ #include =20 #if WITH_FUSE -# define FUSE_USE_VERSION 26 +# if WITH_FUSE =3D=3D 3 +# define FUSE_USE_VERSION 31 +# else +# define FUSE_USE_VERSION 26 +# endif # include # if FUSE_USE_VERSION >=3D 31 # include --=20 2.34.1