Skip to content

Commit

Permalink
xio: minor style fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
  • Loading branch information
mitake committed Feb 21, 2016
1 parent 90f56a4 commit 3bb97b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
21 changes: 9 additions & 12 deletions sheep/xio_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct xio_context *xio_get_main_ctx(void)
}

struct client_data {
struct xio_context *ctx;
struct xio_context *ctx;
struct xio_msg *rsp;
};

Expand All @@ -53,8 +53,6 @@ static int on_msg_error(struct xio_session *session,
struct xio_msg *msg,
void *cb_user_context)
{
/* struct server_data *sdata = (struct server_data *)cb_user_context; */

if (direction == XIO_MSG_DIRECTION_OUT) {
sd_debug("**** [%p] message %lu failed. reason: %s",
session, msg->sn, xio_strerror(error));
Expand All @@ -68,7 +66,6 @@ static int on_msg_error(struct xio_session *session,
case XIO_E_MSG_FLUSHED:
break;
default:
/* xio_disconnect(sdata->connection); */
break;
};

Expand Down Expand Up @@ -101,8 +98,8 @@ static int on_session_event(struct xio_session *session,

static int client_assign_data_in_buf(struct xio_msg *msg, void *cb_user_context)
{
struct xio_iovec_ex *sglist = vmsg_sglist(&msg->in);
struct xio_reg_mem in_xbuf;
struct xio_iovec_ex *sglist = vmsg_sglist(&msg->in);
struct xio_reg_mem in_xbuf;

sd_debug("assign buffer, msg vec len: %lu", sglist[0].iov_len);
if (!sglist[0].iov_len)
Expand Down Expand Up @@ -161,14 +158,14 @@ static struct xio_connection *sd_xio_create_connection(struct xio_context *ctx,

static int client_msg_vec_init(struct xio_msg *msg)
{
msg->in.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->in.pdata_iov.max_nents = 2;
msg->in.pdata_iov.sglist =
msg->in.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->in.pdata_iov.max_nents = 2;
msg->in.pdata_iov.sglist =
(struct xio_iovec_ex *)calloc(2, sizeof(struct xio_iovec_ex));

msg->out.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->out.pdata_iov.max_nents = 1;
msg->out.pdata_iov.sglist =
msg->out.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->out.pdata_iov.max_nents = 1;
msg->out.pdata_iov.sglist =
(struct xio_iovec_ex *)calloc(1, sizeof(struct xio_iovec_ex));

return 0;
Expand Down
29 changes: 13 additions & 16 deletions sheep/xio_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/* server private data, per session */
struct server_data {
struct xio_context *ctx;
struct xio_context *ctx;

int nr_conn;
struct list_head conn_list;
Expand Down Expand Up @@ -173,13 +173,13 @@ static void msg_prep_for_reply(struct sd_rsp *rsp,

static int server_msg_vec_init(struct xio_msg *msg)
{
msg->in.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->in.pdata_iov.max_nents = 0;
msg->in.pdata_iov.sglist = NULL;
msg->in.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->in.pdata_iov.max_nents = 0;
msg->in.pdata_iov.sglist = NULL;

msg->out.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->out.pdata_iov.max_nents = 1;
msg->out.pdata_iov.sglist =
msg->out.sgl_type = XIO_SGL_TYPE_IOV_PTR;
msg->out.pdata_iov.max_nents = 1;
msg->out.pdata_iov.sglist =
(struct xio_iovec_ex *)calloc(1, sizeof(struct xio_iovec_ex));

return 0;
Expand Down Expand Up @@ -229,16 +229,13 @@ static int server_assign_data_in_buf(struct xio_msg *msg, void *cb_user_context)
return 0;
}

/*---------------------------------------------------------------------------*/
/* asynchronous callbacks */
/*---------------------------------------------------------------------------*/
static struct xio_session_ops portal_server_ops = {
.on_session_event = server_on_session_event,
.on_new_session = server_on_new_session,
.on_msg_send_complete = server_on_send_response_complete,
.on_msg = server_on_request,
.on_msg_error = NULL,
.assign_data_in_buf = server_assign_data_in_buf,
.on_session_event = server_on_session_event,
.on_new_session = server_on_new_session,
.on_msg_send_complete = server_on_send_response_complete,
.on_msg = server_on_request,
.on_msg_error = NULL,
.assign_data_in_buf = server_assign_data_in_buf,
};

static void xio_server_handler(int fd, int events, void *data)
Expand Down

0 comments on commit 3bb97b6

Please sign in to comment.