search for: nbd_pread

Displaying 20 results from an estimated 120 matches for "nbd_pread".

2019 Sep 11
1
Re: [PATCH nbdkit] tests: Convert some tests to use nbdsh instead of qemu-io.
...nsition: NEWSTYLE.OPT_GO.RECV_REPLY_PAYLOAD -> NEWSTYLE.OPT_GO.CHECK_REPLY libnbd: debug: nbd5: nbd_connect_uri: transition: NEWSTYLE.OPT_GO.CHECK_REPLY -> READY libnbd: debug: nbd5: nbd_connect_uri: leave: ret=0 nbdkit: debug: starting worker thread full.0 nbdkit: debug: libnbd: debug: nbd5: nbd_pread: enter: buf=<buf> count=512 offset=0 flags=0x0 starting worker thread full.1libnbd: debug: nbd5: nbd_pread: event CmdIssue: READY -> ISSUE_COMMAND.START libnbd: debug: nbd5: nbd_pread: transition: ISSUE_COMMAND.START -> ISSUE_COMMAND.SEND_REQUEST libnbd: debug: nbd5: nbd_pread: transit...
2019 Sep 11
4
[PATCH nbdkit] tests: Convert some tests to use nbdsh instead of qemu-io.
Very much a work in progress as there are still many tests using qemu-io which are candidates for conversion. You'll notice at the end of test-full.sh that the new test has some duplicated code which looks as if it ought to be refactored into a Python function. When I tried to do that, I got loads of strange Python problems which may indicate bugs in nbdsh itself or problems with my
2019 Jun 28
3
[libnbd PATCH] tests: Enhance errors test
...36 @@ main (int argc, char *argv[]) argv[0]); exit (EXIT_FAILURE); } - msg = nbd_get_error (); - errnum = nbd_get_errno (); - printf ("error: \"%s\"\n", msg); - printf ("errno: %d (%s)\n", errnum, strerror (errnum)); - if (strncmp (msg, "nbd_pread: ", strlen ("nbd_pread: ")) != 0) { - fprintf (stderr, "%s: test failed: missing context prefix: %s\n", - argv[0], msg); + check (ENOTCONN, "nbd_pread: "); + + /* Request a name that is too long. */ + memset (buf, 'a', 4999); + buf[4999]...
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...ite", { @@ -2123,10 +2149,12 @@ Or supply the optional C<completion_callback> which will be invoked as described in L<libnbd(3)/Completion callbacks>. Note that you must ensure C<buf> is valid until the command has -completed. Other parameters behave as documented in L<nbd_pread(3)>."; +completed. Other parameters behave as documented in L<nbd_pread(3)>." +^ strict_call_description; example = Some "examples/aio-connect-read.c"; see_also = [SectionLink "Issuing asynchronous commands"; - Link "aio_pread_st...
2019 May 28
6
[RFC libnbd PATCH 0/4] Add CMD_FLAG_DF support
RFC because this is an API break, but we haven't declared stable API yet. If we like it, I'm working on using libnbd to implement the nbdkit-nbd plugin; knowing whether it is API version 0.1 or 0.2 will be useful. I also dabbled with allowing optional parameters in python, although my OCaml is weak enough that there may be cleaner ways to approach that. Eric Blake (4): api: Add flags
2020 Sep 04
0
[libnbd PATCH 2/2] api: Add STRICT_BOUNDS to nbd_set_strict_mode
...); - /* Read from an invalid offset */ + /* Read from an invalid offset, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_BOUNDS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_pread (nbd, NULL, 0, -1, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with bogus offset\n", + argv[0]); + exit (EXIT_FAILURE); + } + check (EINVAL, "nbd_pread: "); + /* Read from an invalid offset, server-side...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...3,10 +2149,12 @@ Or supply the optional C<completion_callback> which will be invoked > as described in L<libnbd(3)/Completion callbacks>. > > Note that you must ensure C<buf> is valid until the command has > -completed. Other parameters behave as documented in L<nbd_pread(3)>."; > +completed. Other parameters behave as documented in L<nbd_pread(3)>." > +^ strict_call_description; > example = Some "examples/aio-connect-read.c"; > see_also = [SectionLink "Issuing asynchronous commands"; > -...
2020 Sep 11
0
[libnbd PATCH v2 5/5] api: Add STRICT_BOUNDS/ZERO_SIZE to nbd_set_strict_mode
...); - /* Read from an invalid offset */ + /* Read from an invalid offset, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_BOUNDS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_pread (nbd, buf, 1, -1, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with bogus offset\n", + argv[0]); + exit (EXIT_FAILURE); + } + check (EINVAL, "nbd_pread: "); + /* Read from an invalid offset, server-side *...
2020 Sep 04
4
[RFC libnbd PATCH 0/2] Add knobs for client- vs. server-side validation
We have been inconsistent on how much we reject client-side without even consulting the server, vs. how much we depend on the server to detect failure (even if our request can be deemed undefined per NBD protocol). I'd like to change it so that by default, we reject as much as we can client-side for less traffic, but where the user can also change things on the fly for server-side integration
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2: - now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE - four flags instead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add
2020 Sep 04
0
[libnbd PATCH 1/2] api: Add nbd_set_strict_mode
...gc, char *argv[]) */ const char *cmd[] = { "nbdkit", "-s", "--exit-with-parent", "sh", script, NULL }; + uint32_t strict; progname = argv[0]; @@ -214,7 +215,25 @@ main (int argc, char *argv[]) } check (EINVAL, "nbd_pread: "); - /* Use unknown command flags */ + /* Use unknown command flags, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_COMMANDS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } +...
2020 Sep 11
0
[libnbd PATCH v2 1/5] api: Add xxx_MASK constant for each Flags type
...rtions(+), 31 deletions(-) diff --git a/docs/libnbd.pod b/docs/libnbd.pod index f2ba3bb..d8dffea 100644 --- a/docs/libnbd.pod +++ b/docs/libnbd.pod @@ -520,6 +520,13 @@ To get the size of the export in bytes, use L<nbd_get_size(3)>: You can read and write data from the NBD server using L<nbd_pread(3)> and L<nbd_pwrite(3)> or their asynchronous equivalents. +All data commands support a C<flags> argument (mandatory in C, but +optional in languages where it can default to 0). For convenience, +the constant C<LIBNBD_CMD_FLAG_MASK> is defined with the set of flags +current...
2019 Aug 15
2
Re: [PATCH libnbd v2 10/10] generator: Check requirements for BytesPersistIn/Out and completion callbacks.
...completed/nbd_aio_peek_command_completed Keeping nbd_connect_command may be okay (it takes a command line to create a subprocess), but we may want to rename nbd_kill_command to nbd_kill_child or similar, to make it obvious that it is NOT associated with attempting an early abort of any synchronous nbd_pread or other commands issued to the server. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
2019 Aug 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function rather than libnbd-api.3 (nice), but in doing so got stumped by a problem with a fresh git clone (automake fails for any 'include' directive that does not already exist). I've figured out how to hack around it, but the hack requires GNU make. We already use GNU make constructs elsewhere (such as $(wildcard)), but
2019 Aug 10
2
Re: [PATCH libnbd 7/9] generator: On entry to API functions, check Flags and OFlags parameters.
...%s);\n" n n; > + pr " ret = %s;\n" value; > + pr " goto out;\n"; Some of the checks in lib/rw.c are now unreachable with this in place. Is it worth simplifying that? (But not all of them - there are still checks that depend on runtime values, such as nbd_pread accepting _DF only if the server advertises it after the client requests structured replies). Also, this lets us pass all four existing command flags to all commands that accept an OFlags parameter, even though none of the commands accept all flags at once - the real protection being added here is...
2019 Jul 03
1
[libnbd PATCH] tests: Make errors more robust under load
...ot;, nbd_get_error ()); @@ -167,13 +227,29 @@ main (int argc, char *argv[]) } check (ERANGE, "nbd_aio_pwrite: "); - /* Queue up a write command so large that we block on POLLIN, then queue - * multiple disconnects. + /* Send a read that the nbdkit sh plugin will fail. */ + if (nbd_pread (nbd, buf, 512, 0, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not report server failure\n", + argv[0]); + exit (EXIT_FAILURE); + } + check (ENOMEM, "nbd_pread: "); + + /* Queue up two write commands so large tha...
2019 Aug 11
1
Re: [PATCH libnbd 7/9] generator: On entry to API functions, check Flags and OFlags parameters.
...W.M. Jones wrote: > On Sat, Aug 10, 2019 at 04:38:20PM -0500, Eric Blake wrote: > > Some of the checks in lib/rw.c are now unreachable with this in place. > > Is it worth simplifying that? (But not all of them - there are still > > checks that depend on runtime values, such as nbd_pread accepting _DF > > only if the server advertises it after the client requests structured > > replies). Also, this lets us pass all four existing command flags to > > all commands that accept an OFlags parameter, even though none of the > > commands accept all flags at once -...
2019 Aug 06
5
[PATCH libnbd 0/3] One API and small documentation changes.
One API change, some small documentation changes.
2020 Mar 25
1
Re: [PATCH libnbd v4] Add Go language bindings (golang) (RHBZ#1814538).
...s://github.com/libguestfs/libnbd/blob/master/examples/glib-main-loop.c Integration with poll(2): https://github.com/libguestfs/libnbd/blob/a5fe64ab5323d649d348e61c9126ef7e7234c145/examples/batched-read-write.c#L69 It currently works from golang too, but it seems likely that synchronous calls like nbd_pread are blocking the golang main loop (because we make our own call to poll(2)). The asynch stuff also works (see libnbd_590_aio_copy_test.go in the attached patch) but it's rather awkward. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programmin...
2019 Jun 29
0
[libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...| 99 ++++++++++++++-- 3 files changed, 374 insertions(+), 25 deletions(-) diff --git a/docs/libnbd.pod b/docs/libnbd.pod index ede2539..93e80d4 100644 --- a/docs/libnbd.pod +++ b/docs/libnbd.pod @@ -169,7 +169,27 @@ has completed: } For almost all high level synchronous calls (eg. C<nbd_pread>) there -is a low level asynchronous equivalent (eg. C<nbd_aio_pread>). +are two low level asynchronous equivalents (eg. C<nbd_aio_pread> for +starting a command, and C<nbd_aio_pread_notify> for also registering +a callback to be invoked right before the command is complete). +...