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

{

    int nr_iov, c;

    int pattern = 0xcd;

    struct aio_ctx *ctx = calloc(1, sizeof(struct aio_ctx));



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

        switch (c) {

        case 'C':

            ctx->Cflag = 1;

            break;

        case 'q':

            ctx->qflag = 1;

            break;

        case 'P':

            pattern = parse_pattern(optarg);

            if (pattern < 0) {

                free(ctx);

                return 0;

            }

            break;

        default:

            free(ctx);

            return command_usage(&aio_write_cmd);

        }

    }



    if (optind > argc - 2) {

        free(ctx);

        return command_usage(&aio_write_cmd);

    }



    ctx->offset = cvtnum(argv[optind]);

    if (ctx->offset < 0) {

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

        free(ctx);

        return 0;

    }

    optind++;



    if (ctx->offset & 0x1ff) {

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

               ctx->offset);

        free(ctx);

        return 0;

    }



    nr_iov = argc - optind;

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

    if (ctx->buf == NULL) {

        free(ctx);

        return 0;

    }



    gettimeofday(&ctx->t1, NULL);

    bdrv_aio_writev(bs, ctx->offset >> 9, &ctx->qiov,

                    ctx->qiov.size >> 9, aio_write_done, ctx);

    return 0;

}

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

{

    int nr_iov, c;

    int pattern = 0xcd;

    struct aio_ctx *ctx = calloc(1, sizeof(struct aio_ctx));



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

        switch (c) {

        case 'C':

            ctx->Cflag = 1;

            break;

        case 'q':

            ctx->qflag = 1;

            break;

        case 'P':

            pattern = parse_pattern(optarg);

            if (pattern < 0) {

                free(ctx);

                return 0;

            }

            break;

        default:

            free(ctx);

            return command_usage(&aio_write_cmd);

        }

    }



    if (optind > argc - 2) {

        free(ctx);

        return command_usage(&aio_write_cmd);

    }



    ctx->offset = cvtnum(argv[optind]);

    if (ctx->offset < 0) {

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

        free(ctx);

        return 0;

    }

    optind++;



    if (ctx->offset & 0x1ff) {

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

               ctx->offset);

        free(ctx);

        return 0;

    }



    nr_iov = argc - optind;

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

    if (ctx->buf == NULL) {

        free(ctx);

        return 0;

    }



    gettimeofday(&ctx->t1, NULL);

    bdrv_aio_writev(bs, ctx->offset >> 9, &ctx->qiov,

                    ctx->qiov.size >> 9, aio_write_done, ctx);

    return 0;

}

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

{

    int VAR_2, VAR_3;

    int VAR_4 = 0xcd;

    struct aio_ctx *VAR_5 = calloc(1, sizeof(struct aio_ctx));



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

        switch (VAR_3) {

        case 'C':

            VAR_5->Cflag = 1;

            break;

        case 'q':

            VAR_5->qflag = 1;

            break;

        case 'P':

            VAR_4 = parse_pattern(optarg);

            if (VAR_4 < 0) {

                free(VAR_5);

                return 0;

            }

            break;

        default:

            free(VAR_5);

            return command_usage(&aio_write_cmd);

        }

    }



    if (optind > VAR_0 - 2) {

        free(VAR_5);

        return command_usage(&aio_write_cmd);

    }



    VAR_5->offset = cvtnum(VAR_1[optind]);

    if (VAR_5->offset < 0) {

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

        free(VAR_5);

        return 0;

    }

    optind++;



    if (VAR_5->offset & 0x1ff) {

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

               VAR_5->offset);

        free(VAR_5);

        return 0;

    }



    VAR_2 = VAR_0 - optind;

    VAR_5->buf = create_iovec(&VAR_5->qiov, &VAR_1[optind], VAR_2, VAR_4);

    if (VAR_5->buf == NULL) {

        free(VAR_5);

        return 0;

    }



    gettimeofday(&VAR_5->t1, NULL);

    bdrv_aio_writev(bs, VAR_5->offset >> 9, &VAR_5->qiov,

                    VAR_5->qiov.size >> 9, aio_write_done, VAR_5);

    return 0;

}

static int FUNC_0(int VAR_0, char **VAR_1)
{ int VAR_2, VAR_3; int VAR_4 = 0xcd; struct aio_ctx *VAR_5 = calloc(1, sizeof(struct aio_ctx)); while ((VAR_3 = getopt(VAR_0, VAR_1, "CqP:")) != EOF) { switch (VAR_3) { case 'C':
VAR_5->Cflag = 1; break; case 'q':
VAR_5->qflag = 1; break; case 'P':
VAR_4 = parse_pattern(optarg); if (VAR_4 < 0) { free(VAR_5); return 0; } break; default:
free(VAR_5); return command_usage(&aio_write_cmd); } } if (optind > VAR_0 - 2) { free(VAR_5); return command_usage(&aio_write_cmd); } VAR_5->offset = cvtnum(VAR_1[optind]); if (VAR_5->offset < 0) { printf("non-numeric length argument -- %s\n", VAR_1[optind]); free(VAR_5); return 0; } optind++; if (VAR_5->offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n",
VAR_5->offset); free(VAR_5); return 0; } VAR_2 = VAR_0 - optind; VAR_5->buf = create_iovec(&VAR_5->qiov, &VAR_1[optind], VAR_2, VAR_4); if (VAR_5->buf == NULL) { free(VAR_5); return 0; } gettimeofday(&VAR_5->t1, NULL); bdrv_aio_writev(bs, VAR_5->offset >> 9, &VAR_5->qiov,
VAR_5->qiov.size >> 9, aio_write_done, VAR_5); return 0; }