From nobody Mon Dec 15 01:38:28 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 1532639154833532.858458272712; Thu, 26 Jul 2018 14:05:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E0BD8A09; Thu, 26 Jul 2018 21:05:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19DA82010CC4; Thu, 26 Jul 2018 21:05:52 +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 B673D24F5C; Thu, 26 Jul 2018 21:05:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL51hW024744 for ; Thu, 26 Jul 2018 17:05:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 957F63001A5B; Thu, 26 Jul 2018 21:05:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8EEA03001A55 for ; Thu, 26 Jul 2018 21:05:01 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) (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 69F3DC0587C3 for ; Thu, 26 Jul 2018 21:05:00 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id p23-v6so1874753pgv.13 for ; Thu, 26 Jul 2018 14:05:00 -0700 (PDT) Received: from centos.localdomain ([42.106.3.93]) by smtp.gmail.com with ESMTPSA id z10-v6sm3279182pfh.83.2018.07.26.14.04.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:04:59 -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=mt2rTGoMpOgKLYAziW35tOs8cCQYDEn0kmSleAN3Qa8=; b=ZyJCmUuepeVKM5+aMB56Awu2/Ql/UtfJyELnkpPujLlECMkcPYXQwCN8BMlvAWtUzO zdEhrsA+DzGo0cMjpYCazcvCKhnrEHarQsiPDZEP63OzJsOd7cHkNBBUaadhlUP60McI NITGsxXl94zZ4/kB2LynCnx85DWLvWoXpZXGmfiN3gBDdyUkh5nfsYiPgtkkJYeD0h5C 3HoInC6Em570zy/3IYVpuiSY2Kwp+SMgkYgnVwwlyODBS/e+nJkkQ2BTvXoZOVn5B83f TzyFZkU/TqH7+XLgOQ1wxJPhqZhXd68zbpLbSFSqAlvIFctUhf94rfXv/AhhUZA+AAWd NX5w== 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=mt2rTGoMpOgKLYAziW35tOs8cCQYDEn0kmSleAN3Qa8=; b=DQgo7mYPXYf7yyS2q2oar44Vl6jbxz3/jQ1P/pIMCTXkXZ/l0XWlRcsl3O/BfHg7Nt 27rr99w3d+f2glx3gwh4U04a8fFbtko+bG0FZbHiqPtyCdCSGOrmgtuxhS5f9NZTN04Y Gf2UojrAcz8Y7jrU58v7QQ9llZAeb/AvudLSxTmFh0b+xqY7/2X+PM5uKm+bg5Ks6Y+R 9QXqRzazngLn6uhABvzLh1vU7/YxhXvNAHJ6NyxSt2VsuEewd+BBCdtYIVYmXloNXwCg T13/WQ9PKB60VU5CJJ0vEdDyLzoEXkw6nhzQ/WdzsSpu/lIk8kIBamwQqWFE+H78HSKP tL3w== X-Gm-Message-State: AOUpUlHaLVdRwquJtdix6Nr0X6QdUWdNs4Iqbm8dk6eiU/pQ6qrVldsj G9q375PRLUgPNITPoL9lR4lfrPjk X-Google-Smtp-Source: AAOMgpcN92WY5YBlzonCfJXofPj/Q0IB1qZXf54nV5RBicUHzWy6R6TyVEDRc3JU91B+vrM4iecdgw== X-Received: by 2002:a63:3246:: with SMTP id y67-v6mr3302613pgy.399.1532639099699; Thu, 26 Jul 2018 14:04:59 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:12 +0530 Message-Id: <1532447562-24010-12-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.32]); Thu, 26 Jul 2018 21:05:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 26 Jul 2018 21:05:00 +0000 (UTC) for IP:'209.85.215.196' DOMAIN:'mail-pg1-f196.google.com' HELO:'mail-pg1-f196.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.389 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_WEB, SPF_PASS) 209.85.215.196 mail-pg1-f196.google.com 209.85.215.196 mail-pg1-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 11/41] 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Jul 2018 21:05:53 +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