Displaying 20 results from an estimated 25 matches for "finished_writ".
Did you mean:
finished_write
2019 Jul 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...rs[i].state == BUFFER_READ_COMPLETED)
- goto found;
- }
- /* This should never happen. */
- abort ();
-
- found:
- buffers[i].wcookie =
- nbd_aio_pwrite_callback (gsdest->nbd, buffers[i].data,
- BUFFER_SIZE, buffers[i].offset,
- finished_write, NULL, 0);
- if (buffers[i].wcookie == -1) {
+ assert (buffer->state == BUFFER_READ_COMPLETED);
+ buffer->state = BUFFER_WRITING;
+ if (nbd_aio_pwrite_callback (gsdest->nbd, buffer->data,
+ BUFFER_SIZE, buffer->offset,
+...
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 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 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...rror ());
> exit (EXIT_FAILURE);
> }
> @@ -428,7 +429,8 @@ write_data (gpointer user_data)
> buffer->state = BUFFER_WRITING;
> if (nbd_aio_pwrite (gsdest->nbd, buffer->data,
> BUFFER_SIZE, buffer->offset,
> - finished_write, buffer, 0) == -1) {
> + (nbd_completion_callback) { .callback = finished_write, .user_data = buffer },
Worth splitting the long lines?
> +++ b/interop/structured-read.c
> @@ -147,7 +147,8 @@ main (int argc, char *argv[])
>
> memset (rbuf, 2, sizeof rbuf)...
2019 Jul 17
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...d;
> +
> +static GMainLoop *loop;
> +
> +static void connected (struct NBDSource *source);
> +static gboolean read_data (gpointer user_data);
> +static int finished_read (void *vp, int64_t cookie, int *error);
> +static gboolean write_data (gpointer user_data);
> +static int finished_write (void *vp, int64_t cookie, int *error);
> +
> +int
> +main (int argc, char *argv[])
> +{
> + struct nbd_handle *src, *dest;
> + GMainContext *loopctx = NULL;
> +
> + /* Create the main loop. */
> + loop = g_main_loop_new (loopctx, FALSE);
> +
> + /* Create the...
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...s;
+
+static bool finished, reader_paused;
+
+static GMainLoop *loop;
+
+static void connected (struct NBDSource *source);
+static gboolean read_data (gpointer user_data);
+static int finished_read (void *vp, int64_t cookie, int *error);
+static gboolean write_data (gpointer user_data);
+static int finished_write (void *vp, int64_t cookie, int *error);
+
+int
+main (int argc, char *argv[])
+{
+ struct nbd_handle *src, *dest;
+ GMainContext *loopctx = NULL;
+
+ /* Create the main loop. */
+ loop = g_main_loop_new (loopctx, FALSE);
+
+ /* Create the two NBD handles and nbdkit instances. */
+ src = nbd_...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...;
+
+static bool finished, reader_paused;
+
+static GMainLoop *loop;
+
+static void connected (struct NBDSource *source);
+static gboolean read_data (gpointer user_data);
+static int finished_read (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);
+
+int
+main (int argc, char *argv[])
+{
+ struct nbd_handle *src, *dest;
+ GMainContext *loopctx = NULL;
+
+ /* Create the main loop. */
+ loop = g_main_loop_new (loopctx, FALSE);
+
+ /* Create the two NBD handles and nbdkit instances. */
+ src = nbd...
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 Aug 14
0
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
..._FAILURE);
> > }
> > @@ -428,7 +429,8 @@ write_data (gpointer user_data)
> > buffer->state = BUFFER_WRITING;
> > if (nbd_aio_pwrite (gsdest->nbd, buffer->data,
> > BUFFER_SIZE, buffer->offset,
> > - finished_write, buffer, 0) == -1) {
> > + (nbd_completion_callback) { .callback = finished_write, .user_data = buffer },
>
> Worth splitting the long lines?
It's tricky to format these. Even after splitting the line they still
go over 7x chars.
Rich.
--
Richard Jones, V...
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...);
static gboolean read_data (gpointer user_data);
-static int finished_read (unsigned 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...
2019 Aug 14
1
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...PLETION/
>>> @@ -428,7 +429,8 @@ write_data (gpointer user_data)
>>> buffer->state = BUFFER_WRITING;
>>> if (nbd_aio_pwrite (gsdest->nbd, buffer->data,
>>> BUFFER_SIZE, buffer->offset,
>>> - finished_write, buffer, 0) == -1) {
>>> + (nbd_completion_callback) { .callback = finished_write, .user_data = buffer },
>>
>> Worth splitting the long lines?
>
> It's tricky to format these. Even after splitting the line they still
> go over 7x chars.
Wo...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...ainLoop *loop;
static void connected (struct NBDSource *source);
static gboolean read_data (gpointer user_data);
-static int finished_read (unsigned valid_flag, void *vp, int *error);
+static int finished_read (void *vp, int *error);
static gboolean write_data (gpointer user_data);
-static int finished_write (unsigned valid_flag, void *vp, int *error);
+static int finished_write (void *vp, int *error);
int
main (int argc, char *argv[])
@@ -394,13 +394,10 @@ read_data (gpointer user_data)
/* This callback is called from libnbd when any read command finishes. */
static int
-finished_read (unsign...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...e *source);
static gboolean read_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 rea...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...ainLoop *loop;
static void connected (struct NBDSource *source);
static gboolean read_data (gpointer user_data);
-static int finished_read (unsigned valid_flag, void *vp, int *error);
+static int finished_read (void *vp, int *error);
static gboolean write_data (gpointer user_data);
-static int finished_write (unsigned valid_flag, void *vp, int *error);
+static int finished_write (void *vp, int *error);
int
main (int argc, char *argv[])
@@ -395,13 +395,10 @@ read_data (gpointer user_data)
/* This callback is called from libnbd when any read command finishes. */
static int
-finished_read (unsign...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...urce);
static gboolean read_data (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 an...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...urce);
static gboolean read_data (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 an...
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass
closures + user_data + free function in single struct parameters as I
described previously in this email:
https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html
Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile
simplification if you buy into 1 & 2.
Patch 4 adds another macro which is
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 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...9 +426,9 @@ write_data (gpointer user_data)
assert (buffer->state == BUFFER_READ_COMPLETED);
buffer->state = BUFFER_WRITING;
- if (nbd_aio_pwrite_callback (gsdest->nbd, buffer->data,
- BUFFER_SIZE, buffer->offset,
- finished_write, buffer, 0) == -1) {
+ if (nbd_aio_pwrite (gsdest->nbd, buffer->data,
+ BUFFER_SIZE, buffer->offset,
+ finished_write, buffer, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/exam...
2019 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here:
https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html
I didn't actually read Eric's replies to that yet because I've been
concentrating on writing these patches all day. Anyway here they are
and I'll look at what Eric said about the proposal next.
Rich.