Displaying 15 results from an estimated 15 matches for "g_io_in".
2019 Jul 17
2
[PATCH libnbd v2] examples: Include an example of integrating with glib main loop.
This is working now, and incorporates all of the changes in Eric's
review, *except* that it still doesn't retire commands (although this
seems to make no obvious difference, except possibly a performance and
memory impact).
Rich.
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...quot;\n", ## __VA_ARGS__); \
+ } while (0)
+
+/* These are the GSource functions for libnbd handles. */
+static inline int
+events_from_nbd (struct nbd_handle *nbd)
+{
+ int dir = nbd_aio_get_direction (nbd);
+ int r = 0;
+
+ if ((dir & LIBNBD_AIO_DIRECTION_READ) != 0)
+ r |= G_IO_IN;
+ if ((dir & LIBNBD_AIO_DIRECTION_WRITE) != 0)
+ r |= G_IO_OUT;
+ return r;
+}
+
+static gboolean
+prepare (GSource *sp, gint *timeout_)
+{
+ struct NBDSource *source = (struct NBDSource *) sp;
+
+ /* When the NBD handle moves out of the created state (which means
+ * that it first ha...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...quot;\n", ## __VA_ARGS__); \
+ } while (0)
+
+/* These are the GSource functions for libnbd handles. */
+static inline int
+events_from_nbd (struct nbd_handle *nbd)
+{
+ int dir = nbd_aio_get_direction (nbd);
+ int r = 0;
+
+ if ((dir & LIBNBD_AIO_DIRECTION_READ) != 0)
+ r |= G_IO_IN;
+ if ((dir & LIBNBD_AIO_DIRECTION_WRITE) != 0)
+ r |= G_IO_OUT;
+ return r;
+}
+
+static gboolean
+prepare (GSource *sp, gint *timeout_)
+{
+ struct NBDSource *source = (struct NBDSource *) sp;
+ int new_fd;
+ int events;
+
+ /* The poll file descriptor can change or become invalid at...
2019 Jul 15
2
[PATCH libnbd] examples: Include an example of integrating with the glibc main loop.
** NOT WORKING **
This patch shows how to integrate libnbd and the glib main loop.
Posted mainly as a point of discussion as it doesn't quite work yet.
Rich.
2019 Jul 17
2
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...++++++++++++++++++++++++++++++++++
> 5 files changed, 545 insertions(+)
Looks good.
>
> + revents = g_source_query_unix_fd ((GSource *) source, source->tag);
> +
> + DEBUG (source, "dispatch: revents = 0x%x%s%s",
> + revents,
> + revents & G_IO_IN ? " G_IO_IN" : "",
> + revents & G_IO_OUT ? " G_IO_OUT" : "");
> +
> + r = 0;
> + if ((revents & G_IO_IN) != 0)
> + r = nbd_aio_notify_read (source->nbd);
> + else if ((revents & G_IO_OUT) != 0)
> + r = nbd...
2019 Jul 17
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...; + GSourceFunc callback,
> + gpointer user_data)
> +{
> + struct NBDSource *source = (struct NBDSource *) sp;
> +
> + DEBUG (source, "dispatch: revents = 0x%x%s%s",
> + source->pollfd.revents,
> + source->pollfd.revents & G_IO_IN ? " G_IO_IN" : "",
> + source->pollfd.revents & G_IO_OUT ? " G_IO_OUT" : "");
> +
> + if ((source->pollfd.revents & G_IO_IN) != 0)
> + nbd_aio_notify_read (source->nbd);
> + else if ((source->pollfd.revents &...
2016 Aug 24
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...path() and avoid the earlier
call to open()
> + if (err) {
> + error_reportf_err(err, "cannot create io channel: ");
> + goto out;
> + }
> +
> + qio_channel_set_blocking(rarg->ioc, false, &err);
> + qio_channel_add_watch(rarg->ioc, G_IO_IN, pstore_async_read_fn, rarg,
> + free_rarg_fn);
> + g_free(filename);
> + return 1;
> +
> +out:
> + g_free(filename);
> + g_free(rarg);
> +
> + return ret;
> +}
> +static ssize_t virtio_pstore_do_write(VirtIOPstore *s, VirtQ...
2016 Aug 24
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...path() and avoid the earlier
call to open()
> + if (err) {
> + error_reportf_err(err, "cannot create io channel: ");
> + goto out;
> + }
> +
> + qio_channel_set_blocking(rarg->ioc, false, &err);
> + qio_channel_add_watch(rarg->ioc, G_IO_IN, pstore_async_read_fn, rarg,
> + free_rarg_fn);
> + g_free(filename);
> + return 1;
> +
> +out:
> + g_free(filename);
> + g_free(rarg);
> +
> + return ret;
> +}
> +static ssize_t virtio_pstore_do_write(VirtIOPstore *s, VirtQ...
2016 Aug 26
0
[PATCH 2/3] qemu: Implement virtio-pstore device
....
>
> > + if (err) {
> > + error_reportf_err(err, "cannot create io channel: ");
> > + goto out;
> > + }
> > +
> > + qio_channel_set_blocking(rarg->ioc, false, &err);
> > + qio_channel_add_watch(rarg->ioc, G_IO_IN, pstore_async_read_fn, rarg,
> > + free_rarg_fn);
> > + g_free(filename);
> > + return 1;
> > +
> > +out:
> > + g_free(filename);
> > + g_free(rarg);
> > +
> > + return ret;
> > +}
>
>
> &...
2016 Aug 20
0
[PATCH 2/3] qemu: Implement virtio-pstore device
...stbuf.st_ctim.tv_nsec);
+
+ rarg->ioc = qio_channel_new_fd(fd, &err);
+ if (err) {
+ error_reportf_err(err, "cannot create io channel: ");
+ goto out;
+ }
+
+ qio_channel_set_blocking(rarg->ioc, false, &err);
+ qio_channel_add_watch(rarg->ioc, G_IO_IN, pstore_async_read_fn, rarg,
+ free_rarg_fn);
+ g_free(filename);
+ return 1;
+
+out:
+ g_free(filename);
+ g_free(rarg);
+
+ return ret;
+}
+
+struct pstore_write_arg {
+ VirtIOPstore *vps;
+ VirtQueueElement *elem;
+ struct virtio_pstore_req *req;...
2016 Nov 10
0
[PATCH 2/3] qemu: Implement virtio-pstore device
...rr) {
> > > + error_reportf_err(err, "cannot create io channel: ");
> > > + goto out;
> > > + }
> > > +
> > > + qio_channel_set_blocking(rarg->ioc, false, &err);
> > > + qio_channel_add_watch(rarg->ioc, G_IO_IN, pstore_async_read_fn, rarg,
> > > + free_rarg_fn);
> > > + g_free(filename);
> > > + return 1;
> > > +
> > > +out:
> > > + g_free(filename);
> > > + g_free(rarg);
> > > +
> > > +...
2016 Aug 20
7
[RFC/PATCHSET 0/3] virtio: Implement virtio pstore device (v3)
Hello,
This is another iteration of the virtio-pstore work. In this patchset
I addressed most of feedbacks from previous version and drooped the
support for PSTORE_TYPE_CONSOLE for simplicity. It'll be added once the basic implementation
* changes in v3)
- use QIOChannel API (Stefan, Daniel)
- add bound check for malcious guests (Daniel)
- drop support PSTORE_TYPE_CONSOLE for now
2016 Aug 20
7
[RFC/PATCHSET 0/3] virtio: Implement virtio pstore device (v3)
Hello,
This is another iteration of the virtio-pstore work. In this patchset
I addressed most of feedbacks from previous version and drooped the
support for PSTORE_TYPE_CONSOLE for simplicity. It'll be added once the basic implementation
* changes in v3)
- use QIOChannel API (Stefan, Daniel)
- add bound check for malcious guests (Daniel)
- drop support PSTORE_TYPE_CONSOLE for now
2016 Aug 31
4
[RFC/PATCHSET 0/3] virtio: Implement virtio pstore device (v4)
Hello,
This is another iteration of the virtio-pstore work. I've addressed
all comments from Daniel Berrange on the qemu side.
* changes in v4)
- use qio_channel_file_new_path() (Daniel)
- rename to delete_old_pstore_file (Daniel)
- convert G_REMOVE_SOURCE to FALSE (Daniel)
* changes in v3)
- use QIOChannel API (Stefan, Daniel)
- add bound check for malcious guests
2016 Aug 31
4
[RFC/PATCHSET 0/3] virtio: Implement virtio pstore device (v4)
Hello,
This is another iteration of the virtio-pstore work. I've addressed
all comments from Daniel Berrange on the qemu side.
* changes in v4)
- use qio_channel_file_new_path() (Daniel)
- rename to delete_old_pstore_file (Daniel)
- convert G_REMOVE_SOURCE to FALSE (Daniel)
* changes in v3)
- use QIOChannel API (Stefan, Daniel)
- add bound check for malcious guests