static int writev_f(int argc, char **argv)

{

    struct timeval t1, t2;

    int Cflag = 0, qflag = 0;

    int c, cnt;

    char *buf;

    int64_t offset;

    /* Some compilers get confused and warn if this is not initialized.  */

    int total = 0;

    int nr_iov;

    int pattern = 0xcd;

    QEMUIOVector qiov;



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

        switch (c) {

        case 'C':

            Cflag = 1;

            break;

        case 'q':

            qflag = 1;

            break;

        case 'P':

            pattern = parse_pattern(optarg);

            if (pattern < 0) {

                return 0;

            }

            break;

        default:

            return command_usage(&writev_cmd);

        }

    }



    if (optind > argc - 2) {

        return command_usage(&writev_cmd);

    }



    offset = cvtnum(argv[optind]);

    if (offset < 0) {

        printf("non-numeric length argument -- %s\n", argv[optind]);

        return 0;

    }

    optind++;



    if (offset & 0x1ff) {

        printf("offset %" PRId64 " is not sector aligned\n",

               offset);

        return 0;

    }



    nr_iov = argc - optind;

    buf = create_iovec(&qiov, &argv[optind], nr_iov, pattern);

    if (buf == NULL) {

        return 0;

    }



    gettimeofday(&t1, NULL);

    cnt = do_aio_writev(&qiov, offset, &total);

    gettimeofday(&t2, NULL);



    if (cnt < 0) {

        printf("writev failed: %s\n", strerror(-cnt));

        goto out;

    }



    if (qflag) {

        goto out;

    }



    /* Finally, report back -- -C gives a parsable format */

    t2 = tsub(t2, t1);

    print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag);

out:


    qemu_io_free(buf);

    return 0;

}
static int writev_f(int argc, char **argv)

{

    struct timeval t1, t2;

    int Cflag = 0, qflag = 0;

    int c, cnt;

    char *buf;

    int64_t offset;

    

    int total = 0;

    int nr_iov;

    int pattern = 0xcd;

    QEMUIOVector qiov;



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

        switch (c) {

        case 'C':

            Cflag = 1;

            break;

        case 'q':

            qflag = 1;

            break;

        case 'P':

            pattern = parse_pattern(optarg);

            if (pattern < 0) {

                return 0;

            }

            break;

        default:

            return command_usage(&writev_cmd);

        }

    }



    if (optind > argc - 2) {

        return command_usage(&writev_cmd);

    }



    offset = cvtnum(argv[optind]);

    if (offset < 0) {

        printf("non-numeric length argument -- %s\n", argv[optind]);

        return 0;

    }

    optind++;



    if (offset & 0x1ff) {

        printf("offset %" PRId64 " is not sector aligned\n",

               offset);

        return 0;

    }



    nr_iov = argc - optind;

    buf = create_iovec(&qiov, &argv[optind], nr_iov, pattern);

    if (buf == NULL) {

        return 0;

    }



    gettimeofday(&t1, NULL);

    cnt = do_aio_writev(&qiov, offset, &total);

    gettimeofday(&t2, NULL);



    if (cnt < 0) {

        printf("writev failed: %s\n", strerror(-cnt));

        goto out;

    }



    if (qflag) {

        goto out;

    }



    

    t2 = tsub(t2, t1);

    print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag);

out:


    qemu_io_free(buf);

    return 0;

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

{

    struct timeval VAR_2, VAR_3;

    int VAR_4 = 0, VAR_5 = 0;

    int VAR_6, VAR_7;

    char *VAR_8;

    int64_t offset;

    

    int VAR_9 = 0;

    int VAR_10;

    int VAR_11 = 0xcd;

    QEMUIOVector qiov;



    while ((VAR_6 = getopt(VAR_0, VAR_1, "CqP:")) != EOF) {

        switch (VAR_6) {

        case 'C':

            VAR_4 = 1;

            break;

        case 'q':

            VAR_5 = 1;

            break;

        case 'P':

            VAR_11 = parse_pattern(optarg);

            if (VAR_11 < 0) {

                return 0;

            }

            break;

        default:

            return command_usage(&writev_cmd);

        }

    }



    if (optind > VAR_0 - 2) {

        return command_usage(&writev_cmd);

    }



    offset = cvtnum(VAR_1[optind]);

    if (offset < 0) {

        printf("non-numeric length argument -- %s\n", VAR_1[optind]);

        return 0;

    }

    optind++;



    if (offset & 0x1ff) {

        printf("offset %" PRId64 " is not sector aligned\n",

               offset);

        return 0;

    }



    VAR_10 = VAR_0 - optind;

    VAR_8 = create_iovec(&qiov, &VAR_1[optind], VAR_10, VAR_11);

    if (VAR_8 == NULL) {

        return 0;

    }



    gettimeofday(&VAR_2, NULL);

    VAR_7 = do_aio_writev(&qiov, offset, &VAR_9);

    gettimeofday(&VAR_3, NULL);



    if (VAR_7 < 0) {

        printf("writev failed: %s\n", strerror(-VAR_7));

        goto out;

    }



    if (VAR_5) {

        goto out;

    }



    

    VAR_3 = tsub(VAR_3, VAR_2);

    print_report("wrote", &VAR_3, offset, qiov.size, VAR_9, VAR_7, VAR_4);

out:


    qemu_io_free(VAR_8);

    return 0;

}
static int FUNC_0(int VAR_0, char **VAR_1)
{ struct timeval VAR_2, VAR_3; int VAR_4 = 0, VAR_5 = 0; int VAR_6, VAR_7; char *VAR_8; int64_t offset; int VAR_9 = 0; int VAR_10; int VAR_11 = 0xcd; QEMUIOVector qiov; while ((VAR_6 = getopt(VAR_0, VAR_1, "CqP:")) != EOF) { switch (VAR_6) { case 'C':
VAR_4 = 1; break; case 'q':
VAR_5 = 1; break; case 'P':
VAR_11 = parse_pattern(optarg); if (VAR_11 < 0) { return 0; } break; default:
return command_usage(&writev_cmd); } } if (optind > VAR_0 - 2) { return command_usage(&writev_cmd); } offset = cvtnum(VAR_1[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", VAR_1[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n",
offset); return 0; } VAR_10 = VAR_0 - optind; VAR_8 = create_iovec(&qiov, &VAR_1[optind], VAR_10, VAR_11); if (VAR_8 == NULL) { return 0; } gettimeofday(&VAR_2, NULL); VAR_7 = do_aio_writev(&qiov, offset, &VAR_9); gettimeofday(&VAR_3, NULL); if (VAR_7 < 0) { printf("writev failed: %s\n", strerror(-VAR_7)); goto out; } if (VAR_5) { goto out; } VAR_3 = tsub(VAR_3, VAR_2); print_report("wrote", &VAR_3, offset, qiov.size, VAR_9, VAR_7, VAR_4); out:
qemu_io_free(VAR_8); return 0; }