summaryrefslogblamecommitdiffstats
path: root/stubs/linux-aio.c
blob: 84d1f784aed9dad907ace0c61491bcbbecd4f7a4 (plain) (tree)






















                                                                            
                                      







                                   
/*
 * Linux native AIO support.
 *
 * Copyright (C) 2009 IBM, Corp.
 * Copyright (C) 2009 Red Hat, Inc.
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */
#include "qemu/osdep.h"
#include "block/aio.h"
#include "block/raw-aio.h"

void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context)
{
    abort();
}

void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context)
{
    abort();
}

LinuxAioState *laio_init(Error **errp)
{
    abort();
}

void laio_cleanup(LinuxAioState *s)
{
    abort();
}
ass="hl pps">"qapi/clone-visitor.h" #include "qapi/error.h" typedef struct BlockdevCreateJob { Job common; BlockDriver *drv; BlockdevCreateOptions *opts; } BlockdevCreateJob; static int coroutine_fn blockdev_create_run(Job *job, Error **errp) { BlockdevCreateJob *s = container_of(job, BlockdevCreateJob, common); int ret; job_progress_set_remaining(&s->common, 1); ret = s->drv->bdrv_co_create(s->opts, errp); job_progress_update(&s->common, 1); qapi_free_BlockdevCreateOptions(s->opts); return ret; } static const JobDriver blockdev_create_job_driver = { .instance_size = sizeof(BlockdevCreateJob), .job_type = JOB_TYPE_CREATE, .run = blockdev_create_run, }; void qmp_blockdev_create(const char *job_id, BlockdevCreateOptions *options, Error **errp) { BlockdevCreateJob *s; const char *fmt = BlockdevDriver_str(options->driver); BlockDriver *drv = bdrv_find_format(fmt); /* If the driver is in the schema, we know that it exists. But it may not * be whitelisted. */ assert(drv); if (bdrv_uses_whitelist() && !bdrv_is_whitelisted(drv, false)) { error_setg(errp, "Driver is not whitelisted"); return; } /* Error out if the driver doesn't support .bdrv_co_create */ if (!drv->bdrv_co_create) { error_setg(errp, "Driver does not support blockdev-create"); return; } /* Create the block job */ /* TODO Running in the main context. Block drivers need to error out or add * locking when they use a BDS in a different AioContext. */ s = job_create(job_id, &blockdev_create_job_driver, NULL, qemu_get_aio_context(), JOB_DEFAULT | JOB_MANUAL_DISMISS, NULL, NULL, errp); if (!s) { return; } s->drv = drv, s->opts = QAPI_CLONE(BlockdevCreateOptions, options), job_start(&s->common); }