Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-06-01 Thread Daniel P . Berrangé
On Mon, May 28, 2018 at 01:04:28PM +0530, Sukrit Bhatnagar wrote: > On 25 May 2018 at 16:20, Pavel Hrdina wrote: > > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote: > >> On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote: > >> > On Fri, May 25, 2018 at 09:13:51AM +0200,

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-29 Thread Pavel Hrdina
On Mon, May 28, 2018 at 09:40:41PM +0530, Sukrit Bhatnagar wrote: > On 28 May 2018 at 13:54, Pavel Hrdina wrote: > > On Mon, May 28, 2018 at 01:04:28PM +0530, Sukrit Bhatnagar wrote: > >> On 25 May 2018 at 16:20, Pavel Hrdina wrote: > >> > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-29 Thread Sukrit Bhatnagar
On 29 May 2018 at 10:36, Michal Privoznik wrote: > On 05/28/2018 09:34 AM, Sukrit Bhatnagar wrote: >> >> This is what new macros will look like: >> >> # define _VIR_TYPE_PTR(type) type##Ptr >> >> # define _VIR_ATTR_AUTOFREE_PTR(type) __attribute__((cleanup(type##Free))) >> # define

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Michal Privoznik
On 05/28/2018 09:34 AM, Sukrit Bhatnagar wrote: > > This is what new macros will look like: > > # define _VIR_TYPE_PTR(type) type##Ptr > > # define _VIR_ATTR_AUTOFREE_PTR(type) __attribute__((cleanup(type##Free))) > # define _VIR_ATTR_AUTOCLOSE_PTR(type) __attribute__((cleanup(type##Close))) >

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Sukrit Bhatnagar
On 28 May 2018 at 13:54, Pavel Hrdina wrote: > On Mon, May 28, 2018 at 01:04:28PM +0530, Sukrit Bhatnagar wrote: >> On 25 May 2018 at 16:20, Pavel Hrdina wrote: >> > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote: >> >> On Fri, 2018-05-25

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Pavel Hrdina
On Mon, May 28, 2018 at 01:04:28PM +0530, Sukrit Bhatnagar wrote: > On 25 May 2018 at 16:20, Pavel Hrdina wrote: > > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote: > >> On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote: > >> > On Fri, May 25, 2018 at

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Erik Skultety
On Mon, May 28, 2018 at 01:04:28PM +0530, Sukrit Bhatnagar wrote: > On 25 May 2018 at 16:20, Pavel Hrdina wrote: > > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote: > >> On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote: > >> > On Fri, May 25, 2018 at

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Sukrit Bhatnagar
On 25 May 2018 at 16:20, Pavel Hrdina wrote: > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote: >> On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote: >> > On Fri, May 25, 2018 at 09:13:51AM +0200, Andrea Bolognani wrote: >> > > However, I realize it might

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Pavel Hrdina
On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote: > On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote: > > On Fri, May 25, 2018 at 09:13:51AM +0200, Andrea Bolognani wrote: > > > However, I realize it might not be possible to register free > > > functions for a native type

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Andrea Bolognani
On Fri, 2018-05-25 at 11:17 +0200, Erik Skultety wrote: > I also like the alternative approach Andrea mentioned, especially since you > can reuse it for structures using plain scalar types, e.g. a structure like > > typedef _virSomething virSomething; > typedef virSomething * virSomethingPtr; >

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Andrea Bolognani
On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote: > On Fri, May 25, 2018 at 09:13:51AM +0200, Andrea Bolognani wrote: > > However, I realize it might not be possible to register free > > functions for a native type without having to introduce something > > like > > > > typedef char *

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Erik Skultety
On Fri, May 25, 2018 at 11:03:01AM +0200, Andrea Bolognani wrote: > On Fri, 2018-05-25 at 10:46 +0200, Pavel Hrdina wrote: > > On Fri, May 25, 2018 at 10:32:04AM +0200, Andrea Bolognani wrote: > > > I'm probably missing something, but couldn't you just have > > > > > > #define VIR_AUTOFREE(type)

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Andrea Bolognani
On Fri, 2018-05-25 at 10:46 +0200, Pavel Hrdina wrote: > On Fri, May 25, 2018 at 10:32:04AM +0200, Andrea Bolognani wrote: > > I'm probably missing something, but couldn't you just have > > > > #define VIR_AUTOFREE(type) __attribute__((cleanup(virFree))) type > > > > which you would then use

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Pavel Hrdina
On Fri, May 25, 2018 at 10:32:04AM +0200, Andrea Bolognani wrote: > On Fri, 2018-05-25 at 10:08 +0200, Pavel Hrdina wrote: > > On Fri, May 25, 2018 at 09:01:03AM +0200, Andrea Bolognani wrote: > > > On Wed, 2018-05-23 at 18:23 +0200, Peter Krempa wrote: > > > > On Wed, May 23, 2018 at 18:05:17

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Andrea Bolognani
On Fri, 2018-05-25 at 10:08 +0200, Pavel Hrdina wrote: > On Fri, May 25, 2018 at 09:01:03AM +0200, Andrea Bolognani wrote: > > On Wed, 2018-05-23 at 18:23 +0200, Peter Krempa wrote: > > > On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote: > > > > [...] > > > > VIR_AUTOFREE char *str =

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Pavel Hrdina
On Fri, May 25, 2018 at 09:13:51AM +0200, Andrea Bolognani wrote: > On Wed, 2018-05-23 at 18:05 +0200, Pavel Hrdina wrote: > > I liked the way how GLib is solving the issue so we can simply use the > > same approach since it looks reasonable. > > > > There would be three different macros that

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Pavel Hrdina
On Fri, May 25, 2018 at 09:01:03AM +0200, Andrea Bolognani wrote: > On Wed, 2018-05-23 at 18:23 +0200, Peter Krempa wrote: > > On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote: > [...] > > > VIR_AUTOFREE char *str = NULL; > > > > For consistency I'd prefer if the argument is in

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Andrea Bolognani
On Wed, 2018-05-23 at 18:05 +0200, Pavel Hrdina wrote: > I liked the way how GLib is solving the issue so we can simply use the > same approach since it looks reasonable. > > There would be three different macros that would be used to annotate > variable with attribute cleanup: > > VIR_AUTOFREE

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-25 Thread Andrea Bolognani
On Wed, 2018-05-23 at 18:23 +0200, Peter Krempa wrote: > On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote: [...] > > VIR_AUTOFREE char *str = NULL; > > For consistency I'd prefer if the argument is in parentheses similarly > to the ones below. Seconded. -- Andrea Bolognani / Red Hat

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-24 Thread Pavel Hrdina
On Wed, May 23, 2018 at 06:23:01PM +0200, Peter Krempa wrote: > On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote: > > [...] > > > I liked the way how GLib is solving the issue so we can simply use the > > same approach since it looks reasonable. > > > > There would be three different

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-24 Thread Pavel Hrdina
On Thu, May 24, 2018 at 11:16:40PM +0530, Sukrit Bhatnagar wrote: > On 23 May 2018 at 21:35, Pavel Hrdina wrote: > > On Sun, Mar 25, 2018 at 01:55:07AM +0530, Sukrit Bhatnagar wrote: > >> Hi, > >> > >> I am interested in implementing the GCC cleanup attribute for automatic >

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-24 Thread Sukrit Bhatnagar
On 23 May 2018 at 21:35, Pavel Hrdina wrote: > On Sun, Mar 25, 2018 at 01:55:07AM +0530, Sukrit Bhatnagar wrote: >> Hi, >> >> I am interested in implementing the GCC cleanup attribute for automatic >> resource freeing as part of GSoC'18. I have shared a proposal for the same.

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-23 Thread Peter Krempa
On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote: [...] > I liked the way how GLib is solving the issue so we can simply use the > same approach since it looks reasonable. > > There would be three different macros that would be used to annotate > variable with attribute cleanup: > >

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-23 Thread Pavel Hrdina
On Sun, Mar 25, 2018 at 01:55:07AM +0530, Sukrit Bhatnagar wrote: > Hi, > > I am interested in implementing the GCC cleanup attribute for automatic > resource freeing as part of GSoC'18. I have shared a proposal for the same. > > This mail is to discuss the code design for implementing it. > >

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-03-26 Thread Daniel P . Berrangé
On Sun, Mar 25, 2018 at 01:55:07AM +0530, Sukrit Bhatnagar wrote: > Hi, > > I am interested in implementing the GCC cleanup attribute for automatic > resource freeing as part of GSoC'18. I have shared a proposal for the same. > > This mail is to discuss the code design for implementing it. > >

[libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-03-24 Thread Sukrit Bhatnagar
Hi, I am interested in implementing the GCC cleanup attribute for automatic resource freeing as part of GSoC'18. I have shared a proposal for the same. This mail is to discuss the code design for implementing it. Here are some of my ideas: This attribute requires a cleanup function that is