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
nexedi
linux
Commits
e91a9a7d
Commit
e91a9a7d
authored
Apr 09, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up types and remove unnecessary casts from fs/readdir.c.
Add user pointer annotations.
parent
5edf8b9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
fs/readdir.c
fs/readdir.c
+17
-18
No files found.
fs/readdir.c
View file @
e91a9a7d
...
...
@@ -58,7 +58,7 @@ struct old_linux_dirent {
};
struct
readdir_callback
{
struct
old_linux_dirent
*
dirent
;
struct
old_linux_dirent
__user
*
dirent
;
int
count
;
};
...
...
@@ -66,7 +66,7 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset
ino_t
ino
,
unsigned
int
d_type
)
{
struct
readdir_callback
*
buf
=
(
struct
readdir_callback
*
)
__buf
;
struct
old_linux_dirent
*
dirent
;
struct
old_linux_dirent
__user
*
dirent
;
if
(
buf
->
count
)
return
-
EINVAL
;
...
...
@@ -85,7 +85,7 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset
return
0
;
}
asmlinkage
long
old_readdir
(
unsigned
int
fd
,
void
*
dirent
,
unsigned
int
count
)
asmlinkage
long
old_readdir
(
unsigned
int
fd
,
struct
old_linux_dirent
__user
*
dirent
,
unsigned
int
count
)
{
int
error
;
struct
file
*
file
;
...
...
@@ -122,8 +122,8 @@ struct linux_dirent {
};
struct
getdents_callback
{
struct
linux_dirent
*
current_dir
;
struct
linux_dirent
*
previous
;
struct
linux_dirent
__user
*
current_dir
;
struct
linux_dirent
__user
*
previous
;
int
count
;
int
error
;
};
...
...
@@ -131,7 +131,7 @@ struct getdents_callback {
static
int
filldir
(
void
*
__buf
,
const
char
*
name
,
int
namlen
,
loff_t
offset
,
ino_t
ino
,
unsigned
int
d_type
)
{
struct
linux_dirent
*
dirent
;
struct
linux_dirent
__user
*
dirent
;
struct
getdents_callback
*
buf
=
(
struct
getdents_callback
*
)
__buf
;
int
reclen
=
ROUND_UP
(
NAME_OFFSET
(
dirent
)
+
namlen
+
1
);
...
...
@@ -161,10 +161,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
return
-
EFAULT
;
}
asmlinkage
long
sys_getdents
(
unsigned
int
fd
,
void
*
dirent
,
unsigned
int
count
)
asmlinkage
long
sys_getdents
(
unsigned
int
fd
,
struct
linux_dirent
__user
*
dirent
,
unsigned
int
count
)
{
struct
file
*
file
;
struct
linux_dirent
*
lastdirent
;
struct
linux_dirent
__user
*
lastdirent
;
struct
getdents_callback
buf
;
int
error
;
...
...
@@ -177,7 +177,7 @@ asmlinkage long sys_getdents(unsigned int fd, void * dirent, unsigned int count)
if
(
!
file
)
goto
out
;
buf
.
current_dir
=
(
struct
linux_dirent
*
)
dirent
;
buf
.
current_dir
=
dirent
;
buf
.
previous
=
NULL
;
buf
.
count
=
count
;
buf
.
error
=
0
;
...
...
@@ -203,8 +203,8 @@ asmlinkage long sys_getdents(unsigned int fd, void * dirent, unsigned int count)
#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
struct
getdents_callback64
{
struct
linux_dirent64
*
current_dir
;
struct
linux_dirent64
*
previous
;
struct
linux_dirent64
__user
*
current_dir
;
struct
linux_dirent64
__user
*
previous
;
int
count
;
int
error
;
};
...
...
@@ -212,7 +212,7 @@ struct getdents_callback64 {
static
int
filldir64
(
void
*
__buf
,
const
char
*
name
,
int
namlen
,
loff_t
offset
,
ino_t
ino
,
unsigned
int
d_type
)
{
struct
linux_dirent64
*
dirent
;
struct
linux_dirent64
__user
*
dirent
;
struct
getdents_callback64
*
buf
=
(
struct
getdents_callback64
*
)
__buf
;
int
reclen
=
ROUND_UP64
(
NAME_OFFSET
(
dirent
)
+
namlen
+
1
);
...
...
@@ -246,10 +246,10 @@ static int filldir64(void * __buf, const char * name, int namlen, loff_t offset,
return
-
EFAULT
;
}
asmlinkage
long
sys_getdents64
(
unsigned
int
fd
,
void
*
dirent
,
unsigned
int
count
)
asmlinkage
long
sys_getdents64
(
unsigned
int
fd
,
struct
linux_dirent64
__user
*
dirent
,
unsigned
int
count
)
{
struct
file
*
file
;
struct
linux_dirent64
*
lastdirent
;
struct
linux_dirent64
__user
*
lastdirent
;
struct
getdents_callback64
buf
;
int
error
;
...
...
@@ -262,7 +262,7 @@ asmlinkage long sys_getdents64(unsigned int fd, void * dirent, unsigned int coun
if
(
!
file
)
goto
out
;
buf
.
current_dir
=
(
struct
linux_dirent64
*
)
dirent
;
buf
.
current_dir
=
dirent
;
buf
.
previous
=
NULL
;
buf
.
count
=
count
;
buf
.
error
=
0
;
...
...
@@ -273,9 +273,8 @@ asmlinkage long sys_getdents64(unsigned int fd, void * dirent, unsigned int coun
error
=
buf
.
error
;
lastdirent
=
buf
.
previous
;
if
(
lastdirent
)
{
struct
linux_dirent64
d
;
d
.
d_off
=
file
->
f_pos
;
__put_user
(
d
.
d_off
,
&
lastdirent
->
d_off
);
typeof
(
lastdirent
->
d_off
)
d_off
=
file
->
f_pos
;
__put_user
(
d_off
,
&
lastdirent
->
d_off
);
error
=
count
-
buf
.
count
;
}
...
...
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