[sheepdog] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Oct 23 09:13:24 CEST 2013


At Wed, 16 Oct 2013 15:38:37 +0800,
Liu Yuan wrote:
> 
> 'copies' is actually uint8_t since day one, but request headers and some helper
> functions parameterize it as uint32_t for unknown reasons and effectively
> reserve 24 bytes for possible future use. This patch explicitly set the correct
> for copies and reserve the left bytes.
> 
> This is a preparation patch that allow passing copy_policy in request header.
> 
> Cc: Kevin Wolf <kwolf at redhat.com>
> Cc: Stefan Hajnoczi <stefanha at redhat.com>
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  block/sheepdog.c |   15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 5f81c93..ca4f98b 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -125,7 +125,8 @@ typedef struct SheepdogObjReq {
>      uint32_t data_length;
>      uint64_t oid;
>      uint64_t cow_oid;
> -    uint32_t copies;
> +    uint8_t copies;
> +    uint8_t reserved[3];
>      uint32_t rsvd;
>      uint64_t offset;
>  } SheepdogObjReq;

Having both 'reserved' and 'rsvd' looks confusing.  I'd suggest
merging them into 'uint8_t reserved[7]'.

Thanks,

Kazutaka



More information about the sheepdog mailing list