aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorSeiji Aguchi <seiji.aguchi@hds.com>2012-11-14 15:27:28 -0500
committerTony Luck <tony.luck@intel.com>2012-11-26 19:02:12 -0500
commita9efd39cd547223597cfe7c53acec44c099b9264 (patch)
tree293feed9e89d811235371d389f7787eddf2899e1 /drivers/firmware
parent96480d9c8fcfd7e325e9be6a6c6846689707f8e0 (diff)
efi_pstore: Add ctime to argument of erase callback
[Issue] Currently, a variable name, which is used to identify each log entry, consists of type, id and ctime. But an erase callback does not use ctime. If efi_pstore supported just one log, type and id were enough. However, in case of supporting multiple logs, it doesn't work because it can't distinguish each entry without ctime at erasing time. <Example> As you can see below, efi_pstore can't differentiate first event from second one without ctime. a variable name of first event: dump-type0-1-12345678 a variable name of second event: dump-type0-1-23456789 type:0 id:1 ctime:12345678, 23456789 [Solution] This patch adds ctime to an argument of an erase callback. It works across reboots because ctime of pstore means the date that the record was originally stored. To do this, efi_pstore saves the ctime to variable name at writing time and passes it to pstore at reading time. Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com> Acked-by: Mike Waychison <mikew@google.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efivars.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index fbe9202c2678..3803621c0d45 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -747,24 +747,25 @@ static int efi_pstore_write(enum pstore_type_id type,
747}; 747};
748 748
749static int efi_pstore_erase(enum pstore_type_id type, u64 id, 749static int efi_pstore_erase(enum pstore_type_id type, u64 id,
750 struct pstore_info *psi) 750 struct timespec time, struct pstore_info *psi)
751{ 751{
752 char stub_name[DUMP_NAME_LEN]; 752 char name[DUMP_NAME_LEN];
753 efi_char16_t efi_name[DUMP_NAME_LEN]; 753 efi_char16_t efi_name[DUMP_NAME_LEN];
754 efi_guid_t vendor = LINUX_EFI_CRASH_GUID; 754 efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
755 struct efivars *efivars = psi->data; 755 struct efivars *efivars = psi->data;
756 struct efivar_entry *entry, *found = NULL; 756 struct efivar_entry *entry, *found = NULL;
757 int i; 757 int i;
758 758
759 sprintf(stub_name, "dump-type%u-%u-", type, (unsigned int)id); 759 sprintf(name, "dump-type%u-%u-%lu", type, (unsigned int)id,
760 time.tv_sec);
760 761
761 spin_lock(&efivars->lock); 762 spin_lock(&efivars->lock);
762 763
763 for (i = 0; i < DUMP_NAME_LEN; i++) 764 for (i = 0; i < DUMP_NAME_LEN; i++)
764 efi_name[i] = stub_name[i]; 765 efi_name[i] = name[i];
765 766
766 /* 767 /*
767 * Clean up any entries with the same name 768 * Clean up an entry with the same name
768 */ 769 */
769 770
770 list_for_each_entry(entry, &efivars->list, list) { 771 list_for_each_entry(entry, &efivars->list, list) {
@@ -775,9 +776,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id,
775 if (utf16_strncmp(entry->var.VariableName, efi_name, 776 if (utf16_strncmp(entry->var.VariableName, efi_name,
776 utf16_strlen(efi_name))) 777 utf16_strlen(efi_name)))
777 continue; 778 continue;
778 /* Needs to be a prefix */
779 if (entry->var.VariableName[utf16_strlen(efi_name)] == 0)
780 continue;
781 779
782 /* found */ 780 /* found */
783 found = entry; 781 found = entry;
@@ -785,6 +783,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id,
785 &entry->var.VendorGuid, 783 &entry->var.VendorGuid,
786 PSTORE_EFI_ATTRIBUTES, 784 PSTORE_EFI_ATTRIBUTES,
787 0, NULL); 785 0, NULL);
786 break;
788 } 787 }
789 788
790 if (found) 789 if (found)
@@ -823,7 +822,7 @@ static int efi_pstore_write(enum pstore_type_id type,
823} 822}
824 823
825static int efi_pstore_erase(enum pstore_type_id type, u64 id, 824static int efi_pstore_erase(enum pstore_type_id type, u64 id,
826 struct pstore_info *psi) 825 struct timespec time, struct pstore_info *psi)
827{ 826{
828 return 0; 827 return 0;
829} 828}