block.c (1f37316238d0d412cbc16482c5c24b11c2c7dcec) block.c (ceaca56feee6a1d682c882300855cad44a67ec8e)
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

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

5073 if (bs->file && bs->drv->is_filter) {
5074 return bdrv_has_zero_init(bs->file->bs);
5075 }
5076
5077 /* safe default */
5078 return 0;
5079}
5080
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

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

5073 if (bs->file && bs->drv->is_filter) {
5074 return bdrv_has_zero_init(bs->file->bs);
5075 }
5076
5077 /* safe default */
5078 return 0;
5079}
5080
5081int bdrv_has_zero_init_truncate(BlockDriverState *bs)
5082{
5083 if (!bs->drv) {
5084 return 0;
5085 }
5086
5087 if (bs->backing) {
5088 /* Depends on the backing image length, but better safe than sorry */
5089 return 0;
5090 }
5091 if (bs->drv->bdrv_has_zero_init_truncate) {
5092 return bs->drv->bdrv_has_zero_init_truncate(bs);
5093 }
5094 if (bs->file && bs->drv->is_filter) {
5095 return bdrv_has_zero_init_truncate(bs->file->bs);
5096 }
5097
5098 /* safe default */
5099 return 0;
5100}
5101
5081bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs)
5082{
5083 BlockDriverInfo bdi;
5084
5085 if (bs->backing) {
5086 return false;
5087 }
5088

--- 1471 unchanged lines hidden ---
5102bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs)
5103{
5104 BlockDriverInfo bdi;
5105
5106 if (bs->backing) {
5107 return false;
5108 }
5109

--- 1471 unchanged lines hidden ---