block.c (e0c47b6cb1de430fbc6f828f7acffa851c580840) block.c (0eb7217e49b84553bb30f97bc34380633fd846fe)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 335 unchanged lines hidden (view full) ---

344 Error **errp)
345{
346 char *backed = bs->exact_filename[0] ? bs->exact_filename : bs->filename;
347
348 bdrv_get_full_backing_filename_from_filename(backed, bs->backing_file,
349 dest, sz, errp);
350}
351
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 335 unchanged lines hidden (view full) ---

344 Error **errp)
345{
346 char *backed = bs->exact_filename[0] ? bs->exact_filename : bs->filename;
347
348 bdrv_get_full_backing_filename_from_filename(backed, bs->backing_file,
349 dest, sz, errp);
350}
351
352void bdrv_register(BlockDriver *bdrv)
352void bdrv_setup_io_funcs(BlockDriver *bdrv)
353{
354 /* Block drivers without coroutine functions need emulation */
355 if (!bdrv->bdrv_co_readv) {
356 bdrv->bdrv_co_readv = bdrv_co_readv_em;
357 bdrv->bdrv_co_writev = bdrv_co_writev_em;
358
359 /* bdrv_co_readv_em()/brdv_co_writev_em() work in terms of aio, so if
360 * the block driver lacks aio we need to emulate that too.
361 */
362 if (!bdrv->bdrv_aio_readv) {
363 /* add AIO emulation layer */
364 bdrv->bdrv_aio_readv = bdrv_aio_readv_em;
365 bdrv->bdrv_aio_writev = bdrv_aio_writev_em;
366 }
367 }
353{
354 /* Block drivers without coroutine functions need emulation */
355 if (!bdrv->bdrv_co_readv) {
356 bdrv->bdrv_co_readv = bdrv_co_readv_em;
357 bdrv->bdrv_co_writev = bdrv_co_writev_em;
358
359 /* bdrv_co_readv_em()/brdv_co_writev_em() work in terms of aio, so if
360 * the block driver lacks aio we need to emulate that too.
361 */
362 if (!bdrv->bdrv_aio_readv) {
363 /* add AIO emulation layer */
364 bdrv->bdrv_aio_readv = bdrv_aio_readv_em;
365 bdrv->bdrv_aio_writev = bdrv_aio_writev_em;
366 }
367 }
368}
368
369
370void bdrv_register(BlockDriver *bdrv)
371{
372 bdrv_setup_io_funcs(bdrv);
373
369 QLIST_INSERT_HEAD(&bdrv_drivers, bdrv, list);
370}
371
372BlockDriverState *bdrv_new_root(void)
373{
374 BlockDriverState *bs = bdrv_new();
375
376 QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);

--- 6136 unchanged lines hidden ---
374 QLIST_INSERT_HEAD(&bdrv_drivers, bdrv, list);
375}
376
377BlockDriverState *bdrv_new_root(void)
378{
379 BlockDriverState *bs = bdrv_new();
380
381 QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);

--- 6136 unchanged lines hidden ---