Displaying 20 results from an estimated 135 matches for "sbuf".
Did you mean:
buf
2023 Jun 20
1
[libnbd PATCH v4 4/4] internal: Refactor layout of replies in sbuf
On 6/9/23 04:17, Eric Blake wrote:
> In order to more easily add a third reply type with an even larger
> header, but where the payload will look the same for both structured
> and extended replies, it is nicer if simple and structured replies are
> nested inside the same layer of sbuf.reply.hdr. Doing this also lets
> us add an alias for accessing the cookie directly without picking
> which header type we have on hand.
>
> Visually, this patch changes the layout (on x86_64) from:
>
> offset simple structured
> +---------------------------...
2023 Jun 09
4
[libnbd PATCH v4 0/4] Saner reply header layout
...ing now rather than holding it up for the rest of
the series.
Eric Blake (4):
states: Document our reliance on type overlaps
generator: Finish parsing structured header in states-reply.c
generator: Rename states-reply-structured to states-reply-chunk
internal: Refactor layout of replies in sbuf
lib/internal.h | 16 ++-
generator/state_machine.ml | 53 ++++---
generator/states-reply.c | 65 +++++++--
...eply-structured.c => states-reply-chunk.c} | 129 ++++++++----------
generator/states-reply-simple.c...
2019 Jun 14
0
[libnbd PATCH 5/7] states: Factor out NBD_REP payload prep
...or/states-newstyle-opt-go.c b/generator/states-newstyle-opt-go.c
index 2ee739f..3458f09 100644
--- a/generator/states-newstyle-opt-go.c
+++ b/generator/states-newstyle-opt-go.c
@@ -77,21 +77,13 @@
return 0;
NEWSTYLE.OPT_GO.RECV_REPLY:
- uint32_t len;
- const size_t maxpayload = sizeof h->sbuf.or.payload;
-
switch (recv_into_rbuf (h)) {
case -1: SET_NEXT_STATE (%.DEAD); return -1;
case 0:
- /* Read the following payload if it is short enough to fit in the
- * static buffer. If it's too long, skip it.
- */
- len = be32toh (h->sbuf.or.option_reply.replylen);...
2019 Jun 14
10
[libnbd PATCH 0/7] state machine refactoring
...IN to complete a
pending reply), but this is some preliminary refactoring I found
useful. I also fixed a couple of bugs while in the area (already
pushed).
There's a question of whether we want nbd_handle to be nearly 5k, or
if we should instead keep it small and add one more indirection where
sbuf is malloc'd; I'm not sure that it matters much (outside of
libnbd, nbd_handle is an opaque type always referenced as a pointer).
Eric Blake (7):
states: Log structured error messages, if any
states: Refactor SET_META_CONTEXT reply parsing
states: Allow large SET_CONTEXT_NAME replies...
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 Jun 14
1
[libnbd PATCH] states: Validate error message size
...--- a/generator/states-reply-structured.c
+++ b/generator/states-reply-structured.c
@@ -149,21 +149,69 @@
}
REPLY.STRUCTURED_REPLY.RECV_ERROR:
+ uint32_t length, msglen;
+
switch (recv_into_rbuf (h)) {
case -1: SET_NEXT_STATE (%.DEAD); return -1;
case 0:
+ length = be32toh (h->sbuf.sr.structured_reply.length);
+ msglen = be16toh (h->sbuf.sr.payload.error.len);
+ if (msglen > length - sizeof h->sbuf.sr.payload.error) {
+ SET_NEXT_STATE (%.DEAD);
+ set_error (0, "error message length too large");
+ return -1;
+ }
+
/* We skip the...
2019 Apr 10
1
[PATCH v2 2/3] drm: switch drm_fb_xrgb8888_to_rgb565_dstclip to accept __iomem dst
...SYMBOL(drm_fb_swab16);
-static void drm_fb_xrgb8888_to_rgb565_lines(void *dst, unsigned int dst_pitch,
- void *src, unsigned int src_pitch,
- unsigned int src_linelength,
- unsigned int lines,
- bool swap)
+static void drm_fb_xrgb8888_to_rgb565_line(u16 *dbuf, u32 *sbuf,
+ unsigned int pixels,
+ bool swab)
{
- unsigned int linepixels = src_linelength / sizeof(u32);
- unsigned int x, y;
- u32 *sbuf;
- u16 *dbuf, val16;
+ unsigned int x;
+ u16 val16;
- /*
- * The cma memory is write-combined so reads are uncached.
- * Speed up by fetching one line...
2019 Jun 08
0
[PATCH libnbd 3/3] states: Use MSG_MORE to coalesce messages into single packets.
...T_STATE (%SEND_REQUEST);
return 0;
diff --git a/generator/states-newstyle-opt-export-name.c b/generator/states-newstyle-opt-export-name.c
index 774c93c..968cea8 100644
--- a/generator/states-newstyle-opt-export-name.c
+++ b/generator/states-newstyle-opt-export-name.c
@@ -25,6 +25,7 @@
h->sbuf.option.optlen = strlen (h->export_name);
h->wbuf = &h->sbuf;
h->wlen = sizeof h->sbuf.option;
+ h->wflags = MSG_MORE;
SET_NEXT_STATE (%SEND);
return 0;
diff --git a/generator/states-newstyle-opt-go.c b/generator/states-newstyle-opt-go.c
index eea70cb..06bbaca 10...
2019 Jun 18
0
[libnbd PATCH 2/8] states: Consolidate search for current reply's command
...--- a/generator/states-reply-simple.c
+++ b/generator/states-reply-simple.c
@@ -20,24 +20,15 @@
/* STATE MACHINE */ {
REPLY.SIMPLE_REPLY.START:
- struct command_in_flight *cmd;
+ struct command_in_flight *cmd = h->reply_cmd;
uint32_t error;
uint64_t handle;
error = be32toh (h->sbuf.simple_reply.error);
handle = be64toh (h->sbuf.simple_reply.handle);
- /* Find the command amongst the commands in flight. */
- for (cmd = h->cmds_in_flight; cmd != NULL; cmd = cmd->next) {
- if (cmd->handle == handle)
- break;
- }
- if (cmd == NULL) {
- SET_NEXT_STAT...
2019 Jun 18
0
[libnbd PATCH 1/8] states: Add state for structured reply completion
...6 @@
REPLY.STRUCTURED_REPLY.RECV_ERROR_TAIL:
struct command_in_flight *cmd;
- uint16_t flags;
uint64_t handle;
uint32_t error;
uint64_t offset;
@@ -234,7 +233,6 @@
switch (recv_into_rbuf (h)) {
case -1: SET_NEXT_STATE (%.DEAD); return -1;
case 0:
- flags = be16toh (h->sbuf.sr.structured_reply.flags);
handle = be64toh (h->sbuf.sr.structured_reply.handle);
error = be32toh (h->sbuf.sr.payload.error.error.error);
type = be16toh (h->sbuf.sr.structured_reply.type);
@@ -264,10 +262,7 @@
if (cmd->error == 0)
cmd->error = nbd_internal...
2019 May 23
0
[PATCH libnbd 1/3] states: Factor out common code for setting export size and eflags.
...b/generator/states-newstyle-opt-export-name.c
index 8ff1c1c..07b6c9e 100644
--- a/generator/states-newstyle-opt-export-name.c
+++ b/generator/states-newstyle-opt-export-name.c
@@ -58,13 +58,13 @@
return 0;
NEWSTYLE.OPT_EXPORT_NAME.CHECK_REPLY:
- conn->h->exportsize = be64toh (conn->sbuf.export_name_reply.exportsize);
- conn->h->eflags = be16toh (conn->sbuf.export_name_reply.eflags);
- debug (conn->h, "exportsize: %" PRIu64 " eflags: 0x%" PRIx16,
- conn->h->exportsize, conn->h->eflags);
- if (conn->h->eflags == 0) {
+ ui...
2019 Apr 10
1
[PATCH v2 3/3] drm: switch drm_fb_xrgb8888_to_rgb888_dstclip to accept __iomem dst
...T_SYMBOL(drm_fb_xrgb8888_to_rgb565_dstclip);
-static void drm_fb_xrgb8888_to_rgb888_lines(void *dst, unsigned int dst_pitch,
- void *src, unsigned int src_pitch,
- unsigned int src_linelength,
- unsigned int lines)
+static void drm_fb_xrgb8888_to_rgb888_line(u8 *dbuf, u32 *sbuf,
+ unsigned int pixels)
{
- unsigned int linepixels = src_linelength / 3;
- unsigned int x, y;
- u32 *sbuf;
- u8 *dbuf;
+ unsigned int x;
- sbuf = kmalloc(src_linelength, GFP_KERNEL);
- if (!sbuf)
- return;
-
- for (y = 0; y < lines; y++) {
- memcpy(sbuf, src, src_linelength);
- dbu...
2019 Jun 29
0
[libnbd PATCH 2/6] generator: Allow DEAD state actions to run
...+++ b/generator/states-magic.c
@@ -27,7 +27,7 @@
MAGIC.RECV_MAGIC:
switch (recv_into_rbuf (h)) {
- case -1: SET_NEXT_STATE (%.DEAD); return -1;
+ case -1: SET_NEXT_STATE (%.DEAD); return 0;
case 0: SET_NEXT_STATE (%CHECK_MAGIC);
}
return 0;
@@ -38,7 +38,7 @@
if (strncmp (h->sbuf.new_handshake.nbdmagic, "NBDMAGIC", 8) != 0) {
SET_NEXT_STATE (%.DEAD);
set_error (0, "handshake: server did not send expected NBD magic");
- return -1;
+ return 0;
}
version = be64toh (h->sbuf.new_handshake.version);
@@ -49,7 +49,7 @@
else {
SE...
2020 Aug 11
0
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...11PM -0500, Eric Blake wrote:
> diff --git a/generator/states-magic.c b/generator/states-magic.c
> index 944728d..2ad3a96 100644
> --- a/generator/states-magic.c
> +++ b/generator/states-magic.c
...
> @@ -42,8 +42,10 @@ STATE_MACHINE {
> }
>
> version = be64toh (h->sbuf.new_handshake.version);
> - if (version == NBD_NEW_VERSION)
> + if (version == NBD_NEW_VERSION) {
> + h->sbuf.option.option = 0;
> SET_NEXT_STATE (%.NEWSTYLE.START);
> + }
> else if (version == NBD_OLD_VERSION)
> SET_NEXT_STATE (%.OLDSTYLE.START);
>...
2019 Jun 08
6
[PATCH libnbd 0/3] states: Use MSG_MORE to coalesce messages.
Appears to have a measurable benefit, see 3/3 for test results.
Rich.
2020 Aug 11
3
[libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...: state machine
- * Copyright (C) 2013-2019 Red Hat Inc.
+ * Copyright (C) 2013-2020 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,8 +42,10 @@ STATE_MACHINE {
}
version = be64toh (h->sbuf.new_handshake.version);
- if (version == NBD_NEW_VERSION)
+ if (version == NBD_NEW_VERSION) {
+ h->sbuf.option.option = 0;
SET_NEXT_STATE (%.NEWSTYLE.START);
+ }
else if (version == NBD_OLD_VERSION)
SET_NEXT_STATE (%.OLDSTYLE.START);
else {
diff --git a/generator/states-new...
2020 Jul 24
4
[libnbd PATCH 0/3] Expose server block size constraints
Necessary when writing a client that wants to avoid unnecessary EINVAL
errors from sending unaligned requests.
At some point, we may want to add synchronous convenience API wrappers
that do request splitting or read-modify-write to obey server
constraints while still appearing to the library client as accepting
any possible request. But such a wrapper should only be synchronous
and not copied to
2020 Jul 20
2
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
Proposal for new APIs to list exports. The general shape of the API
can probably best be seen from the examples/list-exports.c example.
Rich.
2019 Jun 25
0
Re: [libnbd PATCH] states: Never block state machine inside REPLY
...}
> return 0;
> @@ -154,6 +158,10 @@
>
> switch (recv_into_rbuf (h)) {
> case -1: SET_NEXT_STATE (%.DEAD); return -1;
> + case 1:
> + save_reply_state (h);
> + SET_NEXT_STATE (%.READY);
> + return 0;
> case 0:
> length = be32toh (h->sbuf.sr.structured_reply.length);
> msglen = be16toh (h->sbuf.sr.payload.error.error.len);
> @@ -176,6 +184,10 @@
>
> switch (recv_into_rbuf (h)) {
> case -1: SET_NEXT_STATE (%.DEAD); return -1;
> + case 1:
> + save_reply_state (h);
> + SET_NEXT_STATE (%.REA...
2005 Jul 06
1
Error building Samba 3.0.14a on Solaris 9
Hi all,
Compiling Samba 3.0.14a on Solaris 9 with gcc 3.4.2 results in
an error:
---
Compiling libsmb/clifile.c
libsmb/clifile.c: In function `cli_unix_stat':
libsmb/clifile.c:265: error: `STAT_ST_BLOCKSIZE' undeclared
(first use in this function)
libsmb/clifile.c:265: error: (Each undeclared identifier is
reported only once
libsmb/clifile.c:265: error: for each function it