diff options
-rw-r--r-- | drivers/acpi/apei/erst.c | 12 | ||||
-rw-r--r-- | drivers/firmware/efivars.c | 23 | ||||
-rw-r--r-- | fs/pstore/inode.c | 8 | ||||
-rw-r--r-- | fs/pstore/internal.h | 2 | ||||
-rw-r--r-- | fs/pstore/platform.c | 13 | ||||
-rw-r--r-- | fs/pstore/ram.c | 7 | ||||
-rw-r--r-- | include/linux/pstore.h | 8 |
7 files changed, 41 insertions, 32 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 0bd6ae4a899f..6d894bfd8b8f 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -931,13 +931,13 @@ static int erst_check_table(struct acpi_table_erst *erst_tab) | |||
931 | 931 | ||
932 | static int erst_open_pstore(struct pstore_info *psi); | 932 | static int erst_open_pstore(struct pstore_info *psi); |
933 | static int erst_close_pstore(struct pstore_info *psi); | 933 | static int erst_close_pstore(struct pstore_info *psi); |
934 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, | 934 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, |
935 | struct timespec *time, char **buf, | 935 | struct timespec *time, char **buf, |
936 | struct pstore_info *psi); | 936 | struct pstore_info *psi); |
937 | static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, | 937 | static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, |
938 | u64 *id, unsigned int part, | 938 | u64 *id, unsigned int part, int count, |
939 | size_t size, struct pstore_info *psi); | 939 | size_t size, struct pstore_info *psi); |
940 | static int erst_clearer(enum pstore_type_id type, u64 id, | 940 | static int erst_clearer(enum pstore_type_id type, u64 id, int count, |
941 | struct timespec time, struct pstore_info *psi); | 941 | struct timespec time, struct pstore_info *psi); |
942 | 942 | ||
943 | static struct pstore_info erst_info = { | 943 | static struct pstore_info erst_info = { |
@@ -987,7 +987,7 @@ static int erst_close_pstore(struct pstore_info *psi) | |||
987 | return 0; | 987 | return 0; |
988 | } | 988 | } |
989 | 989 | ||
990 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, | 990 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, |
991 | struct timespec *time, char **buf, | 991 | struct timespec *time, char **buf, |
992 | struct pstore_info *psi) | 992 | struct pstore_info *psi) |
993 | { | 993 | { |
@@ -1055,7 +1055,7 @@ out: | |||
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, | 1057 | static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, |
1058 | u64 *id, unsigned int part, | 1058 | u64 *id, unsigned int part, int count, |
1059 | size_t size, struct pstore_info *psi) | 1059 | size_t size, struct pstore_info *psi) |
1060 | { | 1060 | { |
1061 | struct cper_pstore_record *rcd = (struct cper_pstore_record *) | 1061 | struct cper_pstore_record *rcd = (struct cper_pstore_record *) |
@@ -1101,7 +1101,7 @@ static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, | |||
1101 | return ret; | 1101 | return ret; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static int erst_clearer(enum pstore_type_id type, u64 id, | 1104 | static int erst_clearer(enum pstore_type_id type, u64 id, int count, |
1105 | struct timespec time, struct pstore_info *psi) | 1105 | struct timespec time, struct pstore_info *psi) |
1106 | { | 1106 | { |
1107 | return erst_clear(id); | 1107 | return erst_clear(id); |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 3803621c0d45..7ad3aae6e085 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -658,13 +658,14 @@ static int efi_pstore_close(struct pstore_info *psi) | |||
658 | } | 658 | } |
659 | 659 | ||
660 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 660 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
661 | struct timespec *timespec, | 661 | int *count, struct timespec *timespec, |
662 | char **buf, struct pstore_info *psi) | 662 | char **buf, struct pstore_info *psi) |
663 | { | 663 | { |
664 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; | 664 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; |
665 | struct efivars *efivars = psi->data; | 665 | struct efivars *efivars = psi->data; |
666 | char name[DUMP_NAME_LEN]; | 666 | char name[DUMP_NAME_LEN]; |
667 | int i; | 667 | int i; |
668 | int cnt; | ||
668 | unsigned int part, size; | 669 | unsigned int part, size; |
669 | unsigned long time; | 670 | unsigned long time; |
670 | 671 | ||
@@ -674,8 +675,10 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
674 | for (i = 0; i < DUMP_NAME_LEN; i++) { | 675 | for (i = 0; i < DUMP_NAME_LEN; i++) { |
675 | name[i] = efivars->walk_entry->var.VariableName[i]; | 676 | name[i] = efivars->walk_entry->var.VariableName[i]; |
676 | } | 677 | } |
677 | if (sscanf(name, "dump-type%u-%u-%lu", type, &part, &time) == 3) { | 678 | if (sscanf(name, "dump-type%u-%u-%d-%lu", |
679 | type, &part, &cnt, &time) == 4) { | ||
678 | *id = part; | 680 | *id = part; |
681 | *count = cnt; | ||
679 | timespec->tv_sec = time; | 682 | timespec->tv_sec = time; |
680 | timespec->tv_nsec = 0; | 683 | timespec->tv_nsec = 0; |
681 | get_var_data_locked(efivars, &efivars->walk_entry->var); | 684 | get_var_data_locked(efivars, &efivars->walk_entry->var); |
@@ -698,7 +701,8 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
698 | 701 | ||
699 | static int efi_pstore_write(enum pstore_type_id type, | 702 | static int efi_pstore_write(enum pstore_type_id type, |
700 | enum kmsg_dump_reason reason, u64 *id, | 703 | enum kmsg_dump_reason reason, u64 *id, |
701 | unsigned int part, size_t size, struct pstore_info *psi) | 704 | unsigned int part, int count, size_t size, |
705 | struct pstore_info *psi) | ||
702 | { | 706 | { |
703 | char name[DUMP_NAME_LEN]; | 707 | char name[DUMP_NAME_LEN]; |
704 | efi_char16_t efi_name[DUMP_NAME_LEN]; | 708 | efi_char16_t efi_name[DUMP_NAME_LEN]; |
@@ -725,7 +729,7 @@ static int efi_pstore_write(enum pstore_type_id type, | |||
725 | return -ENOSPC; | 729 | return -ENOSPC; |
726 | } | 730 | } |
727 | 731 | ||
728 | sprintf(name, "dump-type%u-%u-%lu", type, part, | 732 | sprintf(name, "dump-type%u-%u-%d-%lu", type, part, count, |
729 | get_seconds()); | 733 | get_seconds()); |
730 | 734 | ||
731 | for (i = 0; i < DUMP_NAME_LEN; i++) | 735 | for (i = 0; i < DUMP_NAME_LEN; i++) |
@@ -746,7 +750,7 @@ static int efi_pstore_write(enum pstore_type_id type, | |||
746 | return ret; | 750 | return ret; |
747 | }; | 751 | }; |
748 | 752 | ||
749 | static int efi_pstore_erase(enum pstore_type_id type, u64 id, | 753 | static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, |
750 | struct timespec time, struct pstore_info *psi) | 754 | struct timespec time, struct pstore_info *psi) |
751 | { | 755 | { |
752 | char name[DUMP_NAME_LEN]; | 756 | char name[DUMP_NAME_LEN]; |
@@ -756,7 +760,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, | |||
756 | struct efivar_entry *entry, *found = NULL; | 760 | struct efivar_entry *entry, *found = NULL; |
757 | int i; | 761 | int i; |
758 | 762 | ||
759 | sprintf(name, "dump-type%u-%u-%lu", type, (unsigned int)id, | 763 | sprintf(name, "dump-type%u-%u-%d-%lu", type, (unsigned int)id, count, |
760 | time.tv_sec); | 764 | time.tv_sec); |
761 | 765 | ||
762 | spin_lock(&efivars->lock); | 766 | spin_lock(&efivars->lock); |
@@ -807,7 +811,7 @@ static int efi_pstore_close(struct pstore_info *psi) | |||
807 | return 0; | 811 | return 0; |
808 | } | 812 | } |
809 | 813 | ||
810 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 814 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count, |
811 | struct timespec *timespec, | 815 | struct timespec *timespec, |
812 | char **buf, struct pstore_info *psi) | 816 | char **buf, struct pstore_info *psi) |
813 | { | 817 | { |
@@ -816,12 +820,13 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
816 | 820 | ||
817 | static int efi_pstore_write(enum pstore_type_id type, | 821 | static int efi_pstore_write(enum pstore_type_id type, |
818 | enum kmsg_dump_reason reason, u64 *id, | 822 | enum kmsg_dump_reason reason, u64 *id, |
819 | unsigned int part, size_t size, struct pstore_info *psi) | 823 | unsigned int part, int count, size_t size, |
824 | struct pstore_info *psi) | ||
820 | { | 825 | { |
821 | return 0; | 826 | return 0; |
822 | } | 827 | } |
823 | 828 | ||
824 | static int efi_pstore_erase(enum pstore_type_id type, u64 id, | 829 | static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, |
825 | struct timespec time, struct pstore_info *psi) | 830 | struct timespec time, struct pstore_info *psi) |
826 | { | 831 | { |
827 | return 0; | 832 | return 0; |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 4300af654710..ed1d8c7212da 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -49,6 +49,7 @@ struct pstore_private { | |||
49 | struct pstore_info *psi; | 49 | struct pstore_info *psi; |
50 | enum pstore_type_id type; | 50 | enum pstore_type_id type; |
51 | u64 id; | 51 | u64 id; |
52 | int count; | ||
52 | ssize_t size; | 53 | ssize_t size; |
53 | char data[]; | 54 | char data[]; |
54 | }; | 55 | }; |
@@ -175,8 +176,8 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) | |||
175 | struct pstore_private *p = dentry->d_inode->i_private; | 176 | struct pstore_private *p = dentry->d_inode->i_private; |
176 | 177 | ||
177 | if (p->psi->erase) | 178 | if (p->psi->erase) |
178 | p->psi->erase(p->type, p->id, dentry->d_inode->i_ctime, | 179 | p->psi->erase(p->type, p->id, p->count, |
179 | p->psi); | 180 | dentry->d_inode->i_ctime, p->psi); |
180 | 181 | ||
181 | return simple_unlink(dir, dentry); | 182 | return simple_unlink(dir, dentry); |
182 | } | 183 | } |
@@ -271,7 +272,7 @@ int pstore_is_mounted(void) | |||
271 | * Load it up with "size" bytes of data from "buf". | 272 | * Load it up with "size" bytes of data from "buf". |
272 | * Set the mtime & ctime to the date that this record was originally stored. | 273 | * Set the mtime & ctime to the date that this record was originally stored. |
273 | */ | 274 | */ |
274 | int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, | 275 | int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, |
275 | char *data, size_t size, struct timespec time, | 276 | char *data, size_t size, struct timespec time, |
276 | struct pstore_info *psi) | 277 | struct pstore_info *psi) |
277 | { | 278 | { |
@@ -307,6 +308,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, | |||
307 | goto fail_alloc; | 308 | goto fail_alloc; |
308 | private->type = type; | 309 | private->type = type; |
309 | private->id = id; | 310 | private->id = id; |
311 | private->count = count; | ||
310 | private->psi = psi; | 312 | private->psi = psi; |
311 | 313 | ||
312 | switch (type) { | 314 | switch (type) { |
diff --git a/fs/pstore/internal.h b/fs/pstore/internal.h index 4847f588b7d5..937d820f273c 100644 --- a/fs/pstore/internal.h +++ b/fs/pstore/internal.h | |||
@@ -50,7 +50,7 @@ extern struct pstore_info *psinfo; | |||
50 | extern void pstore_set_kmsg_bytes(int); | 50 | extern void pstore_set_kmsg_bytes(int); |
51 | extern void pstore_get_records(int); | 51 | extern void pstore_get_records(int); |
52 | extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id, | 52 | extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id, |
53 | char *data, size_t size, | 53 | int count, char *data, size_t size, |
54 | struct timespec time, struct pstore_info *psi); | 54 | struct timespec time, struct pstore_info *psi); |
55 | extern int pstore_is_mounted(void); | 55 | extern int pstore_is_mounted(void); |
56 | 56 | ||
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 947fbe06c3b1..5ea2e77ff023 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -136,7 +136,7 @@ static void pstore_dump(struct kmsg_dumper *dumper, | |||
136 | break; | 136 | break; |
137 | 137 | ||
138 | ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, | 138 | ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, |
139 | hsize + len, psinfo); | 139 | oopscount, hsize + len, psinfo); |
140 | if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) | 140 | if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) |
141 | pstore_new_entry = 1; | 141 | pstore_new_entry = 1; |
142 | 142 | ||
@@ -173,7 +173,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) | |||
173 | spin_lock_irqsave(&psinfo->buf_lock, flags); | 173 | spin_lock_irqsave(&psinfo->buf_lock, flags); |
174 | } | 174 | } |
175 | memcpy(psinfo->buf, s, c); | 175 | memcpy(psinfo->buf, s, c); |
176 | psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, c, psinfo); | 176 | psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, c, psinfo); |
177 | spin_unlock_irqrestore(&psinfo->buf_lock, flags); | 177 | spin_unlock_irqrestore(&psinfo->buf_lock, flags); |
178 | s += c; | 178 | s += c; |
179 | c = e - s; | 179 | c = e - s; |
@@ -197,7 +197,7 @@ static void pstore_register_console(void) {} | |||
197 | 197 | ||
198 | static int pstore_write_compat(enum pstore_type_id type, | 198 | static int pstore_write_compat(enum pstore_type_id type, |
199 | enum kmsg_dump_reason reason, | 199 | enum kmsg_dump_reason reason, |
200 | u64 *id, unsigned int part, | 200 | u64 *id, unsigned int part, int count, |
201 | size_t size, struct pstore_info *psi) | 201 | size_t size, struct pstore_info *psi) |
202 | { | 202 | { |
203 | return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi); | 203 | return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi); |
@@ -267,6 +267,7 @@ void pstore_get_records(int quiet) | |||
267 | char *buf = NULL; | 267 | char *buf = NULL; |
268 | ssize_t size; | 268 | ssize_t size; |
269 | u64 id; | 269 | u64 id; |
270 | int count; | ||
270 | enum pstore_type_id type; | 271 | enum pstore_type_id type; |
271 | struct timespec time; | 272 | struct timespec time; |
272 | int failed = 0, rc; | 273 | int failed = 0, rc; |
@@ -278,9 +279,9 @@ void pstore_get_records(int quiet) | |||
278 | if (psi->open && psi->open(psi)) | 279 | if (psi->open && psi->open(psi)) |
279 | goto out; | 280 | goto out; |
280 | 281 | ||
281 | while ((size = psi->read(&id, &type, &time, &buf, psi)) > 0) { | 282 | while ((size = psi->read(&id, &type, &count, &time, &buf, psi)) > 0) { |
282 | rc = pstore_mkfile(type, psi->name, id, buf, (size_t)size, | 283 | rc = pstore_mkfile(type, psi->name, id, count, buf, |
283 | time, psi); | 284 | (size_t)size, time, psi); |
284 | kfree(buf); | 285 | kfree(buf); |
285 | buf = NULL; | 286 | buf = NULL; |
286 | if (rc && (rc != -EEXIST || !quiet)) | 287 | if (rc && (rc != -EEXIST || !quiet)) |
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 749693fcb75a..2bfa36e0ffe8 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -132,9 +132,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, | |||
132 | } | 132 | } |
133 | 133 | ||
134 | static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | 134 | static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, |
135 | struct timespec *time, | 135 | int *count, struct timespec *time, |
136 | char **buf, | 136 | char **buf, struct pstore_info *psi) |
137 | struct pstore_info *psi) | ||
138 | { | 137 | { |
139 | ssize_t size; | 138 | ssize_t size; |
140 | struct ramoops_context *cxt = psi->data; | 139 | struct ramoops_context *cxt = psi->data; |
@@ -236,7 +235,7 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, | |||
236 | return 0; | 235 | return 0; |
237 | } | 236 | } |
238 | 237 | ||
239 | static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, | 238 | static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, int count, |
240 | struct timespec time, struct pstore_info *psi) | 239 | struct timespec time, struct pstore_info *psi) |
241 | { | 240 | { |
242 | struct ramoops_context *cxt = psi->data; | 241 | struct ramoops_context *cxt = psi->data; |
diff --git a/include/linux/pstore.h b/include/linux/pstore.h index f6e93362d259..1788909d9a99 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h | |||
@@ -50,17 +50,19 @@ struct pstore_info { | |||
50 | int (*open)(struct pstore_info *psi); | 50 | int (*open)(struct pstore_info *psi); |
51 | int (*close)(struct pstore_info *psi); | 51 | int (*close)(struct pstore_info *psi); |
52 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, | 52 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, |
53 | struct timespec *time, char **buf, | 53 | int *count, struct timespec *time, char **buf, |
54 | struct pstore_info *psi); | 54 | struct pstore_info *psi); |
55 | int (*write)(enum pstore_type_id type, | 55 | int (*write)(enum pstore_type_id type, |
56 | enum kmsg_dump_reason reason, u64 *id, | 56 | enum kmsg_dump_reason reason, u64 *id, |
57 | unsigned int part, size_t size, struct pstore_info *psi); | 57 | unsigned int part, int count, size_t size, |
58 | struct pstore_info *psi); | ||
58 | int (*write_buf)(enum pstore_type_id type, | 59 | int (*write_buf)(enum pstore_type_id type, |
59 | enum kmsg_dump_reason reason, u64 *id, | 60 | enum kmsg_dump_reason reason, u64 *id, |
60 | unsigned int part, const char *buf, size_t size, | 61 | unsigned int part, const char *buf, size_t size, |
61 | struct pstore_info *psi); | 62 | struct pstore_info *psi); |
62 | int (*erase)(enum pstore_type_id type, u64 id, | 63 | int (*erase)(enum pstore_type_id type, u64 id, |
63 | struct timespec time, struct pstore_info *psi); | 64 | int count, struct timespec time, |
65 | struct pstore_info *psi); | ||
64 | void *data; | 66 | void *data; |
65 | }; | 67 | }; |
66 | 68 | ||