From nobody Sun Feb 8 17:21:17 2026 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 1532174982478652.3419393960912; Sat, 21 Jul 2018 05:09:42 -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 286A08762E; Sat, 21 Jul 2018 12:09:36 +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 E375717AF9; Sat, 21 Jul 2018 12:09:34 +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 6CD391841C4B; Sat, 21 Jul 2018 12:09:34 +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 w6LC83Id016302 for ; Sat, 21 Jul 2018 08:08:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 839FD600C7; Sat, 21 Jul 2018 12:08:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B9DD600C6 for ; Sat, 21 Jul 2018 12:08:00 +0000 (UTC) Received: from mail-pl0-f54.google.com (mail-pl0-f54.google.com [209.85.160.54]) (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 32C6881DE6 for ; Sat, 21 Jul 2018 12:07:50 +0000 (UTC) Received: by mail-pl0-f54.google.com with SMTP id t17-v6so3749161ply.13 for ; Sat, 21 Jul 2018 05:07:50 -0700 (PDT) Received: from centos.localdomain ([42.106.1.69]) by smtp.gmail.com with ESMTPSA id s16-v6sm5861694pfm.114.2018.07.21.05.07.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:07:49 -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=kWrioItjtK9sZKakHI5TunDd7fH4bBuTUolJ/tpMv2A=; b=OyB9hoLZGrKg7xtFRFb3OO+wdJfuiZhL45O2Kb2oS+aEMLp9eAu3hCPB2WzyxCyhCG O7Fug9w9PGpzNCwRp9IjIGSBuAouioXw5pLLZioGxQp5JXgx02l2AmtMrEpVqkF1oWex 1KUQu5ne+Wpxm2CMMq+bfbUyPV8dB+y1FFHUoh6+1pmq8CPXTTd1yTdxLsv40S1vqZbt 9Pfce7daoPDgdRvysiFeXSBGFTdJ99COEtNQ8RZyMJVALGFIP0u1ez7B/UrYXIzIl0rA qFYV7xQ2RVArtEuZaS4eFFRQjj1v+WPCGzzxmYxj0VbUFFLruRmGE2kvcEwAmpkpqtya J+rA== 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=kWrioItjtK9sZKakHI5TunDd7fH4bBuTUolJ/tpMv2A=; b=bm8zlELxNMukTkxhs7WJRzAp3vK22pSN3g9WyKQQvPOWFzBOrAwyL7PxwGS0OgC0m3 jCcdBM19Bh8yBnj4y1/Lq3PeKQEs7l4ossKDV4/UB4fuBZTmghQckf0zxD5Ofl3mtELS p8Gsj75WXpLLWuqL63LDt/jQLLA6jsdDC5Z+BuzkNQSz4RQg5LO3bY24fS4t5GLG3NT/ fSwU1TmQSjWEYYns8+aBNct0plIdt0g/lkvZ2T+y0qpnx2x+xNOPHeckWa48Mb8yHfzS o8S7Bpnbx5rroPha+fIYIIvaDxk3RJwjzh91irZfOXfO5NqIr50nlWdjUdBjZ8RtS0GM ePxQ== X-Gm-Message-State: AOUpUlHhcFQkS01q2hgrKMsELWdbBGeXnh39H2+7nogqeTQRIgbq2OAJ YHUtng5Hv1mgicmNkkS656ayJXmH X-Google-Smtp-Source: AAOMgpewXn3G2BF3Nt8CD3vGBB8MNr9bapo4jqj41uyIq7IhN5QSo2q5tAuVuv1BbfhQvT5iTu3XXw== X-Received: by 2002:a17:902:142:: with SMTP id 60-v6mr3568994plb.330.1532174869437; Sat, 21 Jul 2018 05:07:49 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 21 Jul 2018 17:36:43 +0530 Message-Id: <1532174832-21644-12-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532174832-21644-1-git-send-email-skrtbhtngr@gmail.com> References: <1532174832-21644-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.25]); Sat, 21 Jul 2018 12:07:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 21 Jul 2018 12:07:50 +0000 (UTC) for IP:'209.85.160.54' DOMAIN:'mail-pl0-f54.google.com' HELO:'mail-pl0-f54.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.301 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.160.54 mail-pl0-f54.google.com 209.85.160.54 mail-pl0-f54.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 11/40] util: mdev: 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.26]); Sat, 21 Jul 2018 12:09:41 +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 variables of type virMediatedDevicePtr and virMediatedDeviceTypePtr are declared using VIR_AUTOPTR, the functions virMediatedDeviceFree and virMediatedDeviceTypeFree, respectively, will be run automatically on them when they go out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virmdev.c | 1 - src/util/virmdev.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/virmdev.c b/src/util/virmdev.c index 6c51388..d7bcb1d 100644 --- a/src/util/virmdev.c +++ b/src/util/virmdev.c @@ -21,7 +21,6 @@ #include "dirname.h" #include "virmdev.h" #include "virlog.h" -#include "viralloc.h" #include "virerror.h" #include "virfile.h" #include "virstring.h" diff --git a/src/util/virmdev.h b/src/util/virmdev.h index cfda2ca..7c93c4d 100644 --- a/src/util/virmdev.h +++ b/src/util/virmdev.h @@ -22,6 +22,7 @@ # include "internal.h" # include "virobject.h" # include "virutil.h" +# include "viralloc.h" =20 typedef enum { VIR_MDEV_MODEL_TYPE_VFIO_PCI =3D 0, @@ -135,4 +136,7 @@ int virMediatedDeviceTypeReadAttrs(const char *sysfspath, virMediatedDeviceTypePtr *type); =20 +VIR_DEFINE_AUTOPTR_FUNC(virMediatedDevice, virMediatedDeviceFree) +VIR_DEFINE_AUTOPTR_FUNC(virMediatedDeviceType, virMediatedDeviceTypeFree) + #endif /* __VIR_MDEV_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list