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
849f3127
Commit
849f3127
authored
Aug 23, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch /dev/kmsg to ->write_iter()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
cd678fce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
kernel/printk/printk.c
kernel/printk/printk.c
+7
-13
No files found.
kernel/printk/printk.c
View file @
849f3127
...
...
@@ -519,14 +519,13 @@ struct devkmsg_user {
char
buf
[
8192
];
};
static
ssize_t
devkmsg_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iv
,
unsigned
long
count
,
loff_t
pos
)
static
ssize_t
devkmsg_write
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
)
{
char
*
buf
,
*
line
;
int
i
;
int
level
=
default_message_loglevel
;
int
facility
=
1
;
/* LOG_USER */
size_t
len
=
io
v_length
(
iv
,
count
)
;
size_t
len
=
io
cb
->
ki_nbytes
;
ssize_t
ret
=
len
;
if
(
len
>
LOG_LINE_MAX
)
...
...
@@ -535,13 +534,10 @@ static ssize_t devkmsg_writev(struct kiocb *iocb, const struct iovec *iv,
if
(
buf
==
NULL
)
return
-
ENOMEM
;
line
=
buf
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
copy_from_user
(
line
,
iv
[
i
].
iov_base
,
iv
[
i
].
iov_len
))
{
ret
=
-
EFAULT
;
goto
out
;
}
line
+=
iv
[
i
].
iov_len
;
buf
[
len
]
=
'\0'
;
if
(
copy_from_iter
(
buf
,
len
,
from
)
!=
len
)
{
kfree
(
buf
);
return
-
EFAULT
;
}
/*
...
...
@@ -567,10 +563,8 @@ static ssize_t devkmsg_writev(struct kiocb *iocb, const struct iovec *iv,
line
=
endp
;
}
}
line
[
len
]
=
'\0'
;
printk_emit
(
facility
,
level
,
NULL
,
0
,
"%s"
,
line
);
out:
kfree
(
buf
);
return
ret
;
}
...
...
@@ -802,7 +796,7 @@ static int devkmsg_release(struct inode *inode, struct file *file)
const
struct
file_operations
kmsg_fops
=
{
.
open
=
devkmsg_open
,
.
read
=
devkmsg_read
,
.
aio_write
=
devkmsg_writev
,
.
write_iter
=
devkmsg_write
,
.
llseek
=
devkmsg_llseek
,
.
poll
=
devkmsg_poll
,
.
release
=
devkmsg_release
,
...
...
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