mirror of https://gitee.com/openkylin/qemu.git
nbd: rename some simple-request related objects to be _simple_
To be consistent when their _structured_ analogs will be introduced. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20171012095319.136610-4-vsementsov@virtuozzo.com> [eblake: also tweak trace message contents] Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
ed397b2fe7
commit
7b3158f951
|
@ -931,7 +931,7 @@ int nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, Error **errp)
|
|||
}
|
||||
|
||||
/* Reply
|
||||
[ 0 .. 3] magic (NBD_REPLY_MAGIC)
|
||||
[ 0 .. 3] magic (NBD_SIMPLE_REPLY_MAGIC)
|
||||
[ 4 .. 7] error (0 == no error)
|
||||
[ 7 .. 15] handle
|
||||
*/
|
||||
|
@ -949,7 +949,7 @@ int nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, Error **errp)
|
|||
}
|
||||
trace_nbd_receive_reply(magic, reply->error, reply->handle);
|
||||
|
||||
if (magic != NBD_REPLY_MAGIC) {
|
||||
if (magic != NBD_SIMPLE_REPLY_MAGIC) {
|
||||
error_setg(errp, "invalid magic (got 0x%" PRIx32 ")", magic);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#define NBD_OLDSTYLE_NEGOTIATE_SIZE (8 + 8 + 8 + 4 + 124)
|
||||
|
||||
#define NBD_REQUEST_MAGIC 0x25609513
|
||||
#define NBD_REPLY_MAGIC 0x67446698
|
||||
#define NBD_SIMPLE_REPLY_MAGIC 0x67446698
|
||||
#define NBD_OPTS_MAGIC 0x49484156454F5054LL
|
||||
#define NBD_CLIENT_MAGIC 0x0000420281861253LL
|
||||
#define NBD_REP_MAGIC 0x0003e889045565a9LL
|
||||
|
|
12
nbd/server.c
12
nbd/server.c
|
@ -911,11 +911,11 @@ static int nbd_send_reply(QIOChannel *ioc, NBDReply *reply, Error **errp)
|
|||
trace_nbd_send_reply(reply->error, reply->handle);
|
||||
|
||||
/* Reply
|
||||
[ 0 .. 3] magic (NBD_REPLY_MAGIC)
|
||||
[ 0 .. 3] magic (NBD_SIMPLE_REPLY_MAGIC)
|
||||
[ 4 .. 7] error (0 == no error)
|
||||
[ 7 .. 15] handle
|
||||
*/
|
||||
stl_be_p(buf, NBD_REPLY_MAGIC);
|
||||
stl_be_p(buf, NBD_SIMPLE_REPLY_MAGIC);
|
||||
stl_be_p(buf + 4, reply->error);
|
||||
stq_be_p(buf + 8, reply->handle);
|
||||
|
||||
|
@ -1208,15 +1208,15 @@ void nbd_export_close_all(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len,
|
||||
Error **errp)
|
||||
static int nbd_co_send_simple_reply(NBDRequestData *req, NBDReply *reply,
|
||||
int len, Error **errp)
|
||||
{
|
||||
NBDClient *client = req->client;
|
||||
int ret;
|
||||
|
||||
g_assert(qemu_in_coroutine());
|
||||
|
||||
trace_nbd_co_send_reply(reply->handle, reply->error, len);
|
||||
trace_nbd_co_send_simple_reply(reply->handle, reply->error, len);
|
||||
|
||||
qemu_co_mutex_lock(&client->send_lock);
|
||||
client->send_coroutine = qemu_coroutine_self();
|
||||
|
@ -1465,7 +1465,7 @@ reply:
|
|||
local_err = NULL;
|
||||
}
|
||||
|
||||
if (nbd_co_send_reply(req, &reply, reply_data_len, &local_err) < 0) {
|
||||
if (nbd_co_send_simple_reply(req, &reply, reply_data_len, &local_err) < 0) {
|
||||
error_prepend(&local_err, "Failed to send reply: ");
|
||||
goto disconnect;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ nbd_receive_request(uint32_t magic, uint16_t flags, uint16_t type, uint64_t from
|
|||
nbd_send_reply(int32_t error, uint64_t handle) "Sending response to client: { .error = %" PRId32 ", handle = %" PRIu64 " }"
|
||||
nbd_blk_aio_attached(const char *name, void *ctx) "Export %s: Attaching clients to AIO context %p\n"
|
||||
nbd_blk_aio_detach(const char *name, void *ctx) "Export %s: Detaching clients from AIO context %p\n"
|
||||
nbd_co_send_reply(uint64_t handle, uint32_t error, int len) "Send reply: handle = %" PRIu64 ", error = %" PRIu32 ", len = %d"
|
||||
nbd_co_send_simple_reply(uint64_t handle, uint32_t error, int len) "Send simple reply: handle = %" PRIu64 ", error = %" PRIu32 ", len = %d"
|
||||
nbd_co_receive_request_decode_type(uint64_t handle, uint16_t type, const char *name) "Decoding type: handle = %" PRIu64 ", type = %" PRIu16 " (%s)"
|
||||
nbd_co_receive_request_payload_received(uint64_t handle, uint32_t len) "Payload received: handle = %" PRIu64 ", len = %" PRIu32
|
||||
nbd_co_receive_request_cmd_write(uint32_t len) "Reading %" PRIu32 " byte(s)"
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
NBD_CMD_WRITE = 1
|
||||
NBD_CMD_DISC = 2
|
||||
NBD_REQUEST_MAGIC = 0x25609513
|
||||
NBD_REPLY_MAGIC = 0x67446698
|
||||
NBD_SIMPLE_REPLY_MAGIC = 0x67446698
|
||||
NBD_PASSWD = 0x4e42444d41474943
|
||||
NBD_OPTS_MAGIC = 0x49484156454F5054
|
||||
NBD_CLIENT_MAGIC = 0x0000420281861253
|
||||
|
@ -166,7 +166,7 @@ def read_request(conn):
|
|||
return req
|
||||
|
||||
def write_reply(conn, error, handle):
|
||||
buf = reply_struct.pack(NBD_REPLY_MAGIC, error, handle)
|
||||
buf = reply_struct.pack(NBD_SIMPLE_REPLY_MAGIC, error, handle)
|
||||
conn.send(buf, event='reply')
|
||||
|
||||
def handle_connection(conn, use_export):
|
||||
|
|
Loading…
Reference in New Issue