static int open_f(BlockDriverState *bs, int argc, char **argv)

{

    int flags = 0;

    int readonly = 0;

    int growable = 0;

    int c;

    QemuOpts *qopts;

    QDict *opts;



    while ((c = getopt(argc, argv, "snrgo:")) != EOF) {

        switch (c) {

        case 's':

            flags |= BDRV_O_SNAPSHOT;

            break;

        case 'n':

            flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;

            break;

        case 'r':

            readonly = 1;

            break;

        case 'g':

            growable = 1;

            break;

        case 'o':

            if (!qemu_opts_parse(&empty_opts, optarg, 0)) {

                printf("could not parse option list -- %s\n", optarg);

                qemu_opts_reset(&empty_opts);

                return 0;

            }

            break;

        default:

            qemu_opts_reset(&empty_opts);

            return qemuio_command_usage(&open_cmd);

        }

    }



    if (!readonly) {

        flags |= BDRV_O_RDWR;

    }



    qopts = qemu_opts_find(&empty_opts, NULL);

    opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL;

    qemu_opts_reset(&empty_opts);



    if (optind == argc - 1) {

        return openfile(argv[optind], flags, growable, opts);

    } else if (optind == argc) {

        return openfile(NULL, flags, growable, opts);

    } else {


        return qemuio_command_usage(&open_cmd);

    }

}
static int open_f(BlockDriverState *bs, int argc, char **argv)

{

    int flags = 0;

    int readonly = 0;

    int growable = 0;

    int c;

    QemuOpts *qopts;

    QDict *opts;



    while ((c = getopt(argc, argv, "snrgo:")) != EOF) {

        switch (c) {

        case 's':

            flags |= BDRV_O_SNAPSHOT;

            break;

        case 'n':

            flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;

            break;

        case 'r':

            readonly = 1;

            break;

        case 'g':

            growable = 1;

            break;

        case 'o':

            if (!qemu_opts_parse(&empty_opts, optarg, 0)) {

                printf("could not parse option list -- %s\n", optarg);

                qemu_opts_reset(&empty_opts);

                return 0;

            }

            break;

        default:

            qemu_opts_reset(&empty_opts);

            return qemuio_command_usage(&open_cmd);

        }

    }



    if (!readonly) {

        flags |= BDRV_O_RDWR;

    }



    qopts = qemu_opts_find(&empty_opts, NULL);

    opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL;

    qemu_opts_reset(&empty_opts);



    if (optind == argc - 1) {

        return openfile(argv[optind], flags, growable, opts);

    } else if (optind == argc) {

        return openfile(NULL, flags, growable, opts);

    } else {


        return qemuio_command_usage(&open_cmd);

    }

}
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1, char **VAR_2)

{

    int VAR_3 = 0;

    int VAR_4 = 0;

    int VAR_5 = 0;

    int VAR_6;

    QemuOpts *qopts;

    QDict *opts;



    while ((VAR_6 = getopt(VAR_1, VAR_2, "snrgo:")) != EOF) {

        switch (VAR_6) {

        case 's':

            VAR_3 |= BDRV_O_SNAPSHOT;

            break;

        case 'n':

            VAR_3 |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;

            break;

        case 'r':

            VAR_4 = 1;

            break;

        case 'g':

            VAR_5 = 1;

            break;

        case 'o':

            if (!qemu_opts_parse(&empty_opts, optarg, 0)) {

                printf("could not parse option list -- %s\n", optarg);

                qemu_opts_reset(&empty_opts);

                return 0;

            }

            break;

        default:

            qemu_opts_reset(&empty_opts);

            return qemuio_command_usage(&open_cmd);

        }

    }



    if (!VAR_4) {

        VAR_3 |= BDRV_O_RDWR;

    }



    qopts = qemu_opts_find(&empty_opts, NULL);

    opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL;

    qemu_opts_reset(&empty_opts);



    if (optind == VAR_1 - 1) {

        return openfile(VAR_2[optind], VAR_3, VAR_5, opts);

    } else if (optind == VAR_1) {

        return openfile(NULL, VAR_3, VAR_5, opts);

    } else {


        return qemuio_command_usage(&open_cmd);

    }

}
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1, char **VAR_2)
{ int VAR_3 = 0; int VAR_4 = 0; int VAR_5 = 0; int VAR_6; QemuOpts *qopts; QDict *opts; while ((VAR_6 = getopt(VAR_1, VAR_2, "snrgo:")) != EOF) { switch (VAR_6) { case 's':
VAR_3 |= BDRV_O_SNAPSHOT; break; case 'n':
VAR_3 |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB; break; case 'r':
VAR_4 = 1; break; case 'g':
VAR_5 = 1; break; case 'o':
if (!qemu_opts_parse(&empty_opts, optarg, 0)) { printf("could not parse option list -- %s\n", optarg); qemu_opts_reset(&empty_opts); return 0; } break; default:
qemu_opts_reset(&empty_opts); return qemuio_command_usage(&open_cmd); } } if (!VAR_4) { VAR_3 |= BDRV_O_RDWR; } qopts = qemu_opts_find(&empty_opts, NULL); opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL; qemu_opts_reset(&empty_opts); if (optind == VAR_1 - 1) { return openfile(VAR_2[optind], VAR_3, VAR_5, opts); } else if (optind == VAR_1) { return openfile(NULL, VAR_3, VAR_5, opts); } else { return qemuio_command_usage(&open_cmd); } }