block.c (5f3777945d22248d805fb7c134e206c2d943b77b) | block.c (469ef350e1a8b5715e620dbf6f6115628e5b566e) |
---|---|
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 --- 1445 unchanged lines hidden (view full) --- 1454 * -ENOSPC - can't update the backing file because no space is left in the 1455 * image file header 1456 * -ENOTSUP - format driver doesn't support changing the backing file 1457 */ 1458int bdrv_change_backing_file(BlockDriverState *bs, 1459 const char *backing_file, const char *backing_fmt) 1460{ 1461 BlockDriver *drv = bs->drv; | 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 --- 1445 unchanged lines hidden (view full) --- 1454 * -ENOSPC - can't update the backing file because no space is left in the 1455 * image file header 1456 * -ENOTSUP - format driver doesn't support changing the backing file 1457 */ 1458int bdrv_change_backing_file(BlockDriverState *bs, 1459 const char *backing_file, const char *backing_fmt) 1460{ 1461 BlockDriver *drv = bs->drv; |
1462 int ret; |
|
1462 1463 /* Backing file format doesn't make sense without a backing file */ 1464 if (backing_fmt && !backing_file) { 1465 return -EINVAL; 1466 } 1467 1468 if (drv->bdrv_change_backing_file != NULL) { | 1463 1464 /* Backing file format doesn't make sense without a backing file */ 1465 if (backing_fmt && !backing_file) { 1466 return -EINVAL; 1467 } 1468 1469 if (drv->bdrv_change_backing_file != NULL) { |
1469 return drv->bdrv_change_backing_file(bs, backing_file, backing_fmt); | 1470 ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt); |
1470 } else { | 1471 } else { |
1471 return -ENOTSUP; | 1472 ret = -ENOTSUP; |
1472 } | 1473 } |
1474 1475 if (ret == 0) { 1476 pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: ""); 1477 pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: ""); 1478 } 1479 return ret; |
|
1473} 1474 1475static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, 1476 size_t size) 1477{ 1478 int64_t len; 1479 1480 if (!bdrv_is_inserted(bs)) --- 2751 unchanged lines hidden --- | 1480} 1481 1482static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, 1483 size_t size) 1484{ 1485 int64_t len; 1486 1487 if (!bdrv_is_inserted(bs)) --- 2751 unchanged lines hidden --- |