Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-02 Thread Paolo Bonzini
On 02/03/2018 16:44, Daniel P. Berrangé wrote: >> Just a small thing, this is a bit inconsistent with the rest of the >> GSource API, where the g_source_attach is usually left to the caller >> when a function returns GSource *. > The APIs which return a GSource in glib typically don't even set the

Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-02 Thread Daniel P . Berrangé
On Thu, Mar 01, 2018 at 06:13:06PM +0100, Paolo Bonzini wrote: > On 01/03/2018 09:44, Peter Xu wrote: > > + * qio_channel_add_watch_source: > > + * @ioc: the channel object > > + * @condition: the I/O condition to monitor > > + * @func: callback to invoke when the source becomes ready > > + * @user

Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-02 Thread Paolo Bonzini
On 02/03/2018 04:54, Peter Xu wrote: > On Thu, Mar 01, 2018 at 06:13:06PM +0100, Paolo Bonzini wrote: >> On 01/03/2018 09:44, Peter Xu wrote: >>> + * qio_channel_add_watch_source: >>> + * @ioc: the channel object >>> + * @condition: the I/O condition to monitor >>> + * @func: callback to invoke whe

Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-01 Thread Peter Xu
On Thu, Mar 01, 2018 at 06:13:06PM +0100, Paolo Bonzini wrote: > On 01/03/2018 09:44, Peter Xu wrote: > > + * qio_channel_add_watch_source: > > + * @ioc: the channel object > > + * @condition: the I/O condition to monitor > > + * @func: callback to invoke when the source becomes ready > > + * @user

Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-01 Thread Paolo Bonzini
On 01/03/2018 09:44, Peter Xu wrote: > + * qio_channel_add_watch_source: > + * @ioc: the channel object > + * @condition: the I/O condition to monitor > + * @func: callback to invoke when the source becomes ready > + * @user_data: opaque data to pass to @func > + * @notify: callback to free @user_d

Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-01 Thread Daniel P . Berrangé
On Thu, Mar 01, 2018 at 04:44:26PM +0800, Peter Xu wrote: > Firstly, introduce an internal qio_channel_add_watch_full(), which > enhances qio_channel_add_watch() that context can be specified. > > Then add a new API wrapper qio_channel_add_watch_source() to return a > GSource pointer rather than a

[Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source}

2018-03-01 Thread Peter Xu
Firstly, introduce an internal qio_channel_add_watch_full(), which enhances qio_channel_add_watch() that context can be specified. Then add a new API wrapper qio_channel_add_watch_source() to return a GSource pointer rather than a tag ID. Note that the _source() call will keep a reference of GSou