raw-format.c (067179868ec8cd467d9810143339e882cb60e388) raw-format.c (79a558664840adf502fe94907b0a680836e3e98e)
1/* BlockDriver implementation for "raw" format driver
2 *
3 * Copyright (C) 2010-2016 Red Hat, Inc.
4 * Copyright (C) 2010, Blue Swirl <blauwirbel@gmail.com>
5 * Copyright (C) 2009, Anthony Liguori <aliguori@us.ibm.com>
6 *
7 * Author:
8 * Laszlo Ersek <lersek@redhat.com>

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

274fail:
275 if (qiov == &local_qiov) {
276 qemu_iovec_destroy(&local_qiov);
277 }
278 qemu_vfree(buf);
279 return ret;
280}
281
1/* BlockDriver implementation for "raw" format driver
2 *
3 * Copyright (C) 2010-2016 Red Hat, Inc.
4 * Copyright (C) 2010, Blue Swirl <blauwirbel@gmail.com>
5 * Copyright (C) 2009, Anthony Liguori <aliguori@us.ibm.com>
6 *
7 * Author:
8 * Laszlo Ersek <lersek@redhat.com>

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

274fail:
275 if (qiov == &local_qiov) {
276 qemu_iovec_destroy(&local_qiov);
277 }
278 qemu_vfree(buf);
279 return ret;
280}
281
282static int coroutine_fn raw_co_block_status(BlockDriverState *bs,
283 bool want_zero, int64_t offset,
284 int64_t bytes, int64_t *pnum,
285 int64_t *map,
286 BlockDriverState **file)
282static int coroutine_fn GRAPH_RDLOCK
283raw_co_block_status(BlockDriverState *bs, bool want_zero, int64_t offset,
284 int64_t bytes, int64_t *pnum, int64_t *map,
285 BlockDriverState **file)
287{
288 BDRVRawState *s = bs->opaque;
289 *pnum = bytes;
290 *file = bs->file->bs;
291 *map = offset + s->offset;
292 return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID;
293}
294

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

392}
393
394static int coroutine_fn GRAPH_RDLOCK
395raw_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
396{
397 return bdrv_co_get_info(bs->file->bs, bdi);
398}
399
286{
287 BDRVRawState *s = bs->opaque;
288 *pnum = bytes;
289 *file = bs->file->bs;
290 *map = offset + s->offset;
291 return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID;
292}
293

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

391}
392
393static int coroutine_fn GRAPH_RDLOCK
394raw_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
395{
396 return bdrv_co_get_info(bs->file->bs, bdi);
397}
398
400static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
399static void GRAPH_RDLOCK raw_refresh_limits(BlockDriverState *bs, Error **errp)
401{
402 bs->bl.has_variable_length = bs->file->bs->bl.has_variable_length;
403
404 if (bs->probed) {
405 /* To make it easier to protect the first sector, any probed
406 * image is restricted to read-modify-write on sub-sector
407 * operations. */
408 bs->bl.request_alignment = BDRV_SECTOR_SIZE;

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

556
557 if (!QEMU_IS_ALIGNED(s->offset, MAX(bsz->log, bsz->phys))) {
558 return -ENOTSUP;
559 }
560
561 return 0;
562}
563
400{
401 bs->bl.has_variable_length = bs->file->bs->bl.has_variable_length;
402
403 if (bs->probed) {
404 /* To make it easier to protect the first sector, any probed
405 * image is restricted to read-modify-write on sub-sector
406 * operations. */
407 bs->bl.request_alignment = BDRV_SECTOR_SIZE;

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

555
556 if (!QEMU_IS_ALIGNED(s->offset, MAX(bsz->log, bsz->phys))) {
557 return -ENOTSUP;
558 }
559
560 return 0;
561}
562
564static int raw_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
563static int GRAPH_RDLOCK
564raw_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
565{
566 BDRVRawState *s = bs->opaque;
567 if (s->offset || s->has_size) {
568 return -ENOTSUP;
569 }
570 return bdrv_probe_geometry(bs->file->bs, geo);
571}
572

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

606
607static const char *const raw_strong_runtime_opts[] = {
608 "offset",
609 "size",
610
611 NULL
612};
613
565{
566 BDRVRawState *s = bs->opaque;
567 if (s->offset || s->has_size) {
568 return -ENOTSUP;
569 }
570 return bdrv_probe_geometry(bs->file->bs, geo);
571}
572

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

606
607static const char *const raw_strong_runtime_opts[] = {
608 "offset",
609 "size",
610
611 NULL
612};
613
614static void raw_cancel_in_flight(BlockDriverState *bs)
614static void GRAPH_RDLOCK raw_cancel_in_flight(BlockDriverState *bs)
615{
616 bdrv_cancel_in_flight(bs->file->bs);
617}
618
619static void raw_child_perm(BlockDriverState *bs, BdrvChild *c,
620 BdrvChildRole role,
621 BlockReopenQueue *reopen_queue,
622 uint64_t parent_perm, uint64_t parent_shared,

--- 60 unchanged lines hidden ---
615{
616 bdrv_cancel_in_flight(bs->file->bs);
617}
618
619static void raw_child_perm(BlockDriverState *bs, BdrvChild *c,
620 BdrvChildRole role,
621 BlockReopenQueue *reopen_queue,
622 uint64_t parent_perm, uint64_t parent_shared,

--- 60 unchanged lines hidden ---