Re: [PATCH 3/3] efi: Add support for using efivars as a pstorebackend

From: Randy Dunlap
Date: Tue Jun 07 2011 - 14:04:37 EST


On Mon, 6 Jun 2011 15:38:55 -0400 Matthew Garrett wrote:

> EFI provides an area of nonvolatile storage managed by the firmware. We
> can use this as a pstore backend to maintain copies of oopses, aiding
> diagnosis.
>
> Signed-off-by: Matthew Garrett <mjg@xxxxxxxxxx>
> ---
> drivers/firmware/efivars.c | 158 +++++++++++++++++++++++++++++++++++++++++++-
> include/linux/efi.h | 3 +
> 2 files changed, 159 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
> index 5f29aaf..89e6a3a 100644
> --- a/drivers/firmware/efivars.c
> +++ b/drivers/firmware/efivars.c
> @@ -161,18 +164,28 @@ utf8_strsize(efi_char16_t *data, unsigned long maxlength)
> }
>
> static efi_status_t
> -get_var_data(struct efivars *efivars, struct efi_variable *var)
> +get_var_data_locked(struct efivars *efivars, struct efi_variable *var)

__get_var_data() would be a more common/typical name for this (unlocked,
needs locking version), I think.

> {
> efi_status_t status;
>
> - spin_lock(&efivars->lock);
> var->DataSize = 1024;
> status = efivars->ops->get_variable(var->VariableName,
> &var->VendorGuid,
> &var->Attributes,
> &var->DataSize,
> var->Data);
> + return status;
> +}
> +
> +static efi_status_t
> +get_var_data(struct efivars *efivars, struct efi_variable *var)
> +{
> + efi_status_t status;
> +
> + spin_lock(&efivars->lock);
> + status = get_var_data_locked(efivars, var);
> spin_unlock(&efivars->lock);
> +
> if (status != EFI_SUCCESS) {
> printk(KERN_WARNING "efivars: get_variable() failed 0x%lx!\n",
> status);


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/