From nobody Mon Dec 15 01:36:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530481501701485.99482133094614; Sun, 1 Jul 2018 14:45:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93CD83082132; Sun, 1 Jul 2018 21:45:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CEEE5C541; Sun, 1 Jul 2018 21:45:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EFD8D18037F0; Sun, 1 Jul 2018 21:44:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w61LiX5X009123 for ; Sun, 1 Jul 2018 17:44:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8FCA20155E2; Sun, 1 Jul 2018 21:44:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCAC820155E0 for ; Sun, 1 Jul 2018 21:44:31 +0000 (UTC) Received: from mail-pl0-f52.google.com (mail-pl0-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 237F713AA5 for ; Sun, 1 Jul 2018 21:44:20 +0000 (UTC) Received: by mail-pl0-f52.google.com with SMTP id 6-v6so6953400plb.0 for ; Sun, 01 Jul 2018 14:44:20 -0700 (PDT) Received: from centos.localdomain ([157.37.164.55]) by smtp.gmail.com with ESMTPSA id v68-v6sm15006933pfv.143.2018.07.01.14.44.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=ngktednXz9q/csZrbr0IoRKhu8K8M3DmP78L/LpM26w=; b=dZjQLvWwKL75xd4Q27P8N7HmP9jKnWYSheHB03rM6v3B7K3sxhk7QoJlnwRgjomTts 8WXiIQPXhBWx7z3afHDa2LcQrOg5JHLy+tu2eiGGka+i++Ichq1wgcEaj4abl8j/Mql7 09FvdObAUB2WVj9QRkOQ92vsxLeM12VGn7FQp2pwMKmmiwSizGutcejE38Pr9V4qso53 SlAJGhPMENQEwTUVyEpphmDX02nu8MjWnJRrDz/MIW2OZc4mUwln23TLXrSUjR4arGU0 9/YNlQKf5TOJALv7j+HWvZGWRr/gD/ERu11mS5YznQBppONA8NlE9Eng4v+Bc1WhgViG pdKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=ngktednXz9q/csZrbr0IoRKhu8K8M3DmP78L/LpM26w=; b=jjHvKvi9+1Typpgfj/AZqB30ZL1Uh4JktpMcS5J+NdSx5OXqvb72OXFZ6dLZUmSEdj AWGoCwIakIMlZgl3UgxHvaOR3nLmOmCftajsqX2WasEG+dMR/tLbY6/glByiVUlUmntW XgqY86XI56A+AXQ+yNR971G3g9uG+LKttM+mwsep+rOiV8XM+XkcOb5MnXq+LCM0AN5a 259KwcjieEdT+xraIoEXH8pjbbw8sVHancKD9tGAVbgPw/4KO6G9ShYkQNv5bHVe0GmM 8MMwCJaY6lSGNYuKX/9qbRjKARRKbvRPp5y/jZPUqTlaogEk2i8kCOC5A8WDPc+M8Nnh aQBg== X-Gm-Message-State: APt69E3iJWYC0hlfOboyzFl5hTsbFWfyc5B8j3lA5HyShq5DhF9onx2v Wi2hzNjsLZPZqKDMWqI8uXNdHGpZ X-Google-Smtp-Source: AAOMgpd3oh42hlFoAiPGvvcTu91BtRyD51nDiJ/zavD4w1ctWeywW53pYR2EGXGhm5w2PAGZhHkD1w== X-Received: by 2002:a17:902:8347:: with SMTP id z7-v6mr17282762pln.290.1530481459436; Sun, 01 Jul 2018 14:44:19 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:16 +0530 Message-Id: <1530349239-22049-13-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> References: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 01 Jul 2018 21:44:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 01 Jul 2018 21:44:20 +0000 (UTC) for IP:'209.85.160.52' DOMAIN:'mail-pl0-f52.google.com' HELO:'mail-pl0-f52.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.766 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.160.52 mail-pl0-f52.google.com 209.85.160.52 mail-pl0-f52.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 12/35] util: file: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sun, 01 Jul 2018 21:45:01 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h, define a new wrapper around an existing cleanup function which will be called when a variable declared with VIR_AUTOPTR macro goes out of scope. When a variable of type virFileWrapperFdPtr is declared using VIR_AUTOPTR, the function virFileWrapperFdFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar --- src/util/virfile.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virfile.h b/src/util/virfile.h index 6f1e802..b30a1d3 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -32,6 +32,7 @@ # include "internal.h" # include "virbitmap.h" # include "virstoragefile.h" +# include "viralloc.h" =20 typedef enum { VIR_FILE_CLOSE_PRESERVE_ERRNO =3D 1 << 0, @@ -367,4 +368,6 @@ int virFileInData(int fd, int *inData, long long *length); =20 +VIR_DEFINE_AUTOPTR_FUNC(virFileWrapperFd, virFileWrapperFdFree) + #endif /* __VIR_FILE_H */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list