nbd: rename nbd_option and nbd_opt_reply
Rename nbd_option and nbd_opt_reply to NBDOption and NBDOptionReply to correspond to Qemu coding style and other structures here. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20171122101958.17065-5-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
9156245ec4
commit
420a4e9559
@ -28,20 +28,20 @@
|
|||||||
|
|
||||||
/* Handshake phase structs - this struct is passed on the wire */
|
/* Handshake phase structs - this struct is passed on the wire */
|
||||||
|
|
||||||
struct nbd_option {
|
struct NBDOption {
|
||||||
uint64_t magic; /* NBD_OPTS_MAGIC */
|
uint64_t magic; /* NBD_OPTS_MAGIC */
|
||||||
uint32_t option; /* NBD_OPT_* */
|
uint32_t option; /* NBD_OPT_* */
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
} QEMU_PACKED;
|
} QEMU_PACKED;
|
||||||
typedef struct nbd_option nbd_option;
|
typedef struct NBDOption NBDOption;
|
||||||
|
|
||||||
struct nbd_opt_reply {
|
struct NBDOptionReply {
|
||||||
uint64_t magic; /* NBD_REP_MAGIC */
|
uint64_t magic; /* NBD_REP_MAGIC */
|
||||||
uint32_t option; /* NBD_OPT_* */
|
uint32_t option; /* NBD_OPT_* */
|
||||||
uint32_t type; /* NBD_REP_* */
|
uint32_t type; /* NBD_REP_* */
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
} QEMU_PACKED;
|
} QEMU_PACKED;
|
||||||
typedef struct nbd_opt_reply nbd_opt_reply;
|
typedef struct NBDOptionReply NBDOptionReply;
|
||||||
|
|
||||||
/* Transmission phase structs
|
/* Transmission phase structs
|
||||||
*
|
*
|
||||||
|
12
nbd/client.c
12
nbd/client.c
@ -66,7 +66,7 @@ static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,
|
|||||||
uint32_t len, const char *data,
|
uint32_t len, const char *data,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
nbd_option req;
|
NBDOption req;
|
||||||
QEMU_BUILD_BUG_ON(sizeof(req) != 16);
|
QEMU_BUILD_BUG_ON(sizeof(req) != 16);
|
||||||
|
|
||||||
if (len == -1) {
|
if (len == -1) {
|
||||||
@ -109,7 +109,7 @@ static void nbd_send_opt_abort(QIOChannel *ioc)
|
|||||||
* payload. Return 0 if successful, -1 with errp set if it is
|
* payload. Return 0 if successful, -1 with errp set if it is
|
||||||
* impossible to continue. */
|
* impossible to continue. */
|
||||||
static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
|
static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
|
||||||
nbd_opt_reply *reply, Error **errp)
|
NBDOptionReply *reply, Error **errp)
|
||||||
{
|
{
|
||||||
QEMU_BUILD_BUG_ON(sizeof(*reply) != 20);
|
QEMU_BUILD_BUG_ON(sizeof(*reply) != 20);
|
||||||
if (nbd_read(ioc, reply, sizeof(*reply), errp) < 0) {
|
if (nbd_read(ioc, reply, sizeof(*reply), errp) < 0) {
|
||||||
@ -146,7 +146,7 @@ static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
|
|||||||
* can fall back to other approaches), or -1 with errp set for other
|
* can fall back to other approaches), or -1 with errp set for other
|
||||||
* errors.
|
* errors.
|
||||||
*/
|
*/
|
||||||
static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
|
static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
@ -239,7 +239,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
|
|||||||
static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
|
static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
nbd_opt_reply reply;
|
NBDOptionReply reply;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
uint32_t namelen;
|
uint32_t namelen;
|
||||||
char name[NBD_MAX_NAME_SIZE + 1];
|
char name[NBD_MAX_NAME_SIZE + 1];
|
||||||
@ -325,7 +325,7 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
|
|||||||
static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
|
static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
|
||||||
NBDExportInfo *info, Error **errp)
|
NBDExportInfo *info, Error **errp)
|
||||||
{
|
{
|
||||||
nbd_opt_reply reply;
|
NBDOptionReply reply;
|
||||||
uint32_t len = strlen(wantname);
|
uint32_t len = strlen(wantname);
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
int error;
|
int error;
|
||||||
@ -517,7 +517,7 @@ static int nbd_receive_query_exports(QIOChannel *ioc,
|
|||||||
*/
|
*/
|
||||||
static int nbd_request_simple_option(QIOChannel *ioc, int opt, Error **errp)
|
static int nbd_request_simple_option(QIOChannel *ioc, int opt, Error **errp)
|
||||||
{
|
{
|
||||||
nbd_opt_reply reply;
|
NBDOptionReply reply;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (nbd_send_option_request(ioc, opt, 0, NULL, errp) < 0) {
|
if (nbd_send_option_request(ioc, opt, 0, NULL, errp) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user