block.c (dabfa6cc2e2a06269026fcb42772894f67bd0c3e) | block.c (d34682cd4a06efe9ee3fc8cb7e8a0ea445299989) |
---|---|
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 --- 469 unchanged lines hidden (view full) --- 478 479 ret = bdrv_create(drv, filename, options, &local_err); 480 if (error_is_set(&local_err)) { 481 error_propagate(errp, local_err); 482 } 483 return ret; 484} 485 | 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 --- 469 unchanged lines hidden (view full) --- 478 479 ret = bdrv_create(drv, filename, options, &local_err); 480 if (error_is_set(&local_err)) { 481 error_propagate(errp, local_err); 482 } 483 return ret; 484} 485 |
486static int bdrv_refresh_limits(BlockDriverState *bs) 487{ 488 BlockDriver *drv = bs->drv; 489 490 memset(&bs->bl, 0, sizeof(bs->bl)); 491 492 if (drv && drv->bdrv_refresh_limits) { 493 return drv->bdrv_refresh_limits(bs); 494 } 495 496 return 0; 497} 498 |
|
486/* 487 * Create a uniquely-named empty temporary file. 488 * Return 0 upon success, otherwise a negative errno value. 489 */ 490int get_tmp_filename(char *filename, int size) 491{ 492#ifdef _WIN32 493 char temp_dir[MAX_PATH]; --- 373 unchanged lines hidden (view full) --- 867 } 868 869 ret = refresh_total_sectors(bs, bs->total_sectors); 870 if (ret < 0) { 871 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 872 goto free_and_fail; 873 } 874 | 499/* 500 * Create a uniquely-named empty temporary file. 501 * Return 0 upon success, otherwise a negative errno value. 502 */ 503int get_tmp_filename(char *filename, int size) 504{ 505#ifdef _WIN32 506 char temp_dir[MAX_PATH]; --- 373 unchanged lines hidden (view full) --- 880 } 881 882 ret = refresh_total_sectors(bs, bs->total_sectors); 883 if (ret < 0) { 884 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 885 goto free_and_fail; 886 } 887 |
888 bdrv_refresh_limits(bs); 889 |
|
875#ifndef _WIN32 876 if (bs->is_temporary) { 877 assert(bs->filename[0] != '\0'); 878 unlink(bs->filename); 879 } 880#endif 881 return 0; 882 --- 197 unchanged lines hidden (view full) --- 1080 return ret; 1081 } 1082 1083 if (bs->backing_hd->file) { 1084 pstrcpy(bs->backing_file, sizeof(bs->backing_file), 1085 bs->backing_hd->file->filename); 1086 } 1087 | 890#ifndef _WIN32 891 if (bs->is_temporary) { 892 assert(bs->filename[0] != '\0'); 893 unlink(bs->filename); 894 } 895#endif 896 return 0; 897 --- 197 unchanged lines hidden (view full) --- 1095 return ret; 1096 } 1097 1098 if (bs->backing_hd->file) { 1099 pstrcpy(bs->backing_file, sizeof(bs->backing_file), 1100 bs->backing_hd->file->filename); 1101 } 1102 |
1103 /* Recalculate the BlockLimits with the backing file */ 1104 bdrv_refresh_limits(bs); 1105 |
|
1088 return 0; 1089} 1090 1091/* 1092 * Opens a disk image whose options are given as BlockdevRef in another block 1093 * device's options. 1094 * 1095 * If force_raw is true, bdrv_file_open() will be used, thereby preventing any --- 4093 unchanged lines hidden --- | 1106 return 0; 1107} 1108 1109/* 1110 * Opens a disk image whose options are given as BlockdevRef in another block 1111 * device's options. 1112 * 1113 * If force_raw is true, bdrv_file_open() will be used, thereby preventing any --- 4093 unchanged lines hidden --- |