|
@@ -1206,7 +1206,8 @@ static int bdrv_backing_update_filename(BdrvChild *c, BlockDriverState *base,
|
|
}
|
|
}
|
|
|
|
|
|
ret = bdrv_change_backing_file(parent, filename,
|
|
ret = bdrv_change_backing_file(parent, filename,
|
|
- base->drv ? base->drv->format_name : "");
|
|
|
|
|
|
+ base->drv ? base->drv->format_name : "",
|
|
|
|
+ false);
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
error_setg_errno(errp, -ret, "Could not update backing file link");
|
|
error_setg_errno(errp, -ret, "Could not update backing file link");
|
|
}
|
|
}
|
|
@@ -4680,8 +4681,8 @@ int bdrv_check(BlockDriverState *bs,
|
|
* image file header
|
|
* image file header
|
|
* -ENOTSUP - format driver doesn't support changing the backing file
|
|
* -ENOTSUP - format driver doesn't support changing the backing file
|
|
*/
|
|
*/
|
|
-int bdrv_change_backing_file(BlockDriverState *bs,
|
|
|
|
- const char *backing_file, const char *backing_fmt)
|
|
|
|
|
|
+int bdrv_change_backing_file(BlockDriverState *bs, const char *backing_file,
|
|
|
|
+ const char *backing_fmt, bool warn)
|
|
{
|
|
{
|
|
BlockDriver *drv = bs->drv;
|
|
BlockDriver *drv = bs->drv;
|
|
int ret;
|
|
int ret;
|
|
@@ -4695,6 +4696,12 @@ int bdrv_change_backing_file(BlockDriverState *bs,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (warn && backing_file && !backing_fmt) {
|
|
|
|
+ warn_report("Deprecated use of backing file without explicit "
|
|
|
|
+ "backing format, use of this image requires "
|
|
|
|
+ "potentially unsafe format probing");
|
|
|
|
+ }
|
|
|
|
+
|
|
if (drv->bdrv_change_backing_file != NULL) {
|
|
if (drv->bdrv_change_backing_file != NULL) {
|
|
ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt);
|
|
ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt);
|
|
} else {
|
|
} else {
|