diff options
Diffstat (limited to 'fs/pstore/platform.c')
| -rw-r--r-- | fs/pstore/platform.c | 34 | 
1 files changed, 12 insertions, 22 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 82c585f715e..03ce7a9b81c 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -94,20 +94,15 @@ static const char *get_reason_str(enum kmsg_dump_reason reason)   * as we can from the end of the buffer.   */  static void pstore_dump(struct kmsg_dumper *dumper, -	    enum kmsg_dump_reason reason, -	    const char *s1, unsigned long l1, -	    const char *s2, unsigned long l2) +			enum kmsg_dump_reason reason)  { -	unsigned long	s1_start, s2_start; -	unsigned long	l1_cpy, l2_cpy; -	unsigned long	size, total = 0; -	char		*dst; +	unsigned long	total = 0;  	const char	*why;  	u64		id; -	int		hsize, ret;  	unsigned int	part = 1;  	unsigned long	flags = 0;  	int		is_locked = 0; +	int		ret;  	why = get_reason_str(reason); @@ -119,30 +114,25 @@ static void pstore_dump(struct kmsg_dumper *dumper,  		spin_lock_irqsave(&psinfo->buf_lock, flags);  	oopscount++;  	while (total < kmsg_bytes) { +		char *dst; +		unsigned long size; +		int hsize; +		size_t len; +  		dst = psinfo->buf;  		hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);  		size = psinfo->bufsize - hsize;  		dst += hsize; -		l2_cpy = min(l2, size); -		l1_cpy = min(l1, size - l2_cpy); - -		if (l1_cpy + l2_cpy == 0) +		if (!kmsg_dump_get_buffer(dumper, true, dst, size, &len))  			break; -		s2_start = l2 - l2_cpy; -		s1_start = l1 - l1_cpy; - -		memcpy(dst, s1 + s1_start, l1_cpy); -		memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); -  		ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, -				   hsize + l1_cpy + l2_cpy, psinfo); +				    hsize + len, psinfo);  		if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())  			pstore_new_entry = 1; -		l1 -= l1_cpy; -		l2 -= l2_cpy; -		total += l1_cpy + l2_cpy; + +		total += hsize + len;  		part++;  	}  	if (in_nmi()) {  |