[sheepdog] [PATCH] sheep: fix to handle the variable type of data_length

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jan 28 02:49:53 CET 2015


At Tue, 27 Jan 2015 18:45:57 +0900,
Teruaki Ishizaki wrote:
> 
> Previously, data_length was handled as integer in some places.
> But, data_length of a request/response data type is uint32_t,
> so there were some bad behaviors.
> 
> This patch fixes to handle data_length as uint32_t.
> 
> Signed-off-by: Teruaki Ishizaki <ishizaki.teruaki at lab.ntt.co.jp>
> ---
>  include/net.h   |    2 +-
>  lib/net.c       |    3 ++-
>  sheep/request.c |    3 ++-
>  3 files changed, 5 insertions(+), 3 deletions(-)

Applied, thanks.
Hitoshi

> 
> diff --git a/include/net.h b/include/net.h
> index b8c6ab8..ee2bacb 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -39,7 +39,7 @@ int conn_tx_off(struct connection *conn);
>  int conn_tx_on(struct connection *conn);
>  int conn_rx_off(struct connection *conn);
>  int conn_rx_on(struct connection *conn);
> -int do_read(int sockfd, void *buf, int len,
> +int do_read(int sockfd, void *buf, uint32_t len,
>  	    bool (*need_retry)(uint32_t), uint32_t, uint32_t);
>  int rx(struct connection *conn, enum conn_state next_state);
>  int tx(struct connection *conn, enum conn_state next_state);
> diff --git a/lib/net.c b/lib/net.c
> index 02b328e..5b34a1c 100644
> --- a/lib/net.c
> +++ b/lib/net.c
> @@ -210,7 +210,8 @@ success:
>  	return fd;
>  }
>  
> -int do_read(int sockfd, void *buf, int len, bool (*need_retry)(uint32_t epoch),
> +int do_read(int sockfd, void *buf, uint32_t len,
> +	    bool (*need_retry)(uint32_t epoch),
>  	    uint32_t epoch, uint32_t max_count)
>  {
>  	int ret, repeat = max_count;
> diff --git a/sheep/request.c b/sheep/request.c
> index af68fbf..2f86c67 100644
> --- a/sheep/request.c
> +++ b/sheep/request.c
> @@ -683,7 +683,8 @@ worker_fn int exec_local_req_async(struct sd_req *rq, void *data,
>  	return SD_RES_SUCCESS;
>  }
>  
> -static struct request *alloc_request(struct client_info *ci, int data_length)
> +static struct request *alloc_request(struct client_info *ci,
> +				     uint32_t data_length)
>  {
>  	struct request *req;
>  
> -- 
> 1.7.1
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list