static int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s)

{

    int ret = 0;

    int i;

    VHDXHeader *hdr;



    hdr = s->headers[s->curr_header];



    /* either the log guid, or log length is zero,

     * then a replay log is present */

    for (i = 0; i < sizeof(hdr->log_guid.data4); i++) {

        ret |= hdr->log_guid.data4[i];

    }

    if (hdr->log_guid.data1 == 0 &&

        hdr->log_guid.data2 == 0 &&

        hdr->log_guid.data3 == 0 &&

        ret == 0) {

        goto exit;

    }



    /* per spec, only log version of 0 is supported */

    if (hdr->log_version != 0) {

        ret = -EINVAL;

        goto exit;

    }



    if (hdr->log_length == 0) {

        goto exit;

    }



    /* We currently do not support images with logs to replay */

    ret = -ENOTSUP;



exit:

    return ret;

}

static int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s)

{

    int ret = 0;

    int i;

    VHDXHeader *hdr;



    hdr = s->headers[s->curr_header];



    



    for (i = 0; i < sizeof(hdr->log_guid.data4); i++) {

        ret |= hdr->log_guid.data4[i];

    }

    if (hdr->log_guid.data1 == 0 &&

        hdr->log_guid.data2 == 0 &&

        hdr->log_guid.data3 == 0 &&

        ret == 0) {

        goto exit;

    }



    

    if (hdr->log_version != 0) {

        ret = -EINVAL;

        goto exit;

    }



    if (hdr->log_length == 0) {

        goto exit;

    }



    

    ret = -ENOTSUP;



exit:

    return ret;

}

static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1)

{

    int VAR_2 = 0;

    int VAR_3;

    VHDXHeader *hdr;



    hdr = VAR_1->headers[VAR_1->curr_header];



    



    for (VAR_3 = 0; VAR_3 < sizeof(hdr->log_guid.data4); VAR_3++) {

        VAR_2 |= hdr->log_guid.data4[VAR_3];

    }

    if (hdr->log_guid.data1 == 0 &&

        hdr->log_guid.data2 == 0 &&

        hdr->log_guid.data3 == 0 &&

        VAR_2 == 0) {

        goto exit;

    }



    

    if (hdr->log_version != 0) {

        VAR_2 = -EINVAL;

        goto exit;

    }



    if (hdr->log_length == 0) {

        goto exit;

    }



    

    VAR_2 = -ENOTSUP;



exit:

    return VAR_2;

}

static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1)
{ int VAR_2 = 0; int VAR_3; VHDXHeader *hdr; hdr = VAR_1->headers[VAR_1->curr_header]; for (VAR_3 = 0; VAR_3 < sizeof(hdr->log_guid.data4); VAR_3++) { VAR_2 |= hdr->log_guid.data4[VAR_3]; } if (hdr->log_guid.data1 == 0 &&
hdr->log_guid.data2 == 0 &&
hdr->log_guid.data3 == 0 &&
VAR_2 == 0) { goto exit; } if (hdr->log_version != 0) { VAR_2 = -EINVAL; goto exit; } if (hdr->log_length == 0) { goto exit; } VAR_2 = -ENOTSUP; exit:
return VAR_2; }