This commit is contained in:
parent
25bdef10e4
commit
e75dfdc86b
|
@ -49,7 +49,7 @@ static bool intermediateLoggingBufferInited = false;
|
||||||
/**
|
/**
|
||||||
* @returns true if data does not fit into this buffer
|
* @returns true if data does not fit into this buffer
|
||||||
*/
|
*/
|
||||||
static ALWAYS_INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
static ALWAYS_INLINE bool validateBuffer(Logging *logging, const char *text, uint32_t extraLen) {
|
||||||
if (logging->buffer == NULL) {
|
if (logging->buffer == NULL) {
|
||||||
firmwareError(CUSTOM_ERR_LOGGING_NOT_READY, "Logging not initialized: %s", logging->name);
|
firmwareError(CUSTOM_ERR_LOGGING_NOT_READY, "Logging not initialized: %s", logging->name);
|
||||||
return true;
|
return true;
|
||||||
|
@ -57,7 +57,8 @@ static ALWAYS_INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
||||||
|
|
||||||
if (remainingSize(logging) < extraLen + 1) {
|
if (remainingSize(logging) < extraLen + 1) {
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
warning(CUSTOM_LOGGING_BUFFER_OVERFLOW, "output overflow %s", logging->name);
|
const char * msg = extraLen > 50 ? "(long)" : text;
|
||||||
|
warning(CUSTOM_LOGGING_BUFFER_OVERFLOW, "output overflow %s %d [%s]", logging->name, extraLen, msg);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,7 @@ static ALWAYS_INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
||||||
void append(Logging *logging, const char *text) {
|
void append(Logging *logging, const char *text) {
|
||||||
efiAssertVoid(text != NULL, "append NULL");
|
efiAssertVoid(text != NULL, "append NULL");
|
||||||
uint32_t extraLen = efiStrlen(text);
|
uint32_t extraLen = efiStrlen(text);
|
||||||
bool isCapacityProblem = validateBuffer(logging, extraLen);
|
bool isCapacityProblem = validateBuffer(logging, text, extraLen);
|
||||||
if (isCapacityProblem) {
|
if (isCapacityProblem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue