• Anisse Astier's avatar
    efivarfs: expose used and total size · d86ff333
    Anisse Astier authored
    When writing EFI variables, one might get errors with no other message
    on why it fails. Being able to see how much is used by EFI variables
    helps analyzing such issues.
    
    Since this is not a conventional filesystem, block size is intentionally
    set to 1 instead of PAGE_SIZE.
    
    x86 quirks of reserved size are taken into account; so that available
    and free size can be different, further helping debugging space issues.
    
    With this patch, one can see the remaining space in EFI variable storage
    via efivarfs, like this:
    
       $ df -h /sys/firmware/efi/efivars/
       Filesystem      Size  Used Avail Use% Mounted on
       efivarfs        176K  106K   66K  62% /sys/firmware/efi/efivars
    Signed-off-by: default avatarAnisse Astier <an.astier@criteo.com>
    [ardb: - rename efi_reserved_space() to efivar_reserved_space()
           - whitespace/coding style tweaks]
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    d86ff333
quirks.c 21.7 KB