search for: read_fn

Displaying 20 results from an estimated 26 matches for "read_fn".

2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...h @@ -80,8 +80,8 @@ struct nbd_handle { /* For debugging. */ bool debug; - void *debug_data; int (*debug_fn) (void *, const char *, const char *); + void *debug_data; /* Linked list of close callbacks. */ struct close_callback *close_callbacks; @@ -249,12 +249,12 @@ typedef int (*read_fn) (void *user_data, const void *buf, size_t count, typedef int (*callback_fn) (void *user_data, int64_t cookie, int *error); struct command_cb { - void *user_data; union { extent_fn extent; read_fn read; } fn; callback_fn callback; + void *user_data; }; struct command_in_f...
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE ** This is the generator change as discussed on the list already. The Python and OCaml bindings are not yet done. It passes all [C only] tests and valgrind. Note that nbd_add_close_callback is inconsistent with other closure types because it passes the user_data parameter after the function. (This is not caused by the current patch, it was already inconsistent). We decided that
2019 Jun 18
0
[libnbd PATCH 5/8] states: Wire in a read callback
...nternal.h b/lib/internal.h index cb0e170..a1e27df 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -233,12 +233,14 @@ struct socket { typedef int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries); +typedef int (*read_fn) (void *data, const void *buf, size_t count, + uint64_t offset, int status); struct command_cb { void *opaque; union { extent_fn extent; - /* More to come */ + read_fn read; } fn; }; -- 2.20.1
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...248,23 +247,14 @@ struct socket { const struct socket_ops *ops; }; -typedef int (*extent_fn) (unsigned valid_flag, void *user_data, - const char *metacontext, uint64_t offset, - uint32_t *entries, size_t nr_entries, int *error); -typedef int (*read_fn) (unsigned valid_flag, void *user_data, - const void *buf, size_t count, - uint64_t offset, unsigned status, int *error); -typedef int (*callback_fn) (unsigned valid_flag, void *user_data, - int *error); - struct command_cb {...
2019 Jun 29
0
[libnbd PATCH 4/6] states: Prepare for aio notify callback
...a/lib/internal.h b/lib/internal.h index 15f4b64..59074c2 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -239,6 +239,7 @@ typedef int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries, int *error); typedef int (*read_fn) (void *data, const void *buf, size_t count, uint64_t offset, int *error, int status); +typedef int (*notify_fn) (void *data, int64_t handle, int *error); struct command_cb { void *opaque; @@ -246,6 +247,7 @@ struct command_cb { extent_fn extent; read_fn read...
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD. Rich.
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...*ops; }; -typedef int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, +typedef int (*extent_fn) (void *user_data, + const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries, int *error); -typedef int (*read_fn) (void *data, const void *buf, size_t count, +typedef int (*read_fn) (void *user_data, const void *buf, size_t count, uint64_t offset, int status, int *error); -typedef int (*callback_fn) (void *data, int64_t cookie, int *error); +typedef int (*callback_fn) (void *user_data...
2019 Jun 21
0
[libnbd PATCH v2 2/5] states: Wire in a read callback
...nternal.h b/lib/internal.h index 3756fac..b79c7a9 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -233,12 +233,14 @@ struct socket { typedef int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries); +typedef int (*read_fn) (void *data, const void *buf, size_t count, + uint64_t offset, int error, int status); struct command_cb { void *opaque; union { extent_fn extent; - /* More to come */ + read_fn read; } fn; }; -- 2.20.1
2019 Jun 21
0
[libnbd PATCH v2 3/5] states: Add nbd_pread_structured API
...h, void *buf, return wait_for_command (h, ch); } +/* Issue a read command with callbacks and wait for the reply. */ +int +nbd_unlocked_pread_structured (struct nbd_handle *h, void *buf, + size_t count, uint64_t offset, + void *opaque, read_fn read, uint32_t flags) +{ + int64_t ch; + + ch = nbd_unlocked_aio_pread_structured (h, buf, count, offset, + opaque, read, flags); + if (ch == -1) + return -1; + + return wait_for_command (h, ch); +} + /* Issue a write command and wait for the reply....
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...ndle *h, void *buf, return wait_for_command (h, ch); } +/* Issue a read command with callbacks and wait for the reply. */ +int +nbd_unlocked_pread_callback (struct nbd_handle *h, void *buf, + size_t count, uint64_t offset, + void *opaque, read_fn read, uint32_t flags) +{ + int64_t ch; + + ch = nbd_unlocked_aio_pread_callback (h, buf, count, offset, + opaque, read, flags); + if (ch == -1) + return -1; + + return wait_for_command (h, ch); +} + /* Issue a write command and wait for the reply. */...
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...f int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, > +typedef int (*extent_fn) (void *user_data, > + const char *metacontext, uint64_t offset, > uint32_t *entries, size_t nr_entries, int *error); > -typedef int (*read_fn) (void *data, const void *buf, size_t count, > +typedef int (*read_fn) (void *user_data, const void *buf, size_t count, > uint64_t offset, int status, int *error); > -typedef int (*callback_fn) (void *data, int64_t cookie, int *error); > +typedef int (*callback_...
2019 Jun 21
9
[libnbd PATCH v2 0/5] nbd_pread_structured
Since v1: - rebase to applied patches - split out support for Int in callbacks - sort of test that callbacks work in OCaml (see comment in patch 5) - rename API to nbd_pread_structured - expose error as explicit parameter to callback Eric Blake (5): generator: Allow Int in callbacks states: Wire in a read callback states: Add nbd_pread_structured API states: Add tests for
2019 Jun 29
0
[libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...buf, NULL); + buf, &cb); } int64_t @@ -267,7 +278,18 @@ nbd_unlocked_aio_pread_structured (struct nbd_handle *h, void *buf, size_t count, uint64_t offset, void *opaque, read_fn read, uint32_t flags) { - struct command_cb cb = { .opaque = opaque, .fn.read = read, }; + return nbd_unlocked_aio_pread_structured_notify (h, buf, count, offset, + opaque, read, NULL, flags); +} + +int64_t +nbd_unlocked_aio_pread_structured_noti...
2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...bufv; diff --git a/lib/internal.h b/lib/internal.h index 9d88f08..dd417ea 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -253,7 +253,7 @@ typedef int (*extent_fn) (unsigned valid_flag, void *user_data, uint32_t *entries, size_t nr_entries, int *error); typedef int (*read_fn) (unsigned valid_flag, void *user_data, const void *buf, size_t count, - uint64_t offset, int status, int *error); + uint64_t offset, unsigned status, int *error); typedef int (*callback_fn) (unsigned valid_flag, void *user_dat...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...&h->bs_entries[1], (length-4) / 4, &error) == -1) if (cmd->error == 0) diff --git a/lib/internal.h b/lib/internal.h index 3f2d3f8..b2a65bc 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -269,8 +269,9 @@ struct command_cb { extent_fn extent; read_fn read; } fn; + void *fn_user_data; /* associated with one of the fn callbacks above */ callback_fn callback; - void *user_data; + void *user_data; /* associated with the callback function */ }; struct command { diff --git a/lib/rw.c b/lib/rw.c index 680b81a..7999a86 100644 --- a/lib/rw....
2019 Jun 27
1
[libnbd PATCH] block-status: Make callback usage consistent with pread_structured
...+ b/lib/internal.h @@ -232,7 +232,7 @@ struct socket { }; typedef int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, - uint32_t *entries, size_t nr_entries); + uint32_t *entries, size_t nr_entries, int *error); typedef int (*read_fn) (void *data, const void *buf, size_t count, uint64_t offset, int *error, int status); diff --git a/ocaml/examples/extents.ml b/ocaml/examples/extents.ml index b49f98e..6681446 100644 --- a/ocaml/examples/extents.ml +++ b/ocaml/examples/extents.ml @@ -16,7 +16,8 @@ let ()...
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
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...nst struct socket_ops *ops; }; -typedef int (*extent_fn) (void *user_data, +typedef int (*extent_fn) (int valid_flag, void *user_data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries, int *error); -typedef int (*read_fn) (void *user_data, const void *buf, size_t count, +typedef int (*read_fn) (int valid_flag, void *user_data, + const void *buf, size_t count, uint64_t offset, int status, int *error); -typedef int (*callback_fn) (void *user_data, int64_t cookie, int *e...
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 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...truct socket_ops *ops; }; -typedef int (*extent_fn) (void *user_data, +typedef int (*extent_fn) (unsigned valid_flag, void *user_data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries, int *error); -typedef int (*read_fn) (void *user_data, const void *buf, size_t count, +typedef int (*read_fn) (unsigned valid_flag, void *user_data, + const void *buf, size_t count, uint64_t offset, int status, int *error); -typedef int (*callback_fn) (void *user_data, int64_t cookie, i...