From nobody Tue May 13 11:20:07 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 1532639158977702.085608584038; Thu, 26 Jul 2018 14:05:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C4A880F75; Thu, 26 Jul 2018 21:05:45 +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 1D18E16D2F; Thu, 26 Jul 2018 21:05:45 +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 C21481800B6E; Thu, 26 Jul 2018 21:05:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL5dSg024988 for ; Thu, 26 Jul 2018 17:05:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1C296017A; Thu, 26 Jul 2018 21:05:39 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F7496017E for ; Thu, 26 Jul 2018 21:05:36 +0000 (UTC) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 448ED22B for ; Thu, 26 Jul 2018 21:05:35 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id y10-v6so968919pfn.8 for ; Thu, 26 Jul 2018 14:05:35 -0700 (PDT) Received: from centos.localdomain ([42.106.3.93]) by smtp.gmail.com with ESMTPSA id z10-v6sm3279182pfh.83.2018.07.26.14.05.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:05:34 -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=n97fRF8BdbTJoXPACjTMh5Kdpzj1zhDMKmqBtjXcSpg=; b=SjP+RvynngboZJlqvv5Kgt2YjtdzQ1/oRTL4XghNponWNMiZ1uN2J+Cme0cOjzFjg8 iaE017kdbwlt4L8M4aEEucc4dPekASEq5IWD/SrKyHvgZWMjX7dVLg2/xNk/tFMNUmdA kUPHeCNP02Zjt0t0l6OjnRigiZHxBkJjKR7gu0dWvx/l3xwD+UP8z2LSyu5CpDZJvZaX AolWFef2AugYHd1zPitqEbJQusZfYc6i54tbh3qCnMZ6vrCXt6/w8e5iHcy2lIPmbVoB rZKi9vmXpzO+i8VYN86m5y2cgy2FPZ/3ytuo3S0wIcJYahh2I3eTrvACV5gSolVWPDNW 0K7w== 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=n97fRF8BdbTJoXPACjTMh5Kdpzj1zhDMKmqBtjXcSpg=; b=CNFVGX9NsjtQJqvqMRzhnHGWAwOqqrigqQSVxqksBogzsHCkRZaAQW5UnwXPFlzHi+ bJ3QT/5GHwV+utpzq3g8PLh26OGeOpcaZB5BaWDgE0VJ1gwz6S09fhQuxzSR6v1LgASm JAq6jjJZsq5RgWG2Vcshaed2qAO+5NLVUXiWQYveO5Bpbu+8e+j+Z06ZM4MSRn+PK0s0 T09n2kA/Qp9WinODKiRdwz1ZGUXE+igR0svpjXeV4JiA4KnRNfX4dOI2jZfvZZGa/9KC yPjWbGmzHstAA4b7/y9ewgNoMpR/6Uul3Hclup0cOlMB44hTJ5GrgkJIRQp19ii/qntA c1OA== X-Gm-Message-State: AOUpUlG5FGwAa+3eWx78rdDkW4qBBF3hKmnE6Pv9+QoD+1Ijm/1HfxUh eoW0i2U/lOLTUawP3HTs79dbYqrO X-Google-Smtp-Source: AAOMgpedyI3om5wRQ7XNUBjBK+qG3r8krlQx7tU9aJxye5ZqHm8bwC2sYfVx80LSPeQyPCbJQTF0fQ== X-Received: by 2002:a62:d8c:: with SMTP id 12-v6mr3711468pfn.202.1532639134525; Thu, 26 Jul 2018 14:05:34 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:30 +0530 Message-Id: <1532447562-24010-30-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532447562-24010-1-git-send-email-skrtbhtngr@gmail.com> References: <1532447562-24010-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.26]); Thu, 26 Jul 2018 21:05:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Jul 2018 21:05:35 +0000 (UTC) for IP:'209.85.210.174' DOMAIN:'mail-pf1-f174.google.com' HELO:'mail-pf1-f174.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.39 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_WEB, SPF_PASS) 209.85.210.174 mail-pf1-f174.google.com 209.85.210.174 mail-pf1-f174.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 29/41] util: scsivhost: 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 26 Jul 2018 21:05:55 +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. Also, drop the redundant viralloc.h include, since that has moved from the source module into the header. When a variable of type virSCSIVHostDevicePtr is declared using VIR_AUTOPTR, the function virSCSIVHostDeviceFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virscsivhost.c | 1 - src/util/virscsivhost.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c index 84c09e8..ef216b3 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -26,7 +26,6 @@ =20 #include "virscsivhost.h" #include "virlog.h" -#include "viralloc.h" #include "virerror.h" #include "virfile.h" #include "virstring.h" diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h index 21887dd..31ad429 100644 --- a/src/util/virscsivhost.h +++ b/src/util/virscsivhost.h @@ -27,6 +27,7 @@ # include "internal.h" # include "virobject.h" # include "virutil.h" +# include "viralloc.h" =20 typedef struct _virSCSIVHostDevice virSCSIVHostDevice; typedef virSCSIVHostDevice *virSCSIVHostDevicePtr; @@ -63,4 +64,6 @@ void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevicePtr de= v, void virSCSIVHostDeviceFree(virSCSIVHostDevicePtr dev); int virSCSIVHostOpenVhostSCSI(int *vhostfd) ATTRIBUTE_NOINLINE; =20 +VIR_DEFINE_AUTOPTR_FUNC(virSCSIVHostDevice, virSCSIVHostDeviceFree) + #endif /* __VIR_SCSIHOST_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list