search for: rbuf

Displaying 20 results from an estimated 106 matches for "rbuf".

Did you mean: buf
2019 Jun 09
0
[PATCH libnbd] states: In recv_into_rbuf and send_from_wbuf loop until EAGAIN.
...EAGAIN. --- generator/states.c | 91 ++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/generator/states.c b/generator/states.c index 145e8c1..cde934a 100644 --- a/generator/states.c +++ b/generator/states.c @@ -46,43 +46,40 @@ recv_into_rbuf (struct nbd_handle *h) void *rbuf; size_t rlen; - if (h->rlen == 0) - return 0; /* move to next state */ + while (h->rlen > 0) { + /* As a special case h->rbuf is allowed to be NULL, meaning + * throw away the data. + */ + if (h->rbuf) { +...
2023 Aug 30
2
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...h> #include <stdlib.h> #include <inttypes.h> @@ -130,6 +131,7 @@ debug_call (const char **argv) */ static int call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ + bool *pipe_full, /* set if wbuf not fully written */ string *rbuf, /* read from stdout */ string *ebuf, /* read from stderr */ const char **argv) /* script + parameters */ @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ r = write (pfds[0]....
2019 Jun 09
2
[PATCH libnbd] states: In recv_into_rbuf and send_from_wbuf loop until EAGAIN.
I thought this should produce a fairly dramatic performance gain. In fact I couldn't measure any performance difference at all. I think what's happening is we're actually paying an extra syscall (to discover the socket would block) and then doing the poll anyway. So I don't know if it's worth having this patch. It could be argued that it makes the code shorter (therefore
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...t; #include <inttypes.h> > @@ -130,6 +131,7 @@ debug_call (const char **argv) > */ > static int > call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ > + bool *pipe_full, /* set if wbuf not fully written */ > string *rbuf, /* read from stdout */ > string *ebuf, /* read from stderr */ > const char **argv) /* script + parameters */ > @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ >...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...t; #include <inttypes.h> > @@ -130,6 +131,7 @@ debug_call (const char **argv) > */ > static int > call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ > + bool *pipe_full, /* set if wbuf not fully written */ > string *rbuf, /* read from stdout */ > string *ebuf, /* read from stderr */ > const char **argv) /* script + parameters */ > @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ >...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...uot;unexpected block status success\n"); exit (EXIT_FAILURE); } diff --git a/interop/structured-read.c b/interop/structured-read.c index f9014c8..d00524f 100644 --- a/interop/structured-read.c +++ b/interop/structured-read.c @@ -143,7 +143,7 @@ main (int argc, char *argv[]) memset (rbuf, 2, sizeof rbuf); data = (struct data) { .count = 2, }; - if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, &data, read_cb, + if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, read_cb, &data, 0) == -1) { fprintf (stderr, "%s\n", n...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...; > > @@ -130,6 +131,7 @@ debug_call (const char **argv) > > */ > > static int > > call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ > > + bool *pipe_full, /* set if wbuf not fully written */ > > string *rbuf, /* read from stdout */ > > string *ebuf, /* read from stderr */ > > const char **argv) /* script + parameters */ > > @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL)...
2023 Aug 31
2
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...s.h> >> @@ -130,6 +131,7 @@ debug_call (const char **argv) >> */ >> static int >> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ >> + bool *pipe_full, /* set if wbuf not fully written */ >> string *rbuf, /* read from stdout */ >> string *ebuf, /* read from stderr */ >> const char **argv) /* script + parameters */ >> @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */...
2023 Aug 31
2
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...6 +131,7 @@ debug_call (const char **argv) > >> */ > >> static int > >> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ > >> + bool *pipe_full, /* set if wbuf not fully written */ > >> string *rbuf, /* read from stdout */ > >> string *ebuf, /* read from stderr */ > >> const char **argv) /* script + parameters */ > >> @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...-130,6 +131,7 @@ debug_call (const char **argv) >>> */ >>> static int >>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ >>> + bool *pipe_full, /* set if wbuf not fully written */ >>> string *rbuf, /* read from stdout */ >>> string *ebuf, /* read from stderr */ >>> const char **argv) /* script + parameters */ >>> @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can...
2023 Jun 20
1
[libnbd PATCH v4 4/4] internal: Refactor layout of replies in sbuf
...sing_simple); > + STATIC_ASSERT (offsetof (union reply_header, structured.cookie) == > + offsetof (union reply_header, cookie), > + _cookie_aliasing_structured); > assert (h->reply_cmd == NULL); > assert (h->rlen == 0); > > - h->rbuf = &h->sbuf; > - h->rlen = sizeof h->sbuf.simple_reply; > + h->rbuf = &h->sbuf.reply.hdr; > + h->rlen = sizeof h->sbuf.reply.hdr.simple; > > r = h->sock->ops->recv (h, h->sock, h->rbuf, h->rlen); > if (r == -1) { > @@ -122...
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
2023 Aug 31
0
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...v) > >>>> */ > >>>> static int > >>>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ > >>>> + bool *pipe_full, /* set if wbuf not fully written */ > >>>> string *rbuf, /* read from stdout */ > >>>> string *ebuf, /* read from stderr */ > >>>> const char **argv) /* script + parameters */ > >>>> @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbu...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...ll (const char **argv) > >>> */ > >>> static int > >>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */ > >>> + bool *pipe_full, /* set if wbuf not fully written */ > >>> string *rbuf, /* read from stdout */ > >>> string *ebuf, /* read from stderr */ > >>> const char **argv) /* script + parameters */ > >>> @@ -275,15 +277,8 @@ call3 (const char *wbuf, size_t wbuflen, /* sen...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...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); > data = (struct data) { .count = 2, }; > - if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, read_cb, &data, > + if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, > + (nbd_chunk_callback) { .callback = read_cb, .user_dat...
2019 Jun 21
0
[libnbd PATCH v2 5/5] states: Add DF flag support for pread
...;CMD_FLAG_REQ_ONE", 1 lsl 3; "READ_DATA", 1; diff --git a/interop/structured-read.c b/interop/structured-read.c index ea47254..cf8b893 100644 --- a/interop/structured-read.c +++ b/interop/structured-read.c @@ -38,7 +38,7 @@ static const char *unixsocket; static char rbuf[1024]; struct data { - //XXX bool df; /* input: true if DF flag was passed to request */ + bool df; /* input: true if DF flag was passed to request */ int count; /* input: count of expected remaining calls */ bool fail; /* input: true to return failure */ bool s...
2019 Jun 03
1
Re: [PATCH libnbd discussion only 3/5] lib: Pass handle to socket recv and send calls.
...c | 5 +++-- > 5 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/generator/states-reply.c b/generator/states-reply.c > index 5be3431..f0ef47c 100644 > --- a/generator/states-reply.c > +++ b/generator/states-reply.c > @@ -36,7 +36,7 @@ > h->rbuf = &h->sbuf; > h->rlen = sizeof h->sbuf.simple_reply; > > - r = h->sock->ops->recv (h->sock, h->rbuf, h->rlen); > + r = h->sock->ops->recv (h, h->sock, h->rbuf, h->rlen); Do we need to pass both h and h->sock, or can the caller...
2023 Jun 09
4
[libnbd PATCH v4 0/4] Saner reply header layout
This was v3 patch 2/22, reworked to address the confusion about how a structured reply header is read in two pieces before getting to the payload portion. I'm still working on rebasing the rest of my v3 series (patches 1, 3-22) from other comments given, but this seemed independent enough that it's worth posting now rather than holding it up for the rest of the series. Eric Blake (4):
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...ot;unexpected block status success\n"); exit (EXIT_FAILURE); } diff --git a/interop/structured-read.c b/interop/structured-read.c index 0b189d1..31aadbe 100644 --- a/interop/structured-read.c +++ b/interop/structured-read.c @@ -147,7 +147,8 @@ main (int argc, char *argv[]) memset (rbuf, 2, sizeof rbuf); data = (struct data) { .count = 2, }; - if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, read_cb, &data, + if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, + (nbd_chunk_callback) { .callback = read_cb, .user_data = &data },...