Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
16182ac1
Commit
16182ac1
authored
Feb 22, 2021
by
Petr Mladek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'printk-rework' into for-linus
parents
2a8c3a64
13791c80
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
kernel/printk/printk.c
kernel/printk/printk.c
+18
-10
kernel/printk/printk_ringbuffer.h
kernel/printk/printk_ringbuffer.h
+1
-1
No files found.
kernel/printk/printk.c
View file @
16182ac1
...
@@ -735,9 +735,9 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
...
@@ -735,9 +735,9 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
logbuf_lock_irq
();
logbuf_lock_irq
();
}
}
if
(
user
->
seq
<
prb_first_valid_seq
(
prb
)
)
{
if
(
r
->
info
->
seq
!=
user
->
seq
)
{
/* our last seen message is gone, return error and reset */
/* our last seen message is gone, return error and reset */
user
->
seq
=
prb_first_valid_seq
(
prb
)
;
user
->
seq
=
r
->
info
->
seq
;
ret
=
-
EPIPE
;
ret
=
-
EPIPE
;
logbuf_unlock_irq
();
logbuf_unlock_irq
();
goto
out
;
goto
out
;
...
@@ -812,6 +812,7 @@ static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence)
...
@@ -812,6 +812,7 @@ static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence)
static
__poll_t
devkmsg_poll
(
struct
file
*
file
,
poll_table
*
wait
)
static
__poll_t
devkmsg_poll
(
struct
file
*
file
,
poll_table
*
wait
)
{
{
struct
devkmsg_user
*
user
=
file
->
private_data
;
struct
devkmsg_user
*
user
=
file
->
private_data
;
struct
printk_info
info
;
__poll_t
ret
=
0
;
__poll_t
ret
=
0
;
if
(
!
user
)
if
(
!
user
)
...
@@ -820,9 +821,9 @@ static __poll_t devkmsg_poll(struct file *file, poll_table *wait)
...
@@ -820,9 +821,9 @@ static __poll_t devkmsg_poll(struct file *file, poll_table *wait)
poll_wait
(
file
,
&
log_wait
,
wait
);
poll_wait
(
file
,
&
log_wait
,
wait
);
logbuf_lock_irq
();
logbuf_lock_irq
();
if
(
prb_read_valid
(
prb
,
user
->
seq
,
NULL
))
{
if
(
prb_read_valid
_info
(
prb
,
user
->
seq
,
&
info
,
NULL
))
{
/* return error when data has vanished underneath us */
/* return error when data has vanished underneath us */
if
(
user
->
seq
<
prb_first_valid_seq
(
prb
)
)
if
(
info
.
seq
!=
user
->
seq
)
ret
=
EPOLLIN
|
EPOLLRDNORM
|
EPOLLERR
|
EPOLLPRI
;
ret
=
EPOLLIN
|
EPOLLRDNORM
|
EPOLLERR
|
EPOLLPRI
;
else
else
ret
=
EPOLLIN
|
EPOLLRDNORM
;
ret
=
EPOLLIN
|
EPOLLRDNORM
;
...
@@ -1559,6 +1560,7 @@ static void syslog_clear(void)
...
@@ -1559,6 +1560,7 @@ static void syslog_clear(void)
int
do_syslog
(
int
type
,
char
__user
*
buf
,
int
len
,
int
source
)
int
do_syslog
(
int
type
,
char
__user
*
buf
,
int
len
,
int
source
)
{
{
struct
printk_info
info
;
bool
clear
=
false
;
bool
clear
=
false
;
static
int
saved_console_loglevel
=
LOGLEVEL_DEFAULT
;
static
int
saved_console_loglevel
=
LOGLEVEL_DEFAULT
;
int
error
;
int
error
;
...
@@ -1629,9 +1631,14 @@ int do_syslog(int type, char __user *buf, int len, int source)
...
@@ -1629,9 +1631,14 @@ int do_syslog(int type, char __user *buf, int len, int source)
/* Number of chars in the log buffer */
/* Number of chars in the log buffer */
case
SYSLOG_ACTION_SIZE_UNREAD
:
case
SYSLOG_ACTION_SIZE_UNREAD
:
logbuf_lock_irq
();
logbuf_lock_irq
();
if
(
syslog_seq
<
prb_first_valid_seq
(
prb
))
{
if
(
!
prb_read_valid_info
(
prb
,
syslog_seq
,
&
info
,
NULL
))
{
/* No unread messages. */
logbuf_unlock_irq
();
return
0
;
}
if
(
info
.
seq
!=
syslog_seq
)
{
/* messages are gone, move to first one */
/* messages are gone, move to first one */
syslog_seq
=
prb_first_valid_seq
(
prb
)
;
syslog_seq
=
info
.
seq
;
syslog_partial
=
0
;
syslog_partial
=
0
;
}
}
if
(
source
==
SYSLOG_FROM_PROC
)
{
if
(
source
==
SYSLOG_FROM_PROC
)
{
...
@@ -1643,7 +1650,6 @@ int do_syslog(int type, char __user *buf, int len, int source)
...
@@ -1643,7 +1650,6 @@ int do_syslog(int type, char __user *buf, int len, int source)
error
=
prb_next_seq
(
prb
)
-
syslog_seq
;
error
=
prb_next_seq
(
prb
)
-
syslog_seq
;
}
else
{
}
else
{
bool
time
=
syslog_partial
?
syslog_time
:
printk_time
;
bool
time
=
syslog_partial
?
syslog_time
:
printk_time
;
struct
printk_info
info
;
unsigned
int
line_count
;
unsigned
int
line_count
;
u64
seq
;
u64
seq
;
...
@@ -3429,9 +3435,11 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
...
@@ -3429,9 +3435,11 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
goto
out
;
goto
out
;
logbuf_lock_irqsave
(
flags
);
logbuf_lock_irqsave
(
flags
);
if
(
dumper
->
cur_seq
<
prb_first_valid_seq
(
prb
))
{
if
(
prb_read_valid_info
(
prb
,
dumper
->
cur_seq
,
&
info
,
NULL
))
{
if
(
info
.
seq
!=
dumper
->
cur_seq
)
{
/* messages are gone, move to first available one */
/* messages are gone, move to first available one */
dumper
->
cur_seq
=
prb_first_valid_seq
(
prb
);
dumper
->
cur_seq
=
info
.
seq
;
}
}
}
/* last entry */
/* last entry */
...
...
kernel/printk/printk_ringbuffer.h
View file @
16182ac1
...
@@ -287,7 +287,7 @@ _DEFINE_PRINTKRB(name, descbits, avgtextbits, &_##name##_text[0])
...
@@ -287,7 +287,7 @@ _DEFINE_PRINTKRB(name, descbits, avgtextbits, &_##name##_text[0])
/* Writer Interface */
/* Writer Interface */
/**
/**
* prb_rec_init_w
d
() - Initialize a buffer for writing records.
* prb_rec_init_w
r
() - Initialize a buffer for writing records.
*
*
* @r: The record to initialize.
* @r: The record to initialize.
* @text_buf_size: The needed text buffer size.
* @text_buf_size: The needed text buffer size.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment