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
a69755b1
Commit
a69755b1
authored
Mar 31, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xtensa simdisk: switch to proc_create_data()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
78846ce6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
arch/xtensa/platforms/iss/simdisk.c
arch/xtensa/platforms/iss/simdisk.c
+23
-13
No files found.
arch/xtensa/platforms/iss/simdisk.c
View file @
a69755b1
...
@@ -214,20 +214,27 @@ static int simdisk_detach(struct simdisk *dev)
...
@@ -214,20 +214,27 @@ static int simdisk_detach(struct simdisk *dev)
return
err
;
return
err
;
}
}
static
int
proc_read_simdisk
(
char
*
page
,
char
**
start
,
off_t
of
f
,
static
ssize_t
proc_read_simdisk
(
struct
file
*
file
,
char
__user
*
bu
f
,
int
count
,
int
*
eof
,
void
*
data
)
size_t
size
,
loff_t
*
ppos
)
{
{
int
len
;
struct
simdisk
*
dev
=
PDE
(
file_inode
(
file
))
->
data
;
struct
simdisk
*
dev
=
(
struct
simdisk
*
)
data
;
char
*
s
=
dev
->
filename
;
len
=
sprintf
(
page
,
"%s
\n
"
,
dev
->
filename
?
dev
->
filename
:
""
);
if
(
s
)
{
return
len
;
ssize_t
n
=
simple_read_from_buffer
(
buf
,
size
,
ppos
,
s
,
strlen
(
s
));
if
(
n
<
0
)
return
n
;
buf
+=
n
;
size
-=
n
;
}
return
simple_read_from_buffer
(
buf
,
size
,
ppos
,
"
\n
"
,
1
);
}
}
static
int
proc_write_simdisk
(
struct
file
*
file
,
const
char
*
buffer
,
static
ssize_t
proc_write_simdisk
(
struct
file
*
file
,
const
char
__user
*
buf
,
unsigned
long
count
,
void
*
data
)
size_t
size
,
loff_t
*
ppos
)
{
{
char
*
tmp
=
kmalloc
(
count
+
1
,
GFP_KERNEL
);
char
*
tmp
=
kmalloc
(
count
+
1
,
GFP_KERNEL
);
struct
simdisk
*
dev
=
(
struct
simdisk
*
)
data
;
struct
simdisk
*
dev
=
PDE
(
file_inode
(
file
))
->
data
;
int
err
;
int
err
;
if
(
tmp
==
NULL
)
if
(
tmp
==
NULL
)
...
@@ -256,6 +263,12 @@ static int proc_write_simdisk(struct file *file, const char *buffer,
...
@@ -256,6 +263,12 @@ static int proc_write_simdisk(struct file *file, const char *buffer,
return
err
;
return
err
;
}
}
static
const
struct
file_operations
fops
=
{
.
read
=
proc_read_simdisk
,
.
write
=
proc_write_simdisk
,
.
llseek
=
default_llseek
,
};
static
int
__init
simdisk_setup
(
struct
simdisk
*
dev
,
int
which
,
static
int
__init
simdisk_setup
(
struct
simdisk
*
dev
,
int
which
,
struct
proc_dir_entry
*
procdir
)
struct
proc_dir_entry
*
procdir
)
{
{
...
@@ -289,10 +302,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
...
@@ -289,10 +302,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
set_capacity
(
dev
->
gd
,
0
);
set_capacity
(
dev
->
gd
,
0
);
add_disk
(
dev
->
gd
);
add_disk
(
dev
->
gd
);
dev
->
procfile
=
create_proc_entry
(
tmp
,
0644
,
procdir
);
dev
->
procfile
=
proc_create_data
(
tmp
,
0644
,
procdir
,
&
fops
,
dev
);
dev
->
procfile
->
data
=
dev
;
dev
->
procfile
->
read_proc
=
proc_read_simdisk
;
dev
->
procfile
->
write_proc
=
proc_write_simdisk
;
return
0
;
return
0
;
out_alloc_disk:
out_alloc_disk:
...
...
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