staticunsignedint record_size = 1024;
module_param(record_size, uint, 0444);
MODULE_PARM_DESC(record_size, "size of each pstore UEFI var (in bytes, min/default=1024)");
record->buf = kmalloc(size, GFP_KERNEL); if (!record->buf) return -ENOMEM;
status = efivar_get_variable(varname, &LINUX_EFI_CRASH_GUID, NULL,
&size, record->buf); if (status != EFI_SUCCESS) {
kfree(record->buf); return efi_status_to_err(status);
}
/* * Store the name of the variable in the pstore_record priv field, so * we can reuse it later if we need to delete the EFI variable from the * variable store.
*/
wlen = (ucs2_strnlen(varname, DUMP_NAME_LEN) + 1) * sizeof(efi_char16_t);
record->priv = kmemdup(varname, wlen, GFP_KERNEL); if (!record->priv) {
kfree(record->buf); return -ENOMEM;
}
for (;;) { /* * A small set of old UEFI implementations reject sizes * above a certain threshold, the lowest seen in the wild * is 512. * * TODO: Commonize with the iteration implementation in * fs/efivarfs to keep all the quirks in one place.
*/
varname_size = 512;
/* * If this is the first read() call in the pstore enumeration, * varname will be the empty string, and the GetNextVariable() * runtime service call will return the first EFI variable in * its own enumeration order, ignoring the guid argument. * * Subsequent calls to GetNextVariable() must pass the name and * guid values returned by the previous call, which is why we * store varname in record->psi->data. Given that we only * enumerate variables with the efi-pstore GUID, there is no * need to record the guid return value.
*/
status = efivar_get_next_variable(&varname_size, varname, &guid); if (status == EFI_NOT_FOUND) return 0;
if (status != EFI_SUCCESS) return efi_status_to_err(status);
/* skip variables that don't concern us */ if (efi_guidcmp(guid, LINUX_EFI_CRASH_GUID)) continue;
staticint efivars_pstore_init(void)
{ if (!efivar_supports_writes()) return 0;
if (pstore_disable) return 0;
/* * Notice that 1024 is the minimum here to prevent issues with * decompression algorithms that were spotted during tests; * even in the case of not using compression, smaller values would * just pollute more the pstore FS with many small collected files.
*/ if (record_size < 1024)
record_size = 1024;
efi_pstore_info.buf = kmalloc(record_size, GFP_KERNEL); if (!efi_pstore_info.buf) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.