search for: buffer_st

Displaying 7 results from an estimated 7 matches for "buffer_st".

Did you mean: buffer_t
2019 Jul 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...file changed, 32 insertions(+), 64 deletions(-) diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index 9f98033..826651e 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -247,6 +247,7 @@ static const char *dest_args[] = { #define BUFFER_SIZE 65536 enum buffer_state { + BUFFER_UNUSED = 0, BUFFER_READING, BUFFER_READ_COMPLETED, BUFFER_WRITING, @@ -254,13 +255,6 @@ enum buffer_state { struct buffer { uint64_t offset; - /* Note that command cookies are only unique per libnbd handle. - * Since we have two handles but we must look up completed...
2019 Jul 30
4
[PATCH libnbd] examples: Fix theoretical cookie race in example.
Previously discussed here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html It turns out that deferring callbacks is a PITA. (It would be a bit easier if C has closures.) However by rewriting the example we can avoid the need to use the cookie at all and make it run a bit more efficiently, so let's do that instead. Rich.
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
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...want --exit-with-parent? > + > +/* The list of buffers waiting to be written. Note that the source > + * server can answer requests out of order so these buffers may not be > + * sorted by offset. > + */ > +#define MAX_BUFFERS 16 > +#define BUFFER_SIZE 65536 > + > +enum buffer_state { > + BUFFER_READING, > + BUFFER_READ_COMPLETED, > + BUFFER_WRITING, > +}; > + > +struct buffer { > + uint64_t offset; > + int64_t cookie; > + enum buffer_state state; > + char *data; > +}; > + > +static struct buffer buffers[MAX_BUFFERS]; > +stat...
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...ot;, "-s", "memory", "size=1G", NULL +}; + +/* The list of buffers waiting to be written. Note that the source + * server can answer requests out of order so these buffers may not be + * sorted by offset. + */ +#define MAX_BUFFERS 16 +#define BUFFER_SIZE 65536 + +enum buffer_state { + BUFFER_READING, + BUFFER_READ_COMPLETED, + BUFFER_WRITING, +}; + +struct buffer { + uint64_t offset; + int64_t cookie; + enum buffer_state state; + char *data; +}; + +static struct buffer buffers[MAX_BUFFERS]; +static size_t nr_buffers; + +static bool finished, reader_paused; + +stati...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...t-with-parent", "memory", "size=1G", NULL +}; + +/* The list of buffers waiting to be written. Note that the source + * server can answer requests out of order so these buffers may not be + * sorted by offset. + */ +#define MAX_BUFFERS 16 +#define BUFFER_SIZE 65536 + +enum buffer_state { + BUFFER_READING, + BUFFER_READ_COMPLETED, + BUFFER_WRITING, +}; + +struct buffer { + uint64_t offset; + /* Note that command cookies are only unique per libnbd handle. + * Since we have two handles but we must look up completed commands + * in the buffer table by cookie we must maint...
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.