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
95fa25d9
Commit
95fa25d9
authored
Apr 22, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
namei: rename follow_link to trailing_symlink, move it down
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
21fef217
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
32 deletions
+30
-32
fs/namei.c
fs/namei.c
+30
-32
No files found.
fs/namei.c
View file @
95fa25d9
...
@@ -668,8 +668,6 @@ static __always_inline void set_root(struct nameidata *nd)
...
@@ -668,8 +668,6 @@ static __always_inline void set_root(struct nameidata *nd)
get_fs_root
(
current
->
fs
,
&
nd
->
root
);
get_fs_root
(
current
->
fs
,
&
nd
->
root
);
}
}
static
int
link_path_walk
(
const
char
*
,
struct
nameidata
*
);
static
__always_inline
unsigned
set_root_rcu
(
struct
nameidata
*
nd
)
static
__always_inline
unsigned
set_root_rcu
(
struct
nameidata
*
nd
)
{
{
struct
fs_struct
*
fs
=
current
->
fs
;
struct
fs_struct
*
fs
=
current
->
fs
;
...
@@ -880,33 +878,6 @@ get_link(struct path *link, struct nameidata *nd, void **p)
...
@@ -880,33 +878,6 @@ get_link(struct path *link, struct nameidata *nd, void **p)
return
res
;
return
res
;
}
}
static
int
follow_link
(
struct
path
*
link
,
struct
nameidata
*
nd
,
void
**
p
)
{
const
char
*
s
;
int
error
=
may_follow_link
(
link
,
nd
);
if
(
unlikely
(
error
))
return
error
;
nd
->
flags
|=
LOOKUP_PARENT
;
s
=
get_link
(
link
,
nd
,
p
);
if
(
unlikely
(
IS_ERR
(
s
)))
return
PTR_ERR
(
s
);
if
(
unlikely
(
!
s
))
return
0
;
if
(
*
s
==
'/'
)
{
if
(
!
nd
->
root
.
mnt
)
set_root
(
nd
);
path_put
(
&
nd
->
path
);
nd
->
path
=
nd
->
root
;
path_get
(
&
nd
->
root
);
nd
->
flags
|=
LOOKUP_JUMPED
;
}
nd
->
inode
=
nd
->
path
.
dentry
->
d_inode
;
error
=
link_path_walk
(
s
,
nd
);
if
(
unlikely
(
error
))
put_link
(
nd
,
link
,
*
p
);
return
error
;
}
static
int
follow_up_rcu
(
struct
path
*
path
)
static
int
follow_up_rcu
(
struct
path
*
path
)
{
{
struct
mount
*
mnt
=
real_mount
(
path
->
mnt
);
struct
mount
*
mnt
=
real_mount
(
path
->
mnt
);
...
@@ -1970,6 +1941,33 @@ static void path_cleanup(struct nameidata *nd)
...
@@ -1970,6 +1941,33 @@ static void path_cleanup(struct nameidata *nd)
fput
(
nd
->
base
);
fput
(
nd
->
base
);
}
}
static
int
trailing_symlink
(
struct
path
*
link
,
struct
nameidata
*
nd
,
void
**
p
)
{
const
char
*
s
;
int
error
=
may_follow_link
(
link
,
nd
);
if
(
unlikely
(
error
))
return
error
;
nd
->
flags
|=
LOOKUP_PARENT
;
s
=
get_link
(
link
,
nd
,
p
);
if
(
unlikely
(
IS_ERR
(
s
)))
return
PTR_ERR
(
s
);
if
(
unlikely
(
!
s
))
return
0
;
if
(
*
s
==
'/'
)
{
if
(
!
nd
->
root
.
mnt
)
set_root
(
nd
);
path_put
(
&
nd
->
path
);
nd
->
path
=
nd
->
root
;
path_get
(
&
nd
->
root
);
nd
->
flags
|=
LOOKUP_JUMPED
;
}
nd
->
inode
=
nd
->
path
.
dentry
->
d_inode
;
error
=
link_path_walk
(
s
,
nd
);
if
(
unlikely
(
error
))
put_link
(
nd
,
link
,
*
p
);
return
error
;
}
static
inline
int
lookup_last
(
struct
nameidata
*
nd
)
static
inline
int
lookup_last
(
struct
nameidata
*
nd
)
{
{
if
(
nd
->
last_type
==
LAST_NORM
&&
nd
->
last
.
name
[
nd
->
last
.
len
])
if
(
nd
->
last_type
==
LAST_NORM
&&
nd
->
last
.
name
[
nd
->
last
.
len
])
...
@@ -2005,7 +2003,7 @@ static int path_lookupat(int dfd, const struct filename *name,
...
@@ -2005,7 +2003,7 @@ static int path_lookupat(int dfd, const struct filename *name,
while
(
err
>
0
)
{
while
(
err
>
0
)
{
void
*
cookie
;
void
*
cookie
;
struct
path
link
=
nd
->
link
;
struct
path
link
=
nd
->
link
;
err
=
follow_
link
(
&
link
,
nd
,
&
cookie
);
err
=
trailing_sym
link
(
&
link
,
nd
,
&
cookie
);
if
(
err
)
if
(
err
)
break
;
break
;
err
=
lookup_last
(
nd
);
err
=
lookup_last
(
nd
);
...
@@ -2351,7 +2349,7 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
...
@@ -2351,7 +2349,7 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
while
(
err
>
0
)
{
while
(
err
>
0
)
{
void
*
cookie
;
void
*
cookie
;
struct
path
link
=
*
path
;
struct
path
link
=
*
path
;
err
=
follow_
link
(
&
link
,
nd
,
&
cookie
);
err
=
trailing_sym
link
(
&
link
,
nd
,
&
cookie
);
if
(
err
)
if
(
err
)
break
;
break
;
err
=
mountpoint_last
(
nd
,
path
);
err
=
mountpoint_last
(
nd
,
path
);
...
@@ -3235,7 +3233,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
...
@@ -3235,7 +3233,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
struct
path
link
=
nd
->
link
;
struct
path
link
=
nd
->
link
;
void
*
cookie
;
void
*
cookie
;
nd
->
flags
&=
~
(
LOOKUP_OPEN
|
LOOKUP_CREATE
|
LOOKUP_EXCL
);
nd
->
flags
&=
~
(
LOOKUP_OPEN
|
LOOKUP_CREATE
|
LOOKUP_EXCL
);
error
=
follow_
link
(
&
link
,
nd
,
&
cookie
);
error
=
trailing_sym
link
(
&
link
,
nd
,
&
cookie
);
if
(
unlikely
(
error
))
if
(
unlikely
(
error
))
break
;
break
;
error
=
do_last
(
nd
,
file
,
op
,
&
opened
,
pathname
);
error
=
do_last
(
nd
,
file
,
op
,
&
opened
,
pathname
);
...
...
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