search for: htobe16

Displaying 20 results from an estimated 69 matches for "htobe16".

2020 Sep 28
0
[RFC PATCH 15/19] tools/vhost-user-rpmb: implement VIRTIO_RPMB_REQ_DATA_WRITE
...->last_reqresp, r->last_result); >> >> - if (r->last_reqresp == VIRTIO_RPMB_RESP_PROGRAM_KEY || >> - r->last_reqresp == VIRTIO_RPMB_REQ_DATA_WRITE) { >> + if (r->last_reqresp == VIRTIO_RPMB_RESP_PROGRAM_KEY) { >> resp->result = htobe16(r->last_result); >> resp->req_resp = htobe16(r->last_reqresp); >> + } else if (r->last_reqresp == VIRTIO_RPMB_RESP_DATA_WRITE) { >> + resp->result = htobe16(r->last_result); >> + resp->req_resp = htobe16(r->last_reqresp); &gt...
2019 Mar 08
2
[PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...+ */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&conn->write_lock); + struct structured_reply reply; + struct structured_reply_offset_data offset_data; + int r; + + assert (cmd == NBD_CMD_READ); + + reply.magic = htobe32 (NBD_STRUCTURED_REPLY_MAGIC); + reply.handle = handle; + reply.flags = htobe16 (NBD_REPLY_FLAG_DONE); + reply.type = htobe16 (NBD_REPLY_TYPE_OFFSET_DATA); + reply.length = htobe32 (sizeof offset_data + count); + + r = conn->send (conn, &reply, sizeof reply); + if (r == -1) { + nbdkit_error ("write reply: %s: %m", name_of_nbd_cmd (cmd)); + return set...
2016 Sep 26
1
[PATCH] nbdkit: flags are 32 bits for oldstyle connections
...s); + debug ("oldstyle negotiation: server flags: 0x%x", flags); memset (&handshake, 0, sizeof handshake); memcpy (handshake.nbdmagic, "NBDMAGIC", 8); handshake.version = htobe64 (OLD_VERSION); handshake.exportsize = htobe64 (exportsize); - handshake.gflags = htobe16 (gflags); - handshake.eflags = htobe16 (eflags); + handshake.flags = htobe32 (flags); if (xwrite (conn->sockout, &handshake, sizeof handshake) == -1) { nbdkit_error ("write: %m"); diff -r d7d5078d08c7 -r dbd1ea0a401c src/protocol.h --- a/src/protocol.h Sun Sep 25 05:04:...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...gotiation: flags: global 0x%x export 0x%x", - gflags, eflags); - - memset (&handshake, 0, sizeof handshake); - memcpy (handshake.nbdmagic, "NBDMAGIC", 8); - handshake.version = htobe64 (OLD_VERSION); - handshake.exportsize = htobe64 (exportsize); - handshake.gflags = htobe16 (gflags); - handshake.eflags = htobe16 (eflags); - - if (conn->send (conn, &handshake, sizeof handshake) == -1) { - nbdkit_error ("write: %m"); - return -1; - } - - return 0; -} - -/* Receive newstyle options. */ - -static int -send_newstyle_option_reply (struct connectio...
2019 Mar 18
3
[PATCH nbdkit 0/2] server: Split out NBD protocol code from connections code.
These are a couple of patches in preparation for the Block Status implementation. While the patches (especially the second one) are very large they are really just elementary code motion. Rich.
2019 Jun 06
0
[nbdkit PATCH 2/2] server: Cork around grouped transmission send()s
..._reply_read (struct connection *conn, assert (cmd == NBD_CMD_READ); + if (conn->cork) { + r = conn->cork (conn, true); + assert (r == 0); /* For now, only uncorking can fail */ + } + reply.magic = htobe32 (NBD_STRUCTURED_REPLY_MAGIC); reply.handle = handle; reply.flags = htobe16 (NBD_REPLY_FLAG_DONE); @@ -459,6 +477,14 @@ send_structured_reply_read (struct connection *conn, return connection_set_status (conn, -1); } + if (conn->cork) { + r = conn->cork (conn, false); + if (r == -1) { + nbdkit_error ("write uncork: %s: %m", name_of_nbd_c...
2018 Aug 06
0
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
...y; + struct fixed_new_option_reply_info_export export; + + fixed_new_option_reply.magic = htobe64 (NBD_REP_MAGIC); + fixed_new_option_reply.option = htobe32 (option); + fixed_new_option_reply.reply = htobe32 (reply); + fixed_new_option_reply.replylen = htobe32 (sizeof export); + export.info = htobe16 (info); + export.exportsize = htobe64 (conn->exportsize); + export.eflags = htobe16 (conn->eflags); + + if (conn->send (conn, + &fixed_new_option_reply, + sizeof fixed_new_option_reply) == -1 || + conn->send (conn, &export, sizeof export...
2019 Jun 07
4
[nbdkit PATCH v2 0/2] Reduce network overhead with MSG_MORE/corking
This time around, the numbers are indeed looking better than in v1; and I like the interface better. Eric Blake (2): server: Prefer send() over write() server: Group related transmission send()s server/internal.h | 7 +++- server/connections.c | 51 +++++++++++++++++++++++++--- server/crypto.c | 11 ++++--
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...ocol_handshake_newstyle (struct connection *conn) debug ("newstyle negotiation: flags: global 0x%x", gflags); memcpy (handshake.nbdmagic, "NBDMAGIC", 8); - handshake.version = htobe64 (NEW_VERSION); + handshake.version = htobe64 (NBD_NEW_VERSION); handshake.gflags = htobe16 (gflags); if (conn->send (conn, &handshake, sizeof handshake, 0) == -1) { diff --git a/server/protocol-handshake-oldstyle.c b/server/protocol-handshake-oldstyle.c index 87cb265..8faa4f0 100644 --- a/server/protocol-handshake-oldstyle.c +++ b/server/protocol-handshake-oldstyle.c @@ -46,7...
2023 May 30
2
[libnbd PATCH v3 04/22] states: Prepare to send 64-bit requests
...pdated in this patch to cover extended headers. > > +++ b/generator/states-issue-command.c > > @@ -41,15 +41,24 @@ ISSUE_COMMAND.START: > > return 0; > > } > > > > - h->request.magic = htobe32 (NBD_REQUEST_MAGIC); > > - h->request.flags = htobe16 (cmd->flags); > > - h->request.type = htobe16 (cmd->type); > > - h->request.handle = htobe64 (cmd->cookie); > > - h->request.offset = htobe64 (cmd->offset); > > - h->request.count = htobe32 (cmd->count); > > + /* These fields are coincid...
2020 Sep 25
20
[RFC PATCH 00/19] vhost-user-rpmb (Replay Protected Memory Block)
Hi, This is an initial implementation of a vhost-user backend for the VirtIO RPMB device. The device is currently in the draft of the next VirtIO specification and describes block device which uses combination of a key, nonce, hashing and a persistent write counter to prevent replay attacks (hence Replay Protected Memory Block). It is implemented as a vhost-user device because we want to
2018 Aug 06
3
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
There's no substantial difference over v1, I simply fixed a few whitespace issues, moved one struct around and tidied up the comments. Rich.
2019 Aug 30
0
[nbdkit PATCH 5/9] server: Cache per-connection size
...n_reply fixed_new_option_reply; struct fixed_new_option_reply_info_export export; @@ -127,7 +127,7 @@ send_newstyle_option_reply_info_export (struct connection *conn, fixed_new_option_reply.reply = htobe32 (reply); fixed_new_option_reply.replylen = htobe32 (sizeof export); export.info = htobe16 (info); - export.exportsize = htobe64 (conn->exportsize); + export.exportsize = htobe64 (exportsize); export.eflags = htobe16 (conn->eflags); if (conn->send (conn, @@ -201,7 +201,7 @@ conn_recv_full (struct connection *conn, void *buf, size_t len, * in that function. */ stati...
2018 Aug 04
3
[PATCH nbdkit] protocol: Implement NBD_OPT_GO.
This is only lightly tested (against just qemu NBD client), and the code might be structured a little better as the _negotiate_handshake_newstyle_options function has now grown to be huge. Anyway works for me. Rich.
2019 May 21
0
[libnbd PATCH 3/3] states: Allow in-flight read while writing next command
...eply to an earlier command? */ + if (conn->wlen) { + if (conn->in_write_payload) + SET_NEXT_STATE(%SEND_WRITE_PAYLOAD); + else + SET_NEXT_STATE(%SEND_REQUEST); + return 0; + } + conn->sbuf.request.magic = htobe32 (NBD_REQUEST_MAGIC); conn->sbuf.request.flags = htobe16 (cmd->flags); conn->sbuf.request.type = htobe16 (cmd->type); @@ -43,12 +52,18 @@ } return 0; + ISSUE_COMMAND.PAUSE_SEND_REQUEST: + assert (conn->wlen); + assert (conn->cmds_to_issue != NULL); + conn->in_write_payload = false; + SET_NEXT_STATE (%^REPLY.START); + retu...
2019 May 22
0
[libnbd PATCH v2 4/5] states: Allow in-flight read while writing next command
...eply to an earlier command? */ + if (conn->wlen) { + if (conn->in_write_payload) + SET_NEXT_STATE(%SEND_WRITE_PAYLOAD); + else + SET_NEXT_STATE(%SEND_REQUEST); + return 0; + } + conn->sbuf.request.magic = htobe32 (NBD_REQUEST_MAGIC); conn->sbuf.request.flags = htobe16 (cmd->flags); conn->sbuf.request.type = htobe16 (cmd->type); @@ -43,12 +52,18 @@ } return 0; + ISSUE_COMMAND.PAUSE_SEND_REQUEST: + assert (conn->wlen); + assert (conn->cmds_to_issue != NULL); + conn->in_write_payload = false; + SET_NEXT_STATE (%^REPLY.START); + retu...
2019 Mar 08
0
Re: [PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...p;conn->write_lock); > + struct structured_reply reply; > + struct structured_reply_offset_data offset_data; > + int r; > + > + assert (cmd == NBD_CMD_READ); > + > + reply.magic = htobe32 (NBD_STRUCTURED_REPLY_MAGIC); > + reply.handle = handle; > + reply.flags = htobe16 (NBD_REPLY_FLAG_DONE); > + reply.type = htobe16 (NBD_REPLY_TYPE_OFFSET_DATA); > + reply.length = htobe32 (sizeof offset_data + count); This line is correct, but I had to remind myself of C precedence rules on this one; writing 'count + sizeof offset_data' instead has the same effec...
2019 Mar 08
1
Re: [PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...either way really. The sed magic uses the symbol (eg. NBD_REPLY_TYPE_ERROR) not the value so either should work. I'll play around with it to see which looks nicer. > > + reply.magic = htobe32 (NBD_STRUCTURED_REPLY_MAGIC); > > + reply.handle = handle; > > + reply.flags = htobe16 (NBD_REPLY_FLAG_DONE); > > + reply.type = htobe16 (NBD_REPLY_TYPE_OFFSET_DATA); > > + reply.length = htobe32 (sizeof offset_data + count); > > This line is correct, but I had to remind myself of C precedence rules > on this one; writing 'count + sizeof offset_data' i...
2019 Sep 25
3
[nbdkit PATCH 0/2] more protocol.h tweaks
More nbd-protocol.h improvements Eric Blake (2): common/protocol: Switch nbdmagic to uint64_t common/protocol: Declare additional constants common/protocol/nbd-protocol.h | 16 ++++++++++------ server/protocol-handshake-newstyle.c | 2 +- server/protocol-handshake-oldstyle.c | 2 +- plugins/nbd/nbd-standalone.c | 2 +- tests/test-layers.c | 2 +- 5 files
2019 Jun 07
0
[nbdkit PATCH v2 2/2] server: Group related transmission send()s
...f reply, 0); + r = conn->send (conn, &reply, sizeof reply, f); if (r == -1) { nbdkit_error ("write reply: %s: %m", name_of_nbd_cmd (cmd)); return connection_set_status (conn, -1); @@ -439,7 +440,7 @@ send_structured_reply_read (struct connection *conn, reply.type = htobe16 (NBD_REPLY_TYPE_OFFSET_DATA); reply.length = htobe32 (count + sizeof offset_data); - r = conn->send (conn, &reply, sizeof reply, 0); + r = conn->send (conn, &reply, sizeof reply, SEND_MORE); if (r == -1) { nbdkit_error ("write reply: %s: %m", name_of_nbd_cmd (c...