/* Some UEFI firmware does not implement QueryVariableInfo() */
storage_space = remaining_space = 0; if (efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)) {
status = efivar_query_variable_info(attr, &storage_space,
&remaining_space,
&max_variable_size); if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED)
pr_warn_ratelimited("query_variable_info() failed: 0x%lx\n",
status);
}
/* * This is not a normal filesystem, so no point in pretending it has a block * size; we declare f_bsize to 1, so that we can then report the exact value * sent by EFI QueryVariableInfo in f_blocks and f_bfree
*/
buf->f_bsize = 1;
buf->f_namelen = NAME_MAX;
buf->f_blocks = storage_space;
buf->f_bfree = remaining_space;
buf->f_type = dentry->d_sb->s_magic;
buf->f_fsid = u64_to_fsid(id);
/* * In f_bavail we declare the free space that the kernel will allow writing * when the storage_paranoia x86 quirk is active. To use more, users * should boot the kernel with efi_no_storage_paranoia.
*/ if (remaining_space > efivar_reserved_space())
buf->f_bavail = remaining_space - efivar_reserved_space(); else
buf->f_bavail = 0;
/* * Compare two efivarfs file names. * * An efivarfs filename is composed of two parts, * * 1. A case-sensitive variable name * 2. A case-insensitive GUID * * So we need to perform a case-sensitive match on part 1 and a * case-insensitive match on part 2.
*/ staticint efivarfs_d_compare(conststruct dentry *dentry, unsignedint len, constchar *str, conststruct qstr *name)
{ int guid = len - EFI_VARIABLE_GUID_LEN;
/* Parallel lookups may produce a temporary invalid filename */ if (guid <= 0) return 1;
if (name->len != len) return 1;
/* Case-sensitive compare for the variable name */ if (memcmp(str, name->name, guid)) return 1;
/* Case-insensitive compare for the GUID */ return strncasecmp(name->name + guid, str + guid, EFI_VARIABLE_GUID_LEN);
}
if (!name) /* * If the allocation failed there'll already be an * error in the log (and likely a huge and growing * number of them since they system will be under * extreme memory pressure), so simply assume * collision for safety but don't add to the log * flood.
*/ returntrue;
dentry = try_lookup_noperm(&QSTR(name), sb->s_root);
kfree(name); if (!IS_ERR_OR_NULL(dentry))
dput(dentry);
staticint efivarfs_reconfigure(struct fs_context *fc)
{ if (!efivar_supports_writes() && !(fc->sb_flags & SB_RDONLY)) {
pr_err("Firmware does not support SetVariableRT. Can not remount with rw\n"); return -EINVAL;
}
/* * Unconditionally resync the variable state on a thaw request. * Given the size of efivarfs it really doesn't matter to simply * iterate through all of the entries and resync. Freeze/thaw * requests are rare enough for that to not matter and the * number of entries is pretty low too. So we really don't care.
*/
pr_info("efivarfs: resyncing variable state\n"); for (;;) { int err; unsignedlong size = 0; struct inode *inode; struct efivar_entry *entry;
child = find_next_child(sb->s_root, child); if (!child) break;
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.