nbd: Rename NbdClientSession to NBDClientSession

It's better to use consistent capitalization of the namespace
used for NBD functions; we have more instances of NBD* than
Nbd*.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1476469998-28592-5-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Eric Blake 2016-10-14 13:33:06 -05:00 committed by Paolo Bonzini
parent 315f78abfc
commit 10676b81a9
3 changed files with 18 additions and 18 deletions

View File

@ -33,7 +33,7 @@
#define HANDLE_TO_INDEX(bs, handle) ((handle) ^ ((uint64_t)(intptr_t)bs)) #define HANDLE_TO_INDEX(bs, handle) ((handle) ^ ((uint64_t)(intptr_t)bs))
#define INDEX_TO_HANDLE(bs, index) ((index) ^ ((uint64_t)(intptr_t)bs)) #define INDEX_TO_HANDLE(bs, index) ((index) ^ ((uint64_t)(intptr_t)bs))
static void nbd_recv_coroutines_enter_all(NbdClientSession *s) static void nbd_recv_coroutines_enter_all(NBDClientSession *s)
{ {
int i; int i;
@ -46,7 +46,7 @@ static void nbd_recv_coroutines_enter_all(NbdClientSession *s)
static void nbd_teardown_connection(BlockDriverState *bs) static void nbd_teardown_connection(BlockDriverState *bs)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
if (!client->ioc) { /* Already closed */ if (!client->ioc) { /* Already closed */
return; return;
@ -68,7 +68,7 @@ static void nbd_teardown_connection(BlockDriverState *bs)
static void nbd_reply_ready(void *opaque) static void nbd_reply_ready(void *opaque)
{ {
BlockDriverState *bs = opaque; BlockDriverState *bs = opaque;
NbdClientSession *s = nbd_get_client_session(bs); NBDClientSession *s = nbd_get_client_session(bs);
uint64_t i; uint64_t i;
int ret; int ret;
@ -119,7 +119,7 @@ static int nbd_co_send_request(BlockDriverState *bs,
struct nbd_request *request, struct nbd_request *request,
QEMUIOVector *qiov) QEMUIOVector *qiov)
{ {
NbdClientSession *s = nbd_get_client_session(bs); NBDClientSession *s = nbd_get_client_session(bs);
AioContext *aio_context; AioContext *aio_context;
int rc, ret, i; int rc, ret, i;
@ -167,7 +167,7 @@ static int nbd_co_send_request(BlockDriverState *bs,
return rc; return rc;
} }
static void nbd_co_receive_reply(NbdClientSession *s, static void nbd_co_receive_reply(NBDClientSession *s,
struct nbd_request *request, struct nbd_request *request,
struct nbd_reply *reply, struct nbd_reply *reply,
QEMUIOVector *qiov) QEMUIOVector *qiov)
@ -195,7 +195,7 @@ static void nbd_co_receive_reply(NbdClientSession *s,
} }
} }
static void nbd_coroutine_start(NbdClientSession *s, static void nbd_coroutine_start(NBDClientSession *s,
struct nbd_request *request) struct nbd_request *request)
{ {
/* Poor man semaphore. The free_sema is locked when no other request /* Poor man semaphore. The free_sema is locked when no other request
@ -209,7 +209,7 @@ static void nbd_coroutine_start(NbdClientSession *s,
/* s->recv_coroutine[i] is set as soon as we get the send_lock. */ /* s->recv_coroutine[i] is set as soon as we get the send_lock. */
} }
static void nbd_coroutine_end(NbdClientSession *s, static void nbd_coroutine_end(NBDClientSession *s,
struct nbd_request *request) struct nbd_request *request)
{ {
int i = HANDLE_TO_INDEX(s, request->handle); int i = HANDLE_TO_INDEX(s, request->handle);
@ -222,7 +222,7 @@ static void nbd_coroutine_end(NbdClientSession *s,
int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset, int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov, int flags) uint64_t bytes, QEMUIOVector *qiov, int flags)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
struct nbd_request request = { struct nbd_request request = {
.type = NBD_CMD_READ, .type = NBD_CMD_READ,
.from = offset, .from = offset,
@ -248,7 +248,7 @@ int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,
int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset, int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov, int flags) uint64_t bytes, QEMUIOVector *qiov, int flags)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
struct nbd_request request = { struct nbd_request request = {
.type = NBD_CMD_WRITE, .type = NBD_CMD_WRITE,
.from = offset, .from = offset,
@ -277,7 +277,7 @@ int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset,
int nbd_client_co_flush(BlockDriverState *bs) int nbd_client_co_flush(BlockDriverState *bs)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
struct nbd_request request = { .type = NBD_CMD_FLUSH }; struct nbd_request request = { .type = NBD_CMD_FLUSH };
struct nbd_reply reply; struct nbd_reply reply;
ssize_t ret; ssize_t ret;
@ -302,7 +302,7 @@ int nbd_client_co_flush(BlockDriverState *bs)
int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, int count) int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, int count)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
struct nbd_request request = { struct nbd_request request = {
.type = NBD_CMD_TRIM, .type = NBD_CMD_TRIM,
.from = offset, .from = offset,
@ -343,7 +343,7 @@ void nbd_client_attach_aio_context(BlockDriverState *bs,
void nbd_client_close(BlockDriverState *bs) void nbd_client_close(BlockDriverState *bs)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
struct nbd_request request = { .type = NBD_CMD_DISC }; struct nbd_request request = { .type = NBD_CMD_DISC };
if (client->ioc == NULL) { if (client->ioc == NULL) {
@ -362,7 +362,7 @@ int nbd_client_init(BlockDriverState *bs,
const char *hostname, const char *hostname,
Error **errp) Error **errp)
{ {
NbdClientSession *client = nbd_get_client_session(bs); NBDClientSession *client = nbd_get_client_session(bs);
int ret; int ret;
/* NBD handshake */ /* NBD handshake */

View File

@ -17,7 +17,7 @@
#define MAX_NBD_REQUESTS 16 #define MAX_NBD_REQUESTS 16
typedef struct NbdClientSession { typedef struct NBDClientSession {
QIOChannelSocket *sioc; /* The master data channel */ QIOChannelSocket *sioc; /* The master data channel */
QIOChannel *ioc; /* The current I/O channel which may differ (eg TLS) */ QIOChannel *ioc; /* The current I/O channel which may differ (eg TLS) */
uint16_t nbdflags; uint16_t nbdflags;
@ -32,9 +32,9 @@ typedef struct NbdClientSession {
struct nbd_reply reply; struct nbd_reply reply;
bool is_unix; bool is_unix;
} NbdClientSession; } NBDClientSession;
NbdClientSession *nbd_get_client_session(BlockDriverState *bs); NBDClientSession *nbd_get_client_session(BlockDriverState *bs);
int nbd_client_init(BlockDriverState *bs, int nbd_client_init(BlockDriverState *bs,
QIOChannelSocket *sock, QIOChannelSocket *sock,

View File

@ -44,7 +44,7 @@
#define EN_OPTSTR ":exportname=" #define EN_OPTSTR ":exportname="
typedef struct BDRVNBDState { typedef struct BDRVNBDState {
NbdClientSession client; NBDClientSession client;
/* For nbd_refresh_filename() */ /* For nbd_refresh_filename() */
SocketAddress *saddr; SocketAddress *saddr;
@ -294,7 +294,7 @@ done:
return saddr; return saddr;
} }
NbdClientSession *nbd_get_client_session(BlockDriverState *bs) NBDClientSession *nbd_get_client_session(BlockDriverState *bs)
{ {
BDRVNBDState *s = bs->opaque; BDRVNBDState *s = bs->opaque;
return &s->client; return &s->client;