static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset,

                      const uint8_t *buf, int count)

{

    BDRVRawState *s = bs->opaque;

    int ret;



    ret = fd_open(bs);

    if (ret < 0)

        return -errno;



    ret = pwrite(s->fd, buf, count, offset);

    if (ret == count)

        goto label__raw_write__success;



    DEBUG_BLOCK_PRINT("raw_pwrite(%d:%s, %" PRId64 ", %p, %d) [%" PRId64

                      "] write failed %d : %d = %s\n",

                      s->fd, bs->filename, offset, buf, count,

                      bs->total_sectors, ret, errno, strerror(errno));



label__raw_write__success:



    return  (ret < 0) ? -errno : ret;

}

static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset,

                      const uint8_t *buf, int count)

{

    BDRVRawState *s = bs->opaque;

    int ret;



    ret = fd_open(bs);

    if (ret < 0)

        return -errno;



    ret = pwrite(s->fd, buf, count, offset);

    if (ret == count)

        goto label__raw_write__success;



    DEBUG_BLOCK_PRINT("raw_pwrite(%d:%s, %" PRId64 ", %p, %d) [%" PRId64

                      "] write failed %d : %d = %s\n",

                      s->fd, bs->filename, offset, buf, count,

                      bs->total_sectors, ret, errno, strerror(errno));



label__raw_write__success:



    return  (ret < 0) ? -errno : ret;

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,

                      const uint8_t *VAR_2, int VAR_3)

{

    BDRVRawState *s = VAR_0->opaque;

    int VAR_4;



    VAR_4 = fd_open(VAR_0);

    if (VAR_4 < 0)

        return -errno;



    VAR_4 = pwrite(s->fd, VAR_2, VAR_3, VAR_1);

    if (VAR_4 == VAR_3)

        goto label__raw_write__success;



    DEBUG_BLOCK_PRINT("raw_pwrite(%d:%s, %" PRId64 ", %p, %d) [%" PRId64

                      "] write failed %d : %d = %s\n",

                      s->fd, VAR_0->filename, VAR_1, VAR_2, VAR_3,

                      VAR_0->total_sectors, VAR_4, errno, strerror(errno));



label__raw_write__success:



    return  (VAR_4 < 0) ? -errno : VAR_4;

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
const uint8_t *VAR_2, int VAR_3)
{ BDRVRawState *s = VAR_0->opaque; int VAR_4; VAR_4 = fd_open(VAR_0); if (VAR_4 < 0)
return -errno; VAR_4 = pwrite(s->fd, VAR_2, VAR_3, VAR_1); if (VAR_4 == VAR_3)
goto label__raw_write__success; DEBUG_BLOCK_PRINT("raw_pwrite(%d:%s, %" PRId64 ", %p, %d) [%" PRId64
"] write failed %d : %d = %s\n",
s->fd, VAR_0->filename, VAR_1, VAR_2, VAR_3,
VAR_0->total_sectors, VAR_4, errno, strerror(errno)); label__raw_write__success:
return  (VAR_4 < 0) ? -errno : VAR_4; }