search for: wcookie

Displaying 12 results from an estimated 12 matches for "wcookie".

Did you mean: cookie
2019 Jul 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...ct 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 maintain separate read and - * write cookies. - */ - int64_t rcookie; - int64_t wcookie; enum buffer_state state; char *data; }; @@ -355,7 +349,7 @@ static gboolean read_data (gpointer user_data) { static uint64_t posn = 0; - const size_t i = nr_buffers; + size_t i; if (gssrc == NULL) return FALSE; @@ -367,16 +361,21 @@ read_data (gpointer user_data) retur...
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 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...ct 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 maintain separate read and + * write cookies. + */ + int64_t rcookie; + int64_t wcookie; + enum buffer_state state; + char *data; +}; + +static struct buffer buffers[MAX_BUFFERS]; +static size_t nr_buffers; + +static bool finished, reader_paused; + +static GMainLoop *loop; + +static void connected (struct NBDSource *source); +static gboolean read_data (gpointer user_data); +static i...
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 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...data (gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (int valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (void *vp, int64_t wcookie, int *error); +static int finished_write (int valid_flag, void *vp, + int64_t wcookie, int *error); int main (int argc, char *argv[]) @@ -395,10 +397,13 @@ read_data (gpointer user_data) /* This callback is called from libnbd when any read command finishes. */ stat...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...(gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (void *vp, int64_t wcookie, int *error); +static int finished_write (unsigned valid_flag, void *vp, + int64_t wcookie, int *error); int main (int argc, char *argv[]) @@ -395,10 +397,13 @@ read_data (gpointer user_data) /* This callback is called from libnbd when any read command finishes. */...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...(gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (void *vp, int64_t wcookie, int *error); +static int finished_write (unsigned valid_flag, void *vp, + int64_t wcookie, int *error); int main (int argc, char *argv[]) @@ -397,10 +399,13 @@ read_data (gpointer user_data) /* This callback is called from libnbd when any read command finishes. */...
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review. Some of the highlights: - Callbacks should be freed reliably along all exit paths. - There's a simple test of closure lifetimes. - I've tried to use VALID|FREE in all the places where I'm confident that it's safe and correct to do. There may be more places. Note this is an optimization and shouldn't
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...gned valid_flag, void *vp, - int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (unsigned valid_flag, void *vp, - int64_t wcookie, int *error); +static int finished_write (unsigned valid_flag, void *vp, int *error); int main (int argc, char *argv[]) @@ -396,7 +394,7 @@ read_data (gpointer user_data) /* This callback is called from libnbd when any read command finishes. */ static int -finished_read (unsigned valid_flag...
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. Rich.
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Jul 23
4
[libnbd PATCH] api: Allow completion callbacks to auto-retire
...(source->nbd); } @@ -418,7 +420,7 @@ finished_read (void *vp, int64_t rcookie, int *error) /* Create a writer idle handler. */ g_idle_add (write_data, NULL); - return 0; + return 1; } /* This idle callback schedules a write. */ @@ -507,5 +509,5 @@ finished_write (void *vp, int64_t wcookie, int *error) g_main_loop_quit (loop); } - return 0; + return 1; } diff --git a/generator/generator b/generator/generator index fdacd71..e0a2805 100755 --- a/generator/generator +++ b/generator/generator @@ -1738,9 +1738,9 @@ unique positive 64 bit cookie for this command, or C<-1>...