search for: pread_cb

Displaying 20 results from an estimated 20 matches for "pread_cb".

Did you mean: read_cb
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...f4397d3 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -125,7 +125,7 @@ main (int argc, char *argv[]) /* Test again for callback operation. */ memset (rbuf, 0, sizeof rbuf); if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2 * sizeof rbuf, - &calls, pread_cb, 0) == -1) { + pread_cb, &calls, 0) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); } @@ -141,7 +141,7 @@ main (int argc, char *argv[]) /* Also test that callback errors are reflected correctly. */ if (nbd_pread_...
2019 Jun 25
1
[libnbd PATCH] pread_structured: Change callback type to use Mutable error
...n: + # Need a way for python to access last NBD error... + # assert nbd.get_errno == errno.EPROTO + pass diff --git a/tests/oldstyle.c b/tests/oldstyle.c index 38f5130..0207bf8 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -36,7 +36,7 @@ static const char *progname; static int pread_cb (void *data, const void *buf, size_t count, uint64_t offset, - int error, int status) + int *error, int status) { int *calls = data; ++*calls; @@ -49,7 +49,7 @@ pread_cb (void *data, const void *buf, size_t count, uint64_t offset, fprintf (stderr, "%s: callback ca...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...ex afbda61..ff2ee97 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -131,7 +131,8 @@ main (int argc, char *argv[]) /* Test again for callback operation. */ memset (rbuf, 0, sizeof rbuf); if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2 * sizeof rbuf, - pread_cb, &calls, 0) == -1) { + (nbd_chunk_callback) { .callback = pread_cb, .user_data = &calls }, + 0) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); } @@ -147,7 +148,8 @@ main (int argc, char *...
2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...(*callback_fn) (unsigned valid_flag, void *user_data, int64_t cookie, int *error); diff --git a/tests/oldstyle.c b/tests/oldstyle.c index cb0d435..95e1c97 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -39,7 +39,7 @@ static const char *progname; static int pread_cb (unsigned valid_flag, void *data, const void *buf, size_t count, uint64_t offset, - int status, int *error) + unsigned status, int *error) { int *calls; -- 2.22.0
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...d=%d, metacontext=%s, offset=%" PRIu64 ", " diff --git a/tests/oldstyle.c b/tests/oldstyle.c index afbda61..1382d06 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -37,15 +37,12 @@ static char wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; static const char *progname; static int -pread_cb (unsigned valid_flag, void *data, +pread_cb (void *data, const void *buf, size_t count, uint64_t offset, unsigned status, int *error) { int *calls; - if (!(valid_flag & LIBNBD_CALLBACK_VALID)) - return 0; - calls = data; ++*calls; diff --git a/tests/serve...
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 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 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
..." "nr_entries=%zu, error=%d\n", diff --git a/tests/oldstyle.c b/tests/oldstyle.c index f4397d3..210fd52 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -37,10 +37,16 @@ static char wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; static const char *progname; static int -pread_cb (void *data, const void *buf, size_t count, uint64_t offset, +pread_cb (int valid_flag, void *data, + const void *buf, size_t count, uint64_t offset, int status, int *error) { - int *calls = data; + int *calls; + + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) + return 0...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...d=%d, metacontext=%s, offset=%" PRIu64 ", " diff --git a/tests/oldstyle.c b/tests/oldstyle.c index ff2ee97..64862b7 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -37,15 +37,12 @@ static char wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; static const char *progname; static int -pread_cb (unsigned valid_flag, void *data, +pread_cb (void *data, const void *buf, size_t count, uint64_t offset, unsigned status, int *error) { int *calls; - if (!(valid_flag & LIBNBD_CALLBACK_VALID)) - return 0; - calls = data; ++*calls; diff --git a/tests/serve...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
..." "nr_entries=%zu, error=%d\n", diff --git a/tests/oldstyle.c b/tests/oldstyle.c index f4397d3..cb0d435 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -37,10 +37,16 @@ static char wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; static const char *progname; static int -pread_cb (void *data, const void *buf, size_t count, uint64_t offset, +pread_cb (unsigned valid_flag, void *data, + const void *buf, size_t count, uint64_t offset, int status, int *error) { - int *calls = data; + int *calls; + + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) + ret...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
..." "nr_entries=%zu, error=%d\n", diff --git a/tests/oldstyle.c b/tests/oldstyle.c index ad22b38..95e1c97 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -37,10 +37,16 @@ static char wbuf[512] = { 1, 2, 3, 4 }, rbuf[512]; static const char *progname; static int -pread_cb (void *data, const void *buf, size_t count, uint64_t offset, +pread_cb (unsigned valid_flag, void *data, + const void *buf, size_t count, uint64_t offset, unsigned status, int *error) { - int *calls = data; + int *calls; + + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) +...
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
2020 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...ternal_run (h, cmd_issue) == -1) + debug (h, "option queued, ignoring state machine failure"); + return 0; +} diff --git a/tests/newstyle-limited.c b/tests/newstyle-limited.c index f2f1cba..ab6c1c2 100644 --- a/tests/newstyle-limited.c +++ b/tests/newstyle-limited.c @@ -76,6 +76,14 @@ pread_cb (void *data, return 0; } +static int +list_cb (void *opaque, const char *name, const char *descriptiong) +{ + /* This callback is unreachable; plain newstyle can't do OPT_LIST */ + fprintf (stderr, "%s: list callback mistakenly reached", progname); + exit (EXIT_FAILURE); +} +...
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 Jun 18
17
[libnbd PATCH 0/8] Add nbd_pread_callback
I've mentioned this topic before (in fact, the idea of adding NBD_CMD_FLAG_DF was first mentioned at [1]), but finally finished enough of an implementation to feel confident in posting it. I'd still like to add something under examples/ that uses the new API to implement strict checking of a server's structured replies read implementation (ensure that a server never sends data after
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.
2020 Aug 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...ist_export_name nbd 0 in - assert (name = "a"); + assert (!exports = [ "a" ]); NBD.opt_abort nbd diff --git a/tests/newstyle-limited.c b/tests/newstyle-limited.c index f2f1cba..ab6c1c2 100644 --- a/tests/newstyle-limited.c +++ b/tests/newstyle-limited.c @@ -76,6 +76,14 @@ pread_cb (void *data, return 0; } +static int +list_cb (void *opaque, const char *name, const char *descriptiong) +{ + /* This callback is unreachable; plain newstyle can't do OPT_LIST */ + fprintf (stderr, "%s: list callback mistakenly reached", progname); + exit (EXIT_FAILURE); +} +...
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
2020 Aug 18
3
[libnbd PATCH v3 0/2] Implementing NBD_OPT_LIST
This is a subset of my v2 posting, but limited to just the NBD_OPT_LIST handling. The biggest change since v2 is the addition of added unit testing in all four language bindings (C, python, ocaml, golang). The tests require nbdkit built from git on PATH, and may not be entirely idiomatic, but I at least validated that they catch issues (for example, adding an exit statement near the end of the
2020 Aug 14
18
[libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
Well, I'm not quite done (I still want to get nbdinfo to work on a single nbd connection for all cases when reading the heads of the file is not required), but I'm happy with patches 1-11, and 12-13 show where I'm headed for getting NBD_OPT_INFO to work. Posting now to see if some of the earlier patches are ready to commit while I continue working on the latter half. Eric Blake (13):