static void do_change_block(const char *device, const char *filename, const char *fmt)

{

    BlockDriverState *bs;

    BlockDriver *drv = NULL;



    bs = bdrv_find(device);

    if (!bs) {

        term_printf("device not found\n");

        return;

    }

    if (fmt) {

        drv = bdrv_find_format(fmt);

        if (!drv) {

            term_printf("invalid format %s\n", fmt);

            return;

        }

    }

    if (eject_device(bs, 0) < 0)

        return;

    bdrv_open2(bs, filename, 0, drv);

    qemu_key_check(bs, filename);

}

static void do_change_block(const char *device, const char *filename, const char *fmt)

{

    BlockDriverState *bs;

    BlockDriver *drv = NULL;



    bs = bdrv_find(device);

    if (!bs) {

        term_printf("device not found\n");

        return;

    }

    if (fmt) {

        drv = bdrv_find_format(fmt);

        if (!drv) {

            term_printf("invalid format %s\n", fmt);

            return;

        }

    }

    if (eject_device(bs, 0) < 0)

        return;

    bdrv_open2(bs, filename, 0, drv);

    qemu_key_check(bs, filename);

}

static void FUNC_0(const char *VAR_0, const char *VAR_1, const char *VAR_2)

{

    BlockDriverState *bs;

    BlockDriver *drv = NULL;



    bs = bdrv_find(VAR_0);

    if (!bs) {

        term_printf("VAR_0 not found\n");

        return;

    }

    if (VAR_2) {

        drv = bdrv_find_format(VAR_2);

        if (!drv) {

            term_printf("invalid format %s\n", VAR_2);

            return;

        }

    }

    if (eject_device(bs, 0) < 0)

        return;

    bdrv_open2(bs, VAR_1, 0, drv);

    qemu_key_check(bs, VAR_1);

}

static void FUNC_0(const char *VAR_0, const char *VAR_1, const char *VAR_2)
{ BlockDriverState *bs; BlockDriver *drv = NULL; bs = bdrv_find(VAR_0); if (!bs) { term_printf("VAR_0 not found\n"); return; } if (VAR_2) { drv = bdrv_find_format(VAR_2); if (!drv) { term_printf("invalid format %s\n", VAR_2); return; } } if (eject_device(bs, 0) < 0)
return; bdrv_open2(bs, VAR_1, 0, drv); qemu_key_check(bs, VAR_1); }