@@ -3373,7 +3373,7 @@ void kmsg_dump(enum kmsg_dump_reason reason)
33733373}
33743374
33753375/**
3376- * kmsg_dump_get_line_nolock - retrieve one kmsg log line (unlocked version)
3376+ * kmsg_dump_get_line - retrieve one kmsg log line
33773377 * @iter: kmsg dump iterator
33783378 * @syslog: include the "<4>" prefixes
33793379 * @line: buffer to copy the line to
@@ -3388,22 +3388,22 @@ void kmsg_dump(enum kmsg_dump_reason reason)
33883388 *
33893389 * A return value of FALSE indicates that there are no more records to
33903390 * read.
3391- *
3392- * The function is similar to kmsg_dump_get_line(), but grabs no locks.
33933391 */
3394- bool kmsg_dump_get_line_nolock (struct kmsg_dump_iter * iter , bool syslog ,
3395- char * line , size_t size , size_t * len )
3392+ bool kmsg_dump_get_line (struct kmsg_dump_iter * iter , bool syslog ,
3393+ char * line , size_t size , size_t * len )
33963394{
33973395 u64 min_seq = latched_seq_read_nolock (& clear_seq );
33983396 struct printk_info info ;
33993397 unsigned int line_count ;
34003398 struct printk_record r ;
3399+ unsigned long flags ;
34013400 size_t l = 0 ;
34023401 bool ret = false;
34033402
34043403 if (iter -> cur_seq < min_seq )
34053404 iter -> cur_seq = min_seq ;
34063405
3406+ printk_safe_enter_irqsave (flags );
34073407 prb_rec_init_rd (& r , & info , line , size );
34083408
34093409 /* Read text or count text lines? */
@@ -3424,40 +3424,11 @@ bool kmsg_dump_get_line_nolock(struct kmsg_dump_iter *iter, bool syslog,
34243424 iter -> cur_seq = r .info -> seq + 1 ;
34253425 ret = true;
34263426out :
3427+ printk_safe_exit_irqrestore (flags );
34273428 if (len )
34283429 * len = l ;
34293430 return ret ;
34303431}
3431-
3432- /**
3433- * kmsg_dump_get_line - retrieve one kmsg log line
3434- * @iter: kmsg dump iterator
3435- * @syslog: include the "<4>" prefixes
3436- * @line: buffer to copy the line to
3437- * @size: maximum size of the buffer
3438- * @len: length of line placed into buffer
3439- *
3440- * Start at the beginning of the kmsg buffer, with the oldest kmsg
3441- * record, and copy one record into the provided buffer.
3442- *
3443- * Consecutive calls will return the next available record moving
3444- * towards the end of the buffer with the youngest messages.
3445- *
3446- * A return value of FALSE indicates that there are no more records to
3447- * read.
3448- */
3449- bool kmsg_dump_get_line (struct kmsg_dump_iter * iter , bool syslog ,
3450- char * line , size_t size , size_t * len )
3451- {
3452- unsigned long flags ;
3453- bool ret ;
3454-
3455- printk_safe_enter_irqsave (flags );
3456- ret = kmsg_dump_get_line_nolock (iter , syslog , line , size , len );
3457- printk_safe_exit_irqrestore (flags );
3458-
3459- return ret ;
3460- }
34613432EXPORT_SYMBOL_GPL (kmsg_dump_get_line );
34623433
34633434/**
@@ -3550,22 +3521,6 @@ bool kmsg_dump_get_buffer(struct kmsg_dump_iter *iter, bool syslog,
35503521}
35513522EXPORT_SYMBOL_GPL (kmsg_dump_get_buffer );
35523523
3553- /**
3554- * kmsg_dump_rewind_nolock - reset the iterator (unlocked version)
3555- * @iter: kmsg dump iterator
3556- *
3557- * Reset the dumper's iterator so that kmsg_dump_get_line() and
3558- * kmsg_dump_get_buffer() can be called again and used multiple
3559- * times within the same dumper.dump() callback.
3560- *
3561- * The function is similar to kmsg_dump_rewind(), but grabs no locks.
3562- */
3563- void kmsg_dump_rewind_nolock (struct kmsg_dump_iter * iter )
3564- {
3565- iter -> cur_seq = latched_seq_read_nolock (& clear_seq );
3566- iter -> next_seq = prb_next_seq (prb );
3567- }
3568-
35693524/**
35703525 * kmsg_dump_rewind - reset the iterator
35713526 * @iter: kmsg dump iterator
@@ -3579,7 +3534,8 @@ void kmsg_dump_rewind(struct kmsg_dump_iter *iter)
35793534 unsigned long flags ;
35803535
35813536 printk_safe_enter_irqsave (flags );
3582- kmsg_dump_rewind_nolock (iter );
3537+ iter -> cur_seq = latched_seq_read_nolock (& clear_seq );
3538+ iter -> next_seq = prb_next_seq (prb );
35833539 printk_safe_exit_irqrestore (flags );
35843540}
35853541EXPORT_SYMBOL_GPL (kmsg_dump_rewind );
0 commit comments