vbox的更動 11187 路徑 trunk/src/VBox/Devices/Storage
- 時間撮記:
- 2008-8-6 下午05:44:20 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Storage/DrvBlock.cpp
r10715 r11187 758 758 pData->pDrvBlockPort = (PPDMIBLOCKPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_BLOCK_PORT); 759 759 if (!pData->pDrvBlockPort) 760 { 761 AssertMsgFailed(("Configuration error: No block port interface above!\n")); 762 return VERR_PDM_MISSING_INTERFACE_ABOVE; 763 } 760 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, 761 N_("No block port interface above")); 764 762 765 763 /* Try to get the optional async block port interface above. */ … … 775 773 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Type", &psz); 776 774 if (VBOX_FAILURE(rc)) 777 { 778 AssertMsgFailed(("Configuration error: Failed to obtain the type, rc=%Vrc.\n", rc)); 779 return VERR_PDM_BLOCK_NO_TYPE; 780 } 775 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_BLOCK_NO_TYPE, N_("Failed to obtain the type")); 781 776 if (!strcmp(psz, "HardDisk")) 782 777 pData->enmType = PDMBLOCKTYPE_HARD_DISK; … … 797 792 else 798 793 { 799 AssertMsgFailed(("Configuration error: Unknown type \"%s\".\n", psz)); 794 PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_BLOCK_UNKNOWN_TYPE, RT_SRC_POS, 795 N_("Unknown type \"%s\""), psz); 800 796 MMR3HeapFree(psz); 801 797 return VERR_PDM_BLOCK_UNKNOWN_TYPE; … … 805 801 806 802 /* Mountable */ 807 rc = CFGMR3QueryBool(pCfgHandle, "Mountable", &pData->fMountable); 808 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 809 pData->fMountable = false; 810 else if (VBOX_FAILURE(rc)) 811 { 812 AssertMsgFailed(("Configuration error: Query \"Mountable\" resulted in %Vrc.\n", rc)); 813 return rc; 814 } 803 rc = CFGMR3QueryBoolDef(pCfgHandle, "Mountable", &pData->fMountable, false); 804 if (VBOX_FAILURE(rc)) 805 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Mountable\" from the config")); 815 806 816 807 /* Locked */ 817 rc = CFGMR3QueryBool(pCfgHandle, "Locked", &pData->fLocked); 818 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 819 pData->fLocked = false; 820 else if (VBOX_FAILURE(rc)) 821 { 822 AssertMsgFailed(("Configuration error: Query \"Locked\" resulted in %Vrc.\n", rc)); 823 return rc; 824 } 808 rc = CFGMR3QueryBoolDef(pCfgHandle, "Locked", &pData->fLocked, false); 809 if (VBOX_FAILURE(rc)) 810 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Locked\" from the config")); 825 811 826 812 /* BIOS visible */ 827 rc = CFGMR3QueryBool(pCfgHandle, "BIOSVisible", &pData->fBiosVisible); 828 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 829 pData->fBiosVisible = true; 830 else if (VBOX_FAILURE(rc)) 831 { 832 AssertMsgFailed(("Configuration error: Query \"BIOSVisible\" resulted in %Vrc.\n", rc)); 833 return rc; 834 } 813 rc = CFGMR3QueryBoolDef(pCfgHandle, "BIOSVisible", &pData->fBiosVisible, true); 814 if (VBOX_FAILURE(rc)) 815 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"BIOSVisible\" from the config")); 835 816 836 817 /** @todo AttachFailError is currently completely ignored. */ 837 818 838 819 /* Cylinders */ 839 rc = CFGMR3QueryU32(pCfgHandle, "Cylinders", &pData->LCHSGeometry.cCylinders); 840 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 841 pData->LCHSGeometry.cCylinders = 0; 842 else if (VBOX_FAILURE(rc)) 843 { 844 AssertMsgFailed(("Configuration error: Query \"Cylinders\" resulted in %Vrc.\n", rc)); 845 return rc; 846 } 820 rc = CFGMR3QueryU32Def(pCfgHandle, "Cylinders", &pData->LCHSGeometry.cCylinders, 0); 821 if (VBOX_FAILURE(rc)) 822 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Cylinders\" from the config")); 847 823 848 824 /* Heads */ 849 rc = CFGMR3QueryU32(pCfgHandle, "Heads", &pData->LCHSGeometry.cHeads); 850 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 851 pData->LCHSGeometry.cHeads = 0; 852 else if (VBOX_FAILURE(rc)) 853 { 854 AssertMsgFailed(("Configuration error: Query \"Heads\" resulted in %Vrc.\n", rc)); 855 return rc; 856 } 825 rc = CFGMR3QueryU32Def(pCfgHandle, "Heads", &pData->LCHSGeometry.cHeads, 0); 826 if (VBOX_FAILURE(rc)) 827 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Heads\" from the config")); 857 828 858 829 /* Sectors */ 859 rc = CFGMR3QueryU32(pCfgHandle, "Sectors", &pData->LCHSGeometry.cSectors); 860 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 861 pData->LCHSGeometry.cSectors = 0; 862 else if (VBOX_FAILURE(rc)) 863 { 864 AssertMsgFailed(("Configuration error: Query \"Sectors\" resulted in %Vrc.\n", rc)); 865 return rc; 866 } 830 rc = CFGMR3QueryU32Def(pCfgHandle, "Sectors", &pData->LCHSGeometry.cSectors, 0); 831 if (VBOX_FAILURE(rc)) 832 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Sectors\" from the config")); 867 833 868 834 /* Uuid */ … … 875 841 if (VBOX_FAILURE(rc)) 876 842 { 877 AssertMsgFailed(("Configuration error: Uuid from string failed on \"%s\", rc=%Vrc.\n", psz, rc)); 843 PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, "%s", 844 N_("Uuid from string failed on \"%s\""), psz); 878 845 MMR3HeapFree(psz); 879 846 return rc; … … 882 849 } 883 850 else 884 { 885 AssertMsgFailed(("Configuration error: Failed to obtain the type, rc=%Vrc.\n", rc)); 886 return VERR_PDM_BLOCK_NO_TYPE; 887 } 851 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Uuid\" from the config")); 888 852 889 853 #ifdef VBOX_PERIODIC_FLUSH 890 rc = CFGMR3QueryU32(pCfgHandle, "FlushInterval", &pData->cbFlushInterval); 891 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 892 pData->cbFlushInterval = 0; 893 else if (VBOX_FAILURE(rc)) 894 { 895 AssertMsgFailed(("Configuration error: Query \"FlushInterval\" resulted in %Vrc.\n", rc)); 896 return rc; 897 } 854 rc = CFGMR3QueryU32Def(pCfgHandle, "FlushInterval", &pData->cbFlushInterval, 0); 855 if (VBOX_FAILURE(rc)) 856 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"FlushInterval\" from the config")); 898 857 #endif /* VBOX_PERIODIC_FLUSH */ 899 858 900 859 #ifdef VBOX_IGNORE_FLUSH 901 rc = CFGMR3QueryBool(pCfgHandle, "IgnoreFlush", &pData->fIgnoreFlush); 902 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 903 pData->fIgnoreFlush = true; /* The default is to ignore flushes. */ 904 else if (VBOX_FAILURE(rc)) 905 { 906 AssertMsgFailed(("Configuration error: Query \"IgnoreFlush\" resulted in %Vrc.\n", rc)); 907 return rc; 908 } 860 rc = CFGMR3QueryBoolDef(pCfgHandle, "IgnoreFlush", &pData->fIgnoreFlush, true); 861 if (VBOX_FAILURE(rc)) 862 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"IgnoreFlush\" from the config")); 909 863 #endif /* VBOX_IGNORE_FLUSH */ 910 864 … … 919 873 if (VBOX_FAILURE(rc)) 920 874 { 921 Assert MsgFailed(("Failed to attach driver below us! rc=%Vra\n", rc));875 AssertLogRelMsgFailed(("Failed to attach driver below us! rc=%Vra\n", rc)); 922 876 return rc; 923 877 } 924 878 pData->pDrvMedia = (PPDMIMEDIA)pBase->pfnQueryInterface(pBase, PDMINTERFACE_MEDIA); 925 879 if (!pData->pDrvMedia) 926 { 927 AssertMsgFailed(("Configuration error: No media or async media interface below!\n")); 928 return VERR_PDM_MISSING_INTERFACE_BELOW; 929 } 880 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_BELOW, 881 N_("No media or async media interface below")); 930 882 931 883 /* Try to get the optional async interface. */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器