block.c (756e6736a12a46330d9532d5f861ba15b38886d8) block.c (3f5075ae63b6dc1de9428d028a4d28fc98e7fdff)
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

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

589 } else {
590 i += n;
591 }
592 }
593
594 if (drv->bdrv_make_empty)
595 return drv->bdrv_make_empty(bs);
596
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

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

589 } else {
590 i += n;
591 }
592 }
593
594 if (drv->bdrv_make_empty)
595 return drv->bdrv_make_empty(bs);
596
597 /*
598 * Make sure all data we wrote to the backing device is actually
599 * stable on disk.
600 */
601 if (bs->backing_hd)
602 bdrv_flush(bs->backing_hd);
597 return 0;
598}
599
600/*
601 * Return values:
602 * 0 - success
603 * -EINVAL - backing format specified, but no file
604 * -ENOSPC - can't update the backing file because no space is left in the

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

1110
1111const char *bdrv_get_device_name(BlockDriverState *bs)
1112{
1113 return bs->device_name;
1114}
1115
1116void bdrv_flush(BlockDriverState *bs)
1117{
603 return 0;
604}
605
606/*
607 * Return values:
608 * 0 - success
609 * -EINVAL - backing format specified, but no file
610 * -ENOSPC - can't update the backing file because no space is left in the

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

1116
1117const char *bdrv_get_device_name(BlockDriverState *bs)
1118{
1119 return bs->device_name;
1120}
1121
1122void bdrv_flush(BlockDriverState *bs)
1123{
1118 if (!bs->drv)
1119 return;
1120 if (bs->drv->bdrv_flush)
1124 if (bs->drv && bs->drv->bdrv_flush)
1121 bs->drv->bdrv_flush(bs);
1125 bs->drv->bdrv_flush(bs);
1122 if (bs->backing_hd)
1123 bdrv_flush(bs->backing_hd);
1124}
1125
1126void bdrv_flush_all(void)
1127{
1128 BlockDriverState *bs;
1129
1130 for (bs = bdrv_first; bs != NULL; bs = bs->next)
1131 if (bs->drv && !bdrv_is_read_only(bs) &&

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

1792
1793BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs,
1794 BlockDriverCompletionFunc *cb, void *opaque)
1795{
1796 BlockDriver *drv = bs->drv;
1797
1798 if (!drv)
1799 return NULL;
1126}
1127
1128void bdrv_flush_all(void)
1129{
1130 BlockDriverState *bs;
1131
1132 for (bs = bdrv_first; bs != NULL; bs = bs->next)
1133 if (bs->drv && !bdrv_is_read_only(bs) &&

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

1794
1795BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs,
1796 BlockDriverCompletionFunc *cb, void *opaque)
1797{
1798 BlockDriver *drv = bs->drv;
1799
1800 if (!drv)
1801 return NULL;
1800
1801 /*
1802 * Note that unlike bdrv_flush the driver is reponsible for flushing a
1803 * backing image if it exists.
1804 */
1805 return drv->bdrv_aio_flush(bs, cb, opaque);
1806}
1807
1808void bdrv_aio_cancel(BlockDriverAIOCB *acb)
1809{
1810 acb->pool->cancel(acb);
1811}
1812

--- 360 unchanged lines hidden ---
1802 return drv->bdrv_aio_flush(bs, cb, opaque);
1803}
1804
1805void bdrv_aio_cancel(BlockDriverAIOCB *acb)
1806{
1807 acb->pool->cancel(acb);
1808}
1809

--- 360 unchanged lines hidden ---