Changeset 81137 in vbox for trunk/src/VBox/Runtime/r3/linux
- Timestamp:
- Oct 8, 2019 8:28:31 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/RTSystemFirmware-linux.cpp
r81068 r81137 45 45 46 46 47 RTDECL(int) RTSystem FirmwareQueryType(PRTSYSFWTYPE penmFirmwareType)47 RTDECL(int) RTSystemQueryFirmwareType(PRTSYSFWTYPE penmFirmwareType) 48 48 { 49 49 if (RTLinuxSysFsExists("firmware/efi/")) … … 58 58 return VINF_SUCCESS; 59 59 } 60 RT_EXPORT_SYMBOL(RTSystem FirmwareQueryType);60 RT_EXPORT_SYMBOL(RTSystemQueryFirmwareType); 61 61 62 62 63 RTDECL( void) RTSystemFirmwareFreeValue(PRTSYSFWVALUE pValue)63 RTDECL(int) RTSystemQueryFirmwareBoolean(RTSYSFWPROP enmProp, bool *pfValue) 64 64 { 65 RT_NOREF(pValue); 66 } 67 RT_EXPORT_SYMBOL(RTSystemFirmwareFreeValue); 68 69 70 RTDECL(int) RTSystemFirmwareQueryValue(RTSYSFWPROP enmProp, PRTSYSFWVALUE pValue) 71 { 72 RT_ZERO(*pValue); 65 *pfValue = false; 73 66 74 67 /* 75 * Translate the property into type andvariable base filename.68 * Translate the property to variable base filename. 76 69 */ 77 70 const char *pszName; … … 79 72 { 80 73 case RTSYSFWPROP_SECURE_BOOT: 81 pValue->enmType = RTSYSFWVALUETYPE_BOOLEAN;82 74 pszName = "firmware/efi/efivars/SecureBoot"; 83 75 break; … … 95 87 int rc = RTLinuxSysFsOpen(&hFile, "%s-" VBOX_UEFI_UUID_GLOBALS, pszName); 96 88 /** @todo try other suffixes if file-not-found. */ 97 98 switch (pValue->enmType) 89 if (RT_SUCCESS(rc)) 99 90 { 100 case RTSYSFWVALUETYPE_BOOLEAN: 101 { 102 if (RT_SUCCESS(rc)) 103 { 104 uint8_t abBuf[16]; 105 size_t cbRead = 0; 106 rc = RTLinuxSysFsReadFile(hFile, abBuf, sizeof(abBuf), &cbRead); 107 pValue->u.fVal = cbRead > 1 && abBuf[cbRead - 1] != 0; 108 RTFileClose(hFile); 109 } 110 else if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND) 111 rc = VINF_SUCCESS; 112 else if (rc == VERR_PERMISSION_DENIED) 113 rc = VERR_NOT_SUPPORTED; 114 break; 115 } 116 117 default: 118 AssertFailedReturn(VERR_INTERNAL_ERROR); 91 uint8_t abBuf[16]; 92 size_t cbRead = 0; 93 rc = RTLinuxSysFsReadFile(hFile, abBuf, sizeof(abBuf), &cbRead); 94 *pfValue = cbRead > 1 && abBuf[cbRead - 1] != 0; 95 RTFileClose(hFile); 119 96 } 97 else if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND) 98 rc = VINF_SUCCESS; 99 else if (rc == VERR_PERMISSION_DENIED) 100 rc = VERR_NOT_SUPPORTED; 120 101 121 102 return rc; 122 103 } 123 RT_EXPORT_SYMBOL(RTSystem FirmwareQueryValue);104 RT_EXPORT_SYMBOL(RTSystemQueryFirmwareBoolean); 124 105
Note:
See TracChangeset
for help on using the changeset viewer.